Commit 9d6d9d28 authored by Leigh Stoller's avatar Leigh Stoller

Fully automated setup of the Portal interface, which for now means

operating in standalone mode (not part of a federation), which would be
the case for everyone that is not us. Further exercise would be to
automate portal setup when part of a federation. Not a big deal to add,
but lets checkpoint what I have done so far.
parent d2e6781b
......@@ -229,6 +229,7 @@ my %emulabconfig = (
"CONFIG_GENIRACK" => 0,
"CONFIG_ZFS" => 0,
"CONFIG_AUTOFS" => 0,
"CONFIG_PORTAL" => 0,
# Default protogeni package if LOAD_PROTOGENI is enabled.
"PGENI_PKG" => "emulab-protogeni-1.0",
......@@ -3133,6 +3134,13 @@ sub CreateDefsFile($)
print OUTDEFS "PROTOGENI_DOMAIN=\"$protogeni_domain\"\n";
print OUTDEFS "FANCYBANNER=1\n";
print OUTDEFS "ISOLATEADMINS=0\n";
if ($emulabconfig{"CONFIG_PORTAL"} && !$config_genirack) {
print OUTDEFS "PORTAL_ENABLE=1\n";
print OUTDEFS "PROTOGENI_ISCLEARINGHOUSE=1\n";
print OUTDEFS "PROTOGENI_LOCALUSER=1\n";
print OUTDEFS "PROTOGENI_WEBSITE=${bossnode_hostname}.${ourdomain}\n";
}
}
if ($emulabconfig{"CONFIG_FIREWALL_BOSS"}) {
print OUTDEFS "FIREWALL_BOSS=1\n";
......
......@@ -255,7 +255,7 @@ elsif ($server eq "boss") {
'boss/mfs', 'boss/images', 'boss/xen',
'boss/experiments',
'boss/protogeni', 'boss/firewall', 'boss/servers',
'boss/shellinabox'
'boss/shellinabox', 'boss/portal'
);
}
elsif ($server eq "fs") {
......
......@@ -300,6 +300,8 @@ $CRONTAB = "/etc/crontab";
$TIPLOG_DIR = "/var/log/tiplogs";
$OPSWWWDIR = "/usr/local/www/data";
$WWWDIR = "$PREFIX/www";
$TBBASE = "@TBBASE@";
$THISHOMEBASE = "@THISHOMEBASE@";
$AUTHKEYS = "/root/.ssh/authorized_keys";
$RCCAPTURE = "$PREFIX/etc/rc.capture";
$RCLOCAL = "/etc/rc.local";
......
<profile>
<attribute name='profile_pid'> <value>emulab-ops</value></attribute>
<attribute name='profile_name'> <value>OneNode</value></attribute>
<attribute name='rspec'> <value>&lt;rspec xmlns:client=&quot;http://www.protogeni.net/resources/rspec/ext/client/1&quot; xmlns:emulab=&quot;http://www.protogeni.net/resources/rspec/ext/emulab/1&quot; xmlns:jacks=&quot;http://www.protogeni.net/resources/rspec/ext/jacks/1&quot; xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot; xmlns=&quot;http://www.geni.net/resources/rspec/3&quot; xsi:schemaLocation=&quot;http://www.geni.net/resources/rspec/3 http://www.geni.net/resources/rspec/3/request.xsd&quot; type=&quot;request&quot;&gt;
&lt;rspec_tour xmlns=&quot;http://www.protogeni.net/resources/rspec/ext/apt-tour/1&quot;&gt;
&lt;description type=&quot;markdown&quot;&gt;One raw PC running the default OS.&lt;/description&gt;
&lt;instructions type=&quot;markdown&quot;&gt;Log into your PC and poke around. You have root access via `sudo`. Any work you do on your PC will be lost when it terminates.&lt;/instructions&gt;
&lt;/rspec_tour&gt;
&lt;node client_id=&quot;node1&quot; exclusive=&quot;true&quot;&gt;
&lt;sliver_type name=&quot;raw-pc&quot;&gt;
&lt;/sliver_type&gt;
&lt;/node&gt;
&lt;/rspec&gt;</value></attribute>
<attribute name='script'> <value>&quot;&quot;&quot;One raw PC running the default OS.
Instructions:
Log into your PC and poke around. You have root access via `sudo`. Any work you do on your PC will be lost when it terminates.&quot;&quot;&quot;
# Import the Portal object.
import geni.portal as portal
# Import the ProtoGENI library.
import geni.rspec.pg as pg
# Import the Emulab specific extensions.
import geni.rspec.emulab as emulab
# Create a portal object,
pc = portal.Context()
# Create a Request object to start building the RSpec.
request = pc.makeRequestRSpec()
# Node node1
node1 = request.RawPC('node1')
# Print the generated rspec
pc.printRequestRSpec(request)
</value></attribute>
<attribute name='profile_listed'><value>1</value></attribute>
<attribute name='profile_public'><value>1</value></attribute>
</profile>
<profile>
<attribute name='profile_pid'> <value>emulab-ops</value></attribute>
<attribute name='profile_name'> <value>OneVM</value></attribute>
<attribute name='rspec'> <value>&lt;rspec xmlns:client=&quot;http://www.protogeni.net/resources/rspec/ext/client/1&quot; xmlns:emulab=&quot;http://www.protogeni.net/resources/rspec/ext/emulab/1&quot; xmlns:jacks=&quot;http://www.protogeni.net/resources/rspec/ext/jacks/1&quot; xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot; xmlns=&quot;http://www.geni.net/resources/rspec/3&quot; xsi:schemaLocation=&quot;http://www.geni.net/resources/rspec/3 http://www.geni.net/resources/rspec/3/request.xsd&quot; type=&quot;request&quot;&gt;
&lt;rspec_tour xmlns=&quot;http://www.protogeni.net/resources/rspec/ext/apt-tour/1&quot;&gt;
&lt;description type=&quot;markdown&quot;&gt;One small virtual machine running Ubuntu 14.04 LTS.&lt;/description&gt;
&lt;instructions type=&quot;markdown&quot;&gt;Log into your VM and poke around. You have root access via `sudo`. Any work you do in the VM will be lost when it terminates.&lt;/instructions&gt;
&lt;/rspec_tour&gt;
&lt;node client_id=&quot;node1&quot; exclusive=&quot;false&quot;&gt;
&lt;sliver_type name=&quot;emulab-xen&quot;&gt;
&lt;/sliver_type&gt;
&lt;/node&gt;
&lt;/rspec&gt;</value></attribute>
<attribute name='script'> <value>&quot;&quot;&quot;One small virtual machine running Ubuntu 14.04 LTS.
Instructions:
Log into your VM and poke around. You have root access via `sudo`. Any work you do in the VM will be lost when it terminates.&quot;&quot;&quot;
# Import the Portal object.
import geni.portal as portal
# Import the ProtoGENI library.
import geni.rspec.pg as pg
# Import the Emulab specific extensions.
import geni.rspec.emulab as emulab
# Create a portal object,
pc = portal.Context()
# Create a Request object to start building the RSpec.
request = pc.makeRequestRSpec()
# Node node1
node1 = request.XenVM('node1')
# Print the generated rspec
pc.printRequestRSpec(request)
</value></attribute>
<attribute name='profile_listed'><value>1</value></attribute>
<attribute name='profile_public'><value>1</value></attribute>
</profile>
#
# Set up the Emulab Portal.
#
use strict;
use libinstall;
use installvars;
use emdb;
use EmulabConstants;
my $PORTAL_ENABLE = 1;
my $MYURN = "urn:publicid:IDN+${OURDOMAIN}+authority+cm";
my $GENILIB_REPO = "https://bitbucket.org/emulab/geni-lib";
my $GENILIB_SRCDIR = "$TOP_SRCDIR/../geni-lib";
my $APACHEPREFIX = ("$APACHE_VERSION" == "22" ? "apache22" : "apache");
my $PROFILE_ONEVM = "$TOP_SRCDIR/install/onevm.xml";
my $PROFILE_ONEPC = "$TOP_SRCDIR/install/onepc.xml";
my $MANAGE_PROFILE = "$TBROOT/bin/manage_profile";
sub Install($$$)
{
my ($server, $isupdate, $impotent) = @_;
Phase "portal", "Setting up the portal", sub {
PhaseSkip("Portal not enabled")
if (!$PORTAL_ENABLE);
# Only first token on THISHOMEBASE;
my ($THB) = split(/\./, $THISHOMEBASE);
Phase "aggregate", "Adding entry to aggregates table", sub {
my $query_result =
DBQueryWarn("select urn from apt_aggregates where urn='$MYURN'");
PhaseFail("DB error")
if (!$query_result);
PhaseSkip("already added")
if ($query_result->numrows);
DBQueryWarn("insert into apt_aggregates set ".
" urn='$MYURN', name='$THB', ".
" nickname='$THB', ".
" abbreviation='$THB', ".
" weburl='$TBBASE', ".
" updated=now(),has_datasets=1, ".
" portals='emulab'")
or PhaseFail("DB Error");
};
Phase "geni-lib", "Setting up geni-lib", sub {
Phase "clone", "Cloning geni-lib from repo", sub {
PhaseSkip("Already cloned")
if (-e "$GENILIB_SRCDIR/.hg");
ExecQuietFatal("cd $TOP_SRCDIR/..; ".
"hg clone $GENILIB_REPO");
ExecQuietFatal("cd $GENILIB_SRCDIR; ".
"hg update 0.9-EMULAB");
};
Phase "rsync-one", "Copying geni-lib to /usr/local", sub {
ExecQuietFatal("cd $TOP_SRCDIR/..; ".
"rsync -a geni-lib /usr/local/lib");
};
Phase "rsync-two", "Copying geni-lib to $TBROOT", sub {
ExecQuietFatal("cd $TOP_SRCDIR/..; ".
"rsync -a geni-lib $TBROOT/opsdir/lib");
};
};
Phase "rc.conf", "Adding fcgid to apache flags", sub {
PhaseSkip("already added") unless `grep -q PGENI_FCGID $RCCONF`;
my $flags = "-DSSL -DPGENI -DPGENI_FCGID";
AppendToFileFatal($RCCONF,
"${APACHEPREFIX}_flags=\"$flags\"");
ExecQuietFatal("$APACHE_START_COMMAND restart");
};
Phase "profile1", "Creating initial OneVM profile", sub {
my $tbopspid = TBOPSPID();
my $query_result =
DBQueryWarn("select profileid from apt_profiles ".
"where pid='$tbopspid' and name='OneVM'");
PhaseFail("DB error")
if (!$query_result);
PhaseSkip("already created")
if ($query_result->numrows);
ExecQuietFatal("$SUDO -u $PROTOUSER ".
" $MANAGE_PROFILE create $PROFILE_ONEVM");
};
Phase "profile2", "Creating initial OneNode profile", sub {
my $tbopspid = TBOPSPID();
my $query_result =
DBQueryWarn("select profileid from apt_profiles ".
"where pid='$tbopspid' and name='OneNode'");
PhaseFail("DB error")
if (!$query_result);
PhaseSkip("already created")
if ($query_result->numrows);
ExecQuietFatal("$SUDO -u $PROTOUSER ".
" $MANAGE_PROFILE create $PROFILE_ONEPC");
};
Phase "sitevar", "Setting default_profile sitevar", sub {
ExecQuietFatal("$PREFIX/sbin/setsitevar ".
"portal/default_profile emulab-ops,OneNode");
};
};
return 0;
}
# Local Variables:
# mode:perl
# End:
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment