Changes between Initial Version and Version 1 of GpoLab/MyplcReferenceImplementation


Ignore:
Timestamp:
03/14/11 22:53:30 (13 years ago)
Author:
chaos@bbn.com
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • GpoLab/MyplcReferenceImplementation

    v1 v1  
     1[[PageOutline]]
     2
     3'''IMPORTANT NOTE: this document is currently incomplete and untested.'''
     4
     5= GPO Lab Reference Implementation for Installation of MyPLC =
     6
     7== Purpose ==
     8The purpose of this document is to provide a reference implementation for the installation of MyPLC-based PlanetLab deployment at GENI sites.  The contents of this document are based on experiences of setting up MyPLC-based PlanetLab deployments at the GPO.  Following this document exactly should give you a working MyPLC-based PlanetLab deployment that supports the GENI AM API using the SFA software; however, this document is intended to only be an example configuration. 
     9
     10== Scope ==
     11This document is intended for GENI site operators who would like to perform a fresh install of MyPLC with SFA, or for those who have MyPLC deployed and would like to upgrade SFA.
     12
     13== Variables ==
     14A few variables will be set according to your specific situation.  GPO lab values for these variables are listed below for reference.
     15|| '''Variable''' || '''GPO Values''' || '''Description''' || '''Important Notes''' ||
     16|| <base_os> || Fedora 8 ||  The OS which you are installing MyPLC on ||  ||
     17|| <myplc_distribution> || planetlab-f8-i386-5.0 || The MyPLC distribution which you are using, comprised of base OS, architecture, and PLC version ||  ||
     18|| <myplc_baseurl> || http://build.planet-lab.org/planetlab/f8/planetlab-f8-i386-5.0-rc14/RPMS || URL of the MyPLC repository which you will be using ||  ||
     19|| <myplc_name> ||  || Name for your MyPLC instance and default site ||  ||
     20|| <myplc_shortname> ||  || Abbreviated name for your MyPLC instance ||  ||
     21|| <mgmt_login_base> ||  || The prefix for usernames associated with all slices at a site || Do not use underscores here, or you'll get "PLC: Bootstrapping the database: [FAILED]" at PLC startup ||
     22|| <myplc_root_user> || root@gpolab.bbn.com || MyPLC application's initial administrative user of a MyPLC instance || Do not use a plus character here, or sfa_import.py will fail later ||
     23|| <myplc_root_password> ||  || MyPLC application's password for <myplc_root_user> ||  ||
     24|| <myplc_support_email> || plc-admin@myplc.gpolab.bbn.com || Email address for MyPLC-generated support emails ||  ||
     25|| <myplc_www_host> || myplc.gpolab.bbn.com || URL or IP address of MyPLC web server || ||
     26|| <myplc_api_host> || myplc.gpolab.bbn.com || URL or IP address of MyPLC API server || ||
     27|| <myplc_db_host> || localhost.localdomain || URL or IP address of MyPLC database server || ||
     28|| <myplc_boot_host> || myplc.gpolab.bbn.com || URL or IP address of MyPLC boot server || ||
     29|| <myplc_dns1> || GPO lab DNS server 1 IP address || IP address of DNS server 1 ||  ||
     30|| <myplc_dns2> || GPO lab DNS server 2 IP address || IP address of DNS server 2 ||  ||
     31|| <public_site_name> || myplc.gpolab.bbn.com || Full name of public site ||  ||
     32|| <public_site_shortname> || myplc || Abbreviated name of public site ||  ||
     33|| <public_login_base> || gpolab || Prefix for usernames of PlanetLab slices ||  ||
     34|| <myplc_deployment> || planetlab-f8-i386 || Deployment string containing base OS and architecture information ||  ||
     35|| <sfa_git_tag> || sfa-geni-gec9 || Latest recommended stable tag of SFA software in the git repository ||  ||
     36
     37= Installing MyPLC from Scratch =
     38
     39== Step 1: Install the Base OS ==
     40The PlanetLab team also currently supports Fedora 8 and Fedora 12 as the base OS for MyPLCs.  If you choose to use a different Fedora distribution from the distribution that the GPO lab uses, some of the following steps in this section may not apply.
     41
     42=== SELinux ===
     43Edit {{{/etc/selinux/config}}} (as root) to set {{{SELINUX=disabled}}}.  You will need to reboot the machine for this change to occur.
     44
     45=== Firewall ===
     46Below are important firewall considerations:
     47 * TCP port 80 access is needed access to the MyPLC web interface and the PLC API
     48 * TCP port 443 access is needed access to the MyPLC web interface and the PLC API
     49  * Needed by PlanetLab nodes
     50  * Useful for MyPLC administrators
     51  * Can be used by experimenters
     52 * TCP port 22 access is important for MyPLC administrators
     53 * TCP port 12346 access is need for slice creation through the SFA server
     54
     55== Step 2: Install MyPLC ==
     56At this point, you need to choose your MyPLC distribution.  You should choose one that matches your base OS chosen in #Step1:InstalltheBaseOS and your architecture.  It is important to choose a release candidate as a repository.  More information on choosing a repository can be found at [https://svn.planet-lab.org/wiki/MyPLCUserGuide#NoteonversionsLocatingabuild].
     57
     581. Add your MyPLC repository
     59{{{
     60sudo sh -c 'echo "[myplc]" > /etc/yum.repos.d/myplc.repo'
     61sudo sh -c 'echo "name= MyPLC" >> /etc/yum.repos.d/myplc.repo'
     62sudo sh -c 'echo "baseurl=<myplc_baseurl>" >> /etc/yum.repos.d/myplc.repo'
     63sudo sh -c 'echo "enabled=1" >> /etc/yum.repos.d/myplc.repo'
     64sudo sh -c 'echo "gpgcheck=0" >> /etc/yum.repos.d/myplc.repo'
     65}}}
     66
     672. Install MyPLC:
     68{{{
     69sudo yum install myplc
     70}}}
     71
     72== Step 3: Configuring MyPLC Default Site ==
     73There are two paths you can take in terms of setting up your MyPLC sites.
     74 * Path A: set up one single site for both management of MyPLC and management of PlanetLab nodes. 
     75 * Path B:
     76  * Let PLC create a default site for administrators to manage PLC
     77  * Manually create another site for managing PlanetLab nodes. 
     78
     79A full explanation on these two choices can be found at [https://svn.planet-lab.org/wiki/MyPLCUserGuide#CreatingasiteandPIaccount].  GPO currently follows path A and only uses one site on its MyPLC machines; however this increases the amount of work that one must do to maintain the site.  Below, both paths are outlined.
     80
     81=== Path A: One Single Site ===
     82==== A Part 1: Configuring the MyPLC Site ====
     83Run the plc-config-tty program to configure PLC:
     84{{{
     85sudo plc-config-tty
     86}}}
     87
     88 In plc-config-tty:
     89  * Enter 'u' to make "usual" changes. Change the following settings (leave the others as they are):
     90   * PLC_NAME : <public_site_name>
     91   * PLC_SHORTNAME :  <public_site_shortname>
     92   * PLC_SLICE_PREFIX : <public_login_base>
     93   * PLC_ROOT_USER : <myplc_root_user>
     94   * PLC_ROOT_PASSWORD : <myplc_root_password>
     95   * PLC_MAIL_ENABLED : [false] true
     96   * PLC_MAIL_SUPPORT_ADDRESS : <myplc_support_email>
     97   * PLC_DB_HOST : <myplc_db_host>
     98   * PLC_API_HOST : <myplc_www_host>
     99   * PLC_WWW_HOST : <myplc_api_host>
     100   * PLC_BOOT_HOST : <myplc_boot_host>
     101   * PLC_NET_DNS1 : <myplc_dns1>
     102   * PLC_NET_DNS2 : <myplc_dns2>
     103  * Enter command (u for usual changes, w to save, ? for help) w
     104  * Enter command (u for usual changes, w to save, ? for help) q
     105
     1062. Start plc:
     107{{{
     108sudo service plc start
     109}}}
     110
     1113. Obtain the database password generated by PLC:
     112{{{
     113sudo plc-config-tty
     114}}}
     115
     116 In plc-config-tty:
     117  * enter 's PLC_DB_PASSWORD' to display the PLC DB password, and note it down (SFA will need this later).
     118
     119==== A Part 2: Setting the site as public ====
     120Every time the plc service gets restarted (e.g. on boot), the site will be set as private.  The site that controls the PlanetLab nodes must be public for experimenters to use it.  ''Contact gpo-infra@geni.net if you'd like the workaround we use to automate this.''
     121
     122Set the default site as public:
     123{{{
     124$ sudo plcsh
     125>>> UpdateSite('<public_login_base> Central', {'is_public': True})
     126>>> exit
     127}}}
     128
     129=== Path B: Two Sites ===
     130==== B Part 1: Configuring MyPLC Default Site ====
     1311. Run the plc-config-tty program to configure PLC:
     132{{{
     133sudo plc-config-tty
     134}}}
     135
     136 In plc-config-tty:
     137  * Enter 'u' to make "usual" changes. Change the following settings (leave the others as they are):
     138   * PLC_NAME : <myplc_name>
     139   * PLC_SHORTNAME :  <myplc_shortname>
     140   * PLC_SLICE_PREFIX : <mgmt_login_base>
     141   * PLC_ROOT_USER : <myplc_root_user>
     142   * PLC_ROOT_PASSWORD : <myplc_root_password>
     143   * PLC_MAIL_ENABLED : [false] true
     144   * PLC_MAIL_SUPPORT_ADDRESS : <myplc_support_email>
     145   * PLC_DB_HOST : <myplc_db_host>
     146   * PLC_API_HOST : <myplc_www_host>
     147   * PLC_WWW_HOST : <myplc_api_host>
     148   * PLC_BOOT_HOST : <myplc_boot_host>
     149   * PLC_NET_DNS1 : <myplc_dns1>
     150   * PLC_NET_DNS2 : <myplc_dns2>
     151  * Enter command (u for usual changes, w to save, ? for help) w
     152  * Enter command (u for usual changes, w to save, ? for help) q
     153
     1542. Start plc:
     155{{{
     156sudo service plc start
     157}}}
     158
     1593. Obtain the database password generated by PLC:
     160{{{
     161sudo plc-config-tty
     162}}}
     163
     164 In plc-config-tty:
     165  * enter 's PLC_DB_PASSWORD' to display the PLC DB password, and note it down (SFA will need this later).
     166
     167==== B Part 2: Create and Configure MyPLC Public Site ====
     168You now need to create a site for this MyPLC instance where your nodes and slices are managed.  Instructions on how to do this through the web interface can be found at [https://svn.planet-lab.org/wiki/MyPLCUserGuide#CreatingasiteandPIaccount].
     169
     170When filling out the web form, you should use the following information:
     171 * Site name: <public_site_name>
     172 * Login base: <public_login_base>
     173 * Abbreviated name: <public_site_shortname>
     174 * URL: Doesn't matter
     175 * Latitude: Doesn't matter
     176 * Longitude: Doesn't matter
     177 * PI First Name: <Admin's first name>
     178 * PI Last Name: <Admin's last name>
     179 * PI Title: Doesn't matter
     180 * PI Phone: Doesn't matter
     181 * PI Email: <Admin's email address> (this will be used for username)
     182 * PI Password: <Admin password>
     183
     184Again, once you file the registration, next steps can be found at [https://svn.planet-lab.org/wiki/MyPLCUserGuide#CreatingasiteandPIaccount].  Don't forget to upload your public keys for these new users.
     185
     186== Step 4: Create Nodes ==
     187
     188=== Configure the Nodes ===
     189Add the node's primary interface and configure the node through MyPLC the web interface or using plcsh.  For information on creating nodes through the web interface, see [https://svn.planet-lab.org/wiki/MyPLCUserGuide#Installingnodes]. 
     190
     191Below is an example of how to configure a node with static interfaces:
     192
     193==== Variables ====
     194|| '''Variable''' || '''Description''' || '''Important Notes''' ||
     195|| <node_fqdn> || Fully qualified domain name of the node ||  ||
     196|| <if_dns1> || IP address of primary DNS server for this interface ||  ||
     197|| <if_dns2> || IP address of secondary DNS server for this interface ||  ||
     198|| <if_subnet_id> || Subnet ID for this interface ||  ||
     199|| <if_netmask> || Netmask for this interface ||  ||
     200|| <if_gateway> || Gateway for this interface ||  ||
     201|| <if_ipaddr> || IP address for this interface ||  ||
     202
     203==== Steps ====
     2041. Determine your <myplc_deployment>:
     205{{{
     206ls /var/www/html/boot/ | grep bootstrapfs-*.tar.bz2
     207}}}
     208
     209The output will include:
     210{{{
     211bootstrapfs-<myplc_deployment>.tar.bz2
     212}}}
     213
     2142. Open plcsh:
     215{{{
     216sudo plcsh
     217}}}
     218
     2193. Type in the following commands in plcsh to configure the node:
     220{{{
     221newnode={}
     222newnode["boot_state"]="reinstall"
     223newnode["model"]="Custom"
     224newnode["deployment"]="<myplc_deployment>"
     225newnode["hostname"]="<node_fqdn>"
     226AddNode("<public_login_base>",newnode)
     227}}}
     228
     2294. Type the following commands in plcsh to configure the interface:
     230{{{
     231newinterface={}
     232newinterface["network"]="<node_network>"
     233newinterface["is_primary"]=True
     234newinterface["dns1"]="<node_dns1>"
     235newinterface["dns2"]="<node_dns2>"
     236newinterface["mac"]=""
     237newinterface["netmask"]="<node_netmask>"
     238newinterface["gateway"]="<node_gateway>"
     239newinterface["broadcast"]="<node_broadcast>"
     240newinterface["ip"]="<node_ipaddr>"
     241newinterface["method"]="static"
     242newinterface["type"]="ipv4"
     243AddInterface("<node_fqdn>",newinterface)
     244}}}
     245
     2465. If desired, add other interfaces:
     247{{{
     248newinterface={}
     249newinterface["network"]="<node_network>"
     250newinterface["is_primary"]=False
     251newinterface["dns1"]="<node_dns1>"
     252newinterface["dns2"]="<node_dns2>"
     253newinterface["mac"]=""
     254newinterface["netmask"]="<node_netmask>"
     255newinterface["gateway"]="<node_gateway>"
     256newinterface["broadcast"]="<node_broadcast>"
     257newinterface["ip"]="<node_ipaddr>"
     258newinterface["method"]="static"
     259newinterface["type"]="ipv4"
     260AddInterface("<node_fqdn>",newinterface)
     261}}}
     262
     2636. Exit from plcsh:
     264{{{
     265exit
     266}}}
     267
     268=== Obtain the Node's Boot image ===
     2691. From the node page, change the Download pulldown menu to "Download ISO image for <node_fqdn>". This will take you to a download screen.
     270
     2712. Click "Download ISO image"
     272
     273=== Boot the Node ===
     274Boot the node from the boot media you just downloaded, and verify that the MyPLC web interface shows that the node is in boot state.
     275
     276=== Important Notes on PlanetLab Node Interfaces ===
     277If you have used <base_url>=http://build.planet-lab.org/planetlab/f8/planetlab-f8-i386-5.0-rc14/RPMS, then you will need to downgrade your `util-vserver-pl` package:
     278 * Version packaged with this repository: util-vserver-pl-0.3.31.planetlab
     279 * Target version: util-vserver-pl-0.3-17.planetlab
     280 * If you cannot find this RPM, please contact gpo-infra@geni.net
     281 * Install:
     282 {{{
     283 rpm -Uv --force util-vserver-pl-0.3-17.planetlab
     284 }}}
     285 * Reboot the node to cause the changes to take effect
     286
     287= Adding SFA to MyPLC =
     288
     289== Step 0: Preparing to Upgrade SFA ==
     290This step is only for those who were already running an older version of SFA, including RPM-based versions sfa-0.9-14 or earlier, and want to update their SFA versions.
     291
     292Prepare SFA for an upgrade:
     293{{{
     294sudo /etc/init.d/sfa stop
     295sudo sfa-nuke-plc.py
     296sudo rm /etc/sfa/trusted_roots/*.gid
     297sudo rm -rf /var/lib/sfa/
     298}}}
     299
     300== Step 1: Install SFA ==
     301From some machine that has git installed, do the following:
     302
     3031. Get a tarball of the <sfa_git_tag> tag of SFA:
     304{{{
     305git clone git://git.planet-lab.org/sfa.git
     306gittag=<sfa_git_tag>
     307cd sfa
     308git archive --format=tar --prefix=${gittag}/ ${gittag} | gzip > ${gittag}.tar.gz
     309}}}
     310
     311Copy the tarball over to the MyPLC machine, and from there do the following:
     312
     3132. Install SFA prerequisites:
     314{{{
     315sudo yum update fedora-release
     316sudo yum install m2crypto python-dateutil python-psycopg2 myplc-config pyOpenSSL python-ZSI libxslt-python xmlsec1-openssl-devel python-lxml
     317sudo yum upgrade pyOpenSSL python-lxml
     318}}}
     319
     3203. Compile SFA code on the MyPLC machine:
     321{{{
     322mkdir ~/src
     323cd ~/src
     324tar xvzf ~/<sfa_git_tag>.tar.gz
     325cd <sfa_git_tag>
     326make
     327}}}
     328
     329Expect about 6 lines of output and no obvious errors.
     330
     3314. Install SFA:
     332{{{
     333sudo make install
     334}}}
     335
     336== Step 2: Configure SFA ==
     337
     3381. Configure SFA using the {{{sfa-config-tty}}} command:
     339{{{
     340$ sudo sfa-config-tty
     341}}}
     342 * Enter command (u for usual changes, w to save, ? for help) u
     343  * SFA_INTERFACE_HRN: plc.<public_login_base>
     344  * SFA_REGISTRY_ROOT_AUTH: plc
     345  * SFA_REGISTRY_HOST : <myplc_api_host>
     346  * SFA_AGGREGATE_HOST : <myplc_api_host>
     347  * SFA_SM_HOST : <myplc_api_host>
     348  * SFA_PLC_USER: <myplc_root_user>
     349  * SFA_PLC_PASSWORD: <myplc_root_password>
     350  * SFA_PLC_DB_HOST : <myplc_db_host>
     351  * SFA_PLC_DB_USER : postgres
     352  * SFA_PLC_DB_PASSWORD: <myplc_db_password> 
     353  * SFA_PLC_URL : [https://localhost:443/PLCAPI/]
     354 * Enter command (u for usual changes, w to save, ? for help) w
     355 * Enter command (u for usual changes, w to save, ? for help) q
     356
     3572. Start up SFA once, to create the initial /etc/sfa/sfa_config.py, and stop it again
     358{{{
     359sudo service sfa reload
     360}}}
     361
     3623. Import the PLC database into SFA:
     363{{{
     364sudo sfa-import-plc.py
     365}}}
     366 
     3674. Start up SFA again:
     368{{{
     369sudo service sfa restart
     370}}}
     371
     372= Additional Features Used in the GPO Lab =
     373
     374== Trust a Remote Slice Authority ==
     375=== Variables ===
     376|| '''Variable''' || '''GPO Values''' || '''Description''' || '''Important Notes''' ||
     377|| <cert_base> || pgeni.gpolab.bbn.com || Filename for the certificate (without file extension) ||  ||
     378|| <cert_url> || http://www.pgeni.gpolab.bbn.com/ca-cert || Base URL for certificate ||  ||
     379
     380Get a copy of the certificate:
     381{{{
     382wget <cert_url>/<cert>.pem
     383}}}
     384
     385Copy that certificate into a `.crt` file under `/etc/sfa/trusted_roots`:
     386{{{
     387sudo cp <cert>.pem /etc/sfa/trusted_roots/<cert>.crt
     388}}}
     389
     390Restart sfa:
     391{{{
     392sudo service sfa restart
     393}}}
     394
     395=== Reference ===
     396As an example, below is the process to configure your SFA instance to allow slivers to slices created at the GPO Lab slice authority, `pgeni.gpolab.bbn.com`.
     397{{{
     398wget http://www.pgeni.gpolab.bbn.com/ca-cert/pgeni.gpolab.bbn.com.pem
     399sudo cp pgeni.gpolab.bbn.com.pem /etc/sfa/trusted_roots/pgeni.gpolab.bbn.com.crt
     400sudo service sfa restart
     401}}}
     402
     403== Set Up Database Vacuum ==
     404
     405=== Description ===
     406Postgresql databases are supposed to be vacuumed on a regular basis, however MyPLC does not set this up for you.  On GPO lab MyPLC machines, we are currently vacuuming of the database on a daily basis, and running full vacuums on a monthly basis.
     407
     408=== Variables ===
     409|| '''Variable''' || '''GPO Values''' || '''Description''' || '''Important Notes''' ||
     410|| <username> || postgres || Username of the owner of the postgresql database || It is best to use the owner of the postgresql database instead of the owner of the planetlab5 database ||
     411|| <database_name> || planetlab5 || Name of the database that needs vacuuming ||  ||
     412
     413=== Reference ===
     414For reference, below are the commands we use for this.
     415
     416Vacuum:
     417{{{
     418/usr/bin/vacuumdb --username <username> --analyze <database_name>
     419}}}
     420
     421Full Vacuum:
     422{{{
     423/usr/bin/vacuumdb --username <username> --analyze --full <database_name>
     424}}}
     425
     426== Report Slice Expiration to Experimenters ==
     427
     428=== Description ===
     429MyPLC comes with a script that will notify users of expiring slices via email, but this script is not running by default.  The script is located on MyPLC machines under `/etc/support-scripts/renew_reminder.py`.  On GPO MyPLC machines, we use a cron job to run this script once a day.  This script has a companion `renew_reminder_logrotate` configuration which you may want to add to `/etc/logrotate.d`.
     430
     431=== Variables ===
     432|| '''Variable''' || '''GPO Values''' || '''Description''' || '''Important Notes''' ||
     433|| <expires> || 4 || When to start notifying slice owners in terms of number of days before the slice expires ||  ||
     434
     435=== Reference ===
     436For reference, below are the commands we use for this.
     437{{{
     438python /etc/support-scripts/renew_reminder.py --expires <expires>
     439}}}
     440
     441== Setup Fast Sliver Creation ==
     442
     443=== Description ===
     444For each node, newly requested slivers slivers are created within roughly 15 minutes by default.  You can shorten this time significantly by modifying the options passed into the node manager daemon by putitng options in `/etc/sysconfig/nm` on each node.
     445
     446=== Variables ===
     447|| '''Variable''' || '''GPO Values''' || '''Description''' || '''Important Notes''' ||
     448|| <period> || 30 || The base value of the frequency at which node manager runs (in seconds) ||  ||
     449|| <random> || 15 || Upper bound to randomly generated splay range (in seconds) ||  ||
     450
     451=== Reference ===
     452For reference, below is the contents of our `/etc/sysconfig/nm`:
     453{{{
     454OPTIONS="-p <period> -r <random> -d"
     455}}}
     456
     457Increasing the frequency at which node manager creates new slices will result in the MyPLC httpd ssl logs on the increasing in size at a much faster rate.  Make sure to administer log rotation accordingly.
     458
     459For reference, below is the GPO lab httpd logrotate configuration for MyPLC machines:
     460{{{
     461/var/log/httpd/*log {
     462    compresscmd /usr/bin/bzip2
     463    compressext .bz2
     464    compress
     465    daily
     466    rotate 35
     467    missingok
     468    notifempty
     469    sharedscripts
     470    postrotate
     471        /bin/kill -HUP `cat /var/run/httpd.pid 2>/dev/null` 2> /dev/null || true
     472    endscript
     473}
     474}}}