From ef7a909a625a7f643c5fc78afac5c6150a265252 Mon Sep 17 00:00:00 2001 From: Planet-Lab Support Date: Tue, 18 Jul 2006 22:41:46 +0000 Subject: [PATCH] This commit was manufactured by cvs2svn to create branch 'myplc-0_4-branch'. --- build.functions | 151 ++++++++ build_devel.sh | 76 ++++ doc/.cvsignore | 1 + doc/plc_devel_variables.xml | 58 +++ doc/plc_variables.xml | 709 ++++++++++++++++++++++++++++++++++++ plc-devel.sysconfig | 3 + plc.sysconfig | 3 + plc_devel_config.xml | 153 ++++++++ 8 files changed, 1154 insertions(+) create mode 100644 build.functions create mode 100755 build_devel.sh create mode 100644 doc/.cvsignore create mode 100644 doc/plc_devel_variables.xml create mode 100644 doc/plc_variables.xml create mode 100644 plc-devel.sysconfig create mode 100644 plc.sysconfig create mode 100644 plc_devel_config.xml diff --git a/build.functions b/build.functions new file mode 100644 index 0000000..8281801 --- /dev/null +++ b/build.functions @@ -0,0 +1,151 @@ +# -*-Shell-script-*- +# +# Common functions for MyPLC build scripts (build_devel.sh and +# build.sh) +# +# Mark Huang +# Copyright (C) 2006 The Trustees of Princeton University +# +# $Id: functions,v 1.6 2006/07/10 21:05:37 mlhuang Exp $ +# + +PATH=/sbin:/bin:/usr/sbin:/usr/bin + +# In both a normal CVS environment and a PlanetLab RPM +# build environment, all of our dependencies are checked out into +# directories at the same level as us. +if [ -d ../build ] ; then + PATH=$PATH:../build + srcdir=.. +else + echo "Error: Could not find $(cd .. && pwd -P)/build/" + exit 1 +fi + +export PATH + +# Release and architecture to install +PLC_DEVEL_FEDORA_RELEASE=4 +PLC_DEVEL_FEDORA_ARCH=i386 + +# Fedora Core mirror from which to install filesystems +PLC_DEVEL_FEDORA_URL=file:///usr/share/mirrors/fedora + +# Build myplc inside myplc-devel +PLC_DEVEL_BOOTSTRAP=true + +# We may be running inside a myplc-devel environment, which can +# override these defaults. Specifically, whether to build myplc inside +# myplc-devel (PLC_DEVEL_BOOTSTRAP). +if [ -f /etc/planetlab/plc_config ] ; then + . /etc/planetlab/plc_config +fi + +usage() +{ + echo "Usage: build.sh [OPTION]..." + echo " -l url Fedora mirror location (default: $PLC_DEVEL_FEDORA_URL)" + echo " -r release Fedora release number (default: $PLC_DEVEL_FEDORA_RELEASE)" + echo " -a arch Fedora architecture (default: $PLC_DEVEL_FEDORA_ARCH)" + echo " -h This message" + exit 1 +} + +# Get options +while getopts "l:r:a:h" opt ; do + case $opt in + l) + PLC_DEVEL_FEDORA_URL=$OPTARG + ;; + r) + PLC_DEVEL_FEDORA_RELEASE=$OPTARG + ;; + a) + PLC_DEVEL_FEDORA_ARCH=$OPTARG + ;; + h|*) + usage + ;; + esac +done + +# Do not tolerate errors +set -e + +# Be verbose +set -x + +# Make a basic chroot at the specified location given the specified +# configuration. +make_chroot() { + root=$1 + config=$2 + + # Get group list + groups= + while read group ; do + groups="$groups -g \"$group\"" + done < <(./plc-config --groups $config) + + # Get package list + packages= + while read package ; do + packages="$packages -p \"$package\"" + done < <(./plc-config --packages $config) + + # Install base system + eval mkfedora -v -l $PLC_DEVEL_FEDORA_URL -r $PLC_DEVEL_FEDORA_RELEASE -a $PLC_DEVEL_FEDORA_ARCH $packages $groups $root + + # Disable all services in reference image + chroot $root sh -c "/sbin/chkconfig --list | awk '{ print \$1 }' | xargs -i /sbin/chkconfig {} off" + + # FC2 minilogd starts up during shutdown and makes unmounting + # impossible. Just get rid of it. + rm -f $root/sbin/minilogd + ln -nsf /bin/true $root/sbin/minilogd +} + +# Move specified directories out of the chroot and into a "data" +# directory that will be bind mounted on /data inside the chroot. +move_datadirs() { + root=$1 + data=$2 + shift 2 + + mkdir -p $root/data + for datadir in "$@" ; do + mkdir -p ${data}$datadir + if [ -d $root/$datadir -a ! -h $root/$datadir ] ; then + (cd $root && find ./$datadir | cpio -p -d -u ../$data/) + fi + rm -rf $root/$datadir + mkdir -p $(dirname $root/$datadir) + ln -nsf /data$datadir $root/$datadir + done +} + +# Make loopback filesystem from specified location +make_image() { + root=$1 + image=$2 + + # Leave about 100 MB free space and allow for about 20% inode overhead + bytes=$((($(du -sb $root | cut -f1) + 100000000) * 120 / 100)) + bs=4096 + blocks=$(($bytes / $bs)) + dd bs=$bs count=$blocks if=/dev/zero of=$image + mkfs.ext3 -b $bs -j -F $image + + # Temporarily mount it + tmp=$(mktemp -d tmp.XXXXXX) + mount -o loop $image $tmp + trap "umount $tmp; rmdir $tmp" ERR INT + + # Move files to it + (cd $root && tar cpf - .) | (cd $tmp && tar xpf -) + + # Unmount it + umount $tmp + rmdir $tmp + trap - ERR INT +} diff --git a/build_devel.sh b/build_devel.sh new file mode 100755 index 0000000..77893b3 --- /dev/null +++ b/build_devel.sh @@ -0,0 +1,76 @@ +#!/bin/bash +# +# Build a complete MyPLC development environment. Requires PlanetLab +# source code to be exported into directories at the same level as we +# are (i.e., ..). +# +# devel/root.img (loopback image) +# devel/root/ (mount point) +# devel/data/ (various data files) +# devel/data/cvs/ (local CVS repository) +# devel/data/build/ (build area) +# devel/data/etc/planetlab/ (configuration) +# +# Mark Huang +# Copyright (C) 2006 The Trustees of Princeton University +# +# $Id$ +# + +. build.functions + +echo "* myplc-devel: Installing base filesystem" +mkdir -p devel/root +make_chroot devel/root plc_devel_config.xml + +# Import everything (including ourself) into a private CVS tree +echo "* myplc-devel: Building CVS repository" +cvsroot=$PWD/devel/data/cvs +mkdir -p $cvsroot +cvs -d $cvsroot init + +myplc=$(basename $PWD) +pushd .. +for dir in * ; do + if [ ! -d $cvsroot/$dir ] ; then + pushd $dir + if [ "$dir" = "$myplc" ] ; then + # Ignore generated files + ignore="-I ! -I devel -I root -I root.img -I data" + else + ignore="-I !" + fi + date=$(date +%Y-%m-%d) + cvs -d $cvsroot import -m "Initial import" -ko $ignore $dir planetlab planetlab-$date + popd + fi +done +popd + +# Install configuration file +echo "* myplc-devel: Installing configuration file" +install -D -m 444 plc_devel_config.xml devel/data/etc/planetlab/default_config.xml +install -D -m 444 plc_config.dtd devel/data/etc/planetlab/plc_config.dtd + +# Install configuration scripts +echo "* myplc-devel: Installing configuration scripts" +install -D -m 755 plc_config.py devel/root/tmp/plc_config.py +chroot devel/root sh -c 'cd /tmp; python plc_config.py build; python plc_config.py install' +install -D -m 755 plc-config devel/root/usr/bin/plc-config + +# Install initscripts +echo "* myplc-devel: Installing initscripts" +find plc.d/functions | cpio -p -d -u devel/root/etc/ +install -D -m 755 guest.init devel/root/etc/init.d/plc +chroot devel/root sh -c 'chkconfig --add plc; chkconfig plc on' + +# Move "data" directories out of the installation +echo "* myplc-devel: Moving data directories out of the installation" +move_datadirs devel/root devel/data \ + /etc/planetlab /build /cvs + +# Make image out of directory +echo "* myplc-devel: Building loopback image" +make_image devel/root devel/root.img + +exit 0 diff --git a/doc/.cvsignore b/doc/.cvsignore new file mode 100644 index 0000000..cdb1378 --- /dev/null +++ b/doc/.cvsignore @@ -0,0 +1 @@ +*.xml.valid diff --git a/doc/plc_devel_variables.xml b/doc/plc_devel_variables.xml new file mode 100644 index 0000000..263aa3c --- /dev/null +++ b/doc/plc_devel_variables.xml @@ -0,0 +1,58 @@ + + + PLC_DEVEL_FEDORA_RELEASE + + + Type: string + + Default: 4 + Version number of Fedora Core upon which to + base the build environment. Warning: Currently, only Fedora + Core 4 is supported. + + + + PLC_DEVEL_FEDORA_ARCH + + + Type: string + + Default: i386 + Base architecture of the build + environment. Warning: Currently, only i386 is + supported. + + + + PLC_DEVEL_FEDORA_URL + + + Type: string + + Default: file:///usr/share/mirrors/fedora + Fedora Core mirror from which to install + filesystems. + + + + PLC_DEVEL_CVSROOT + + + Type: string + + Default: /cvs + CVSROOT to use when checking out code. + + + + PLC_DEVEL_BOOTSTRAP + + + Type: boolean + + Default: false + Controls whether MyPLC should be built inside + of its own development environment. + + + diff --git a/doc/plc_variables.xml b/doc/plc_variables.xml new file mode 100644 index 0000000..e0d7806 --- /dev/null +++ b/doc/plc_variables.xml @@ -0,0 +1,709 @@ + + + PLC_NAME + + + Type: string + + Default: PlanetLab Test + The name of this PLC installation. It is used in + the name of the default system site (e.g., PlanetLab Central) + and in the names of various administrative entities (e.g., + PlanetLab Support). + + + + PLC_SLICE_PREFIX + + + Type: string + + Default: pl + The abbreviated name of this PLC + installation. It is used as the prefix for system slices + (e.g., pl_conf). Warning: Currently, this variable should + not be changed. + + + + PLC_ROOT_USER + + + Type: email + + Default: root@localhost.localdomain + The name of the initial administrative + account. We recommend that this account be used only to create + additional accounts associated with real + administrators, then disabled. + + + + PLC_ROOT_PASSWORD + + + Type: password + + Default: root + The password of the initial administrative + account. Also the password of the root account on the Boot + CD. + + + + PLC_ROOT_SSH_KEY_PUB + + + Type: file + + Default: /etc/planetlab/root_ssh_key.pub + The SSH public key used to access the root + account on your nodes. + + + + PLC_ROOT_SSH_KEY + + + Type: file + + Default: /etc/planetlab/root_ssh_key.rsa + The SSH private key used to access the root + account on your nodes. + + + + PLC_DEBUG_SSH_KEY_PUB + + + Type: file + + Default: /etc/planetlab/debug_ssh_key.pub + The SSH public key used to access the root + account on your nodes when they are in Debug mode. + + + + PLC_DEBUG_SSH_KEY + + + Type: file + + Default: /etc/planetlab/debug_ssh_key.rsa + The SSH private key used to access the root + account on your nodes when they are in Debug mode. + + + + PLC_ROOT_GPG_KEY_PUB + + + Type: file + + Default: /etc/planetlab/pubring.gpg + The GPG public keyring used to sign the Boot + Manager and all node packages. + + + + PLC_ROOT_GPG_KEY + + + Type: file + + Default: /etc/planetlab/secring.gpg + The SSH private key used to access the root + account on your nodes. + + + + PLC_MA_SA_NAMESPACE + + + Type: ip + + Default: test + The namespace of your MA/SA. This should be a + globally unique value assigned by PlanetLab + Central. + + + + PLC_MA_SA_SSL_KEY + + + Type: file + + Default: /etc/planetlab/ma_sa_ssl.key + The SSL private key used for signing documents + with the signature of your MA/SA. If non-existent, one will + be generated. + + + + PLC_MA_SA_SSL_CRT + + + Type: file + + Default: /etc/planetlab/ma_sa_ssl.crt + The corresponding SSL public certificate. By + default, this certificate is self-signed. You may replace + the certificate later with one signed by the PLC root + CA. + + + + PLC_MA_SA_CA_SSL_CRT + + + Type: file + + Default: /etc/planetlab/ma_sa_ca_ssl.crt + If applicable, the certificate of the PLC root + CA. If your MA/SA certificate is self-signed, then this file + is the same as your MA/SA certificate. + + + + PLC_MA_SA_CA_SSL_KEY_PUB + + + Type: file + + Default: /etc/planetlab/ma_sa_ca_ssl.pub + If applicable, the public key of the PLC root + CA. If your MA/SA certificate is self-signed, then this file + is the same as your MA/SA public key. + + + + PLC_MA_SA_API_CRT + + + Type: file + + Default: /etc/planetlab/ma_sa_api.xml + The API Certificate is your MA/SA public key + embedded in a digitally signed XML document. By default, + this document is self-signed. You may replace this + certificate later with one signed by the PLC root + CA. + + + + PLC_NET_DNS1 + + + Type: ip + + Default: 127.0.0.1 + Primary DNS server address. + + + + PLC_NET_DNS2 + + + Type: ip + + Default: + Secondary DNS server address. + + + + PLC_DNS_ENABLED + + + Type: boolean + + Default: true + Enable the internal DNS server. The server does + not provide reverse resolution and is not a production + quality or scalable DNS solution. Use the internal DNS + server only for small deployments or for + testing. + + + + PLC_MAIL_ENABLED + + + Type: boolean + + Default: false + Set to false to suppress all e-mail notifications + and warnings. + + + + PLC_MAIL_SUPPORT_ADDRESS + + + Type: email + + Default: root+support@localhost.localdomain + This address is used for support + requests. Support requests may include traffic complaints, + security incident reporting, web site malfunctions, and + general requests for information. We recommend that the + address be aliased to a ticketing system such as Request + Tracker. + + + + PLC_MAIL_BOOT_ADDRESS + + + Type: email + + Default: root+install-msgs@localhost.localdomain + The API will notify this address when a problem + occurs during node installation or boot. + + + + PLC_MAIL_SLICE_ADDRESS + + + Type: email + + Default: root+SLICE@localhost.localdomain + This address template is used for sending + e-mail notifications to slices. SLICE will be replaced with + the name of the slice. + + + + PLC_DB_ENABLED + + + Type: boolean + + Default: true + Enable the database server on this + machine. + + + + PLC_DB_TYPE + + + Type: string + + Default: postgresql + The type of database server. Currently, only + postgresql is supported. + + + + PLC_DB_HOST + + + Type: hostname + + Default: localhost.localdomain + The fully qualified hostname of the database + server. + + + + PLC_DB_IP + + + Type: ip + + Default: 127.0.0.1 + The IP address of the database server, if not + resolvable by the configured DNS servers. + + + + PLC_DB_PORT + + + Type: int + + Default: 5432 + The TCP port number through which the database + server should be accessed. + + + + PLC_DB_NAME + + + Type: string + + Default: planetlab3 + The name of the database to access. + + + + PLC_DB_USER + + + Type: string + + Default: pgsqluser + The username to use when accessing the + database. + + + + PLC_DB_PASSWORD + + + Type: password + + Default: + The password to use when accessing the + database. If left blank, one will be + generated. + + + + PLC_API_ENABLED + + + Type: boolean + + Default: true + Enable the API server on this + machine. + + + + PLC_API_DEBUG + + + Type: boolean + + Default: false + Enable verbose API debugging. Do not enable on + a production system! + + + + PLC_API_HOST + + + Type: hostname + + Default: localhost.localdomain + The fully qualified hostname of the API + server. + + + + PLC_API_IP + + + Type: ip + + Default: 127.0.0.1 + The IP address of the API server, if not + resolvable by the configured DNS servers. + + + + PLC_API_PORT + + + Type: int + + Default: 80 + The TCP port number through which the API + should be accessed. Warning: SSL (port 443) access is not + fully supported by the website code yet. We recommend that + port 80 be used for now and that the API server either run + on the same machine as the web server, or that they both be + on a secure wired network. + + + + PLC_API_PATH + + + Type: string + + Default: /PLCAPI/ + The base path of the API URL. + + + + PLC_API_MAINTENANCE_USER + + + Type: string + + Default: maint@localhost.localdomain + The username of the maintenance account. This + account is used by local scripts that perform automated + tasks, and cannot be used for normal logins. + + + + PLC_API_MAINTENANCE_PASSWORD + + + Type: password + + Default: + The password of the maintenance account. If + left blank, one will be generated. We recommend that the + password be changed periodically. + + + + PLC_API_MAINTENANCE_SOURCES + + + Type: hostname + + Default: + A space-separated list of IP addresses allowed + to access the API through the maintenance account. The value + of this variable is set automatically to allow only the API, + web, and boot servers, and should not be + changed. + + + + PLC_API_SSL_KEY + + + Type: file + + Default: /etc/planetlab/api_ssl.key + The SSL private key to use for encrypting HTTPS + traffic. If non-existent, one will be + generated. + + + + PLC_API_SSL_CRT + + + Type: file + + Default: /etc/planetlab/api_ssl.crt + The corresponding SSL public certificate. By + default, this certificate is self-signed. You may replace + the certificate later with one signed by a root + CA. + + + + PLC_API_CA_SSL_CRT + + + Type: file + + Default: /etc/planetlab/api_ca_ssl.crt + The certificate of the root CA, if any, that + signed your server certificate. If your server certificate is + self-signed, then this file is the same as your server + certificate. + + + + PLC_WWW_ENABLED + + + Type: boolean + + Default: true + Enable the web server on this + machine. + + + + PLC_WWW_DEBUG + + + Type: boolean + + Default: false + Enable debugging output on web pages. Do not + enable on a production system! + + + + PLC_WWW_HOST + + + Type: hostname + + Default: localhost.localdomain + The fully qualified hostname of the web + server. + + + + PLC_WWW_IP + + + Type: ip + + Default: 127.0.0.1 + The IP address of the web server, if not + resolvable by the configured DNS servers. + + + + PLC_WWW_PORT + + + Type: int + + Default: 80 + The TCP port number through which the + unprotected portions of the web site should be + accessed. + + + + PLC_WWW_SSL_PORT + + + Type: int + + Default: 443 + The TCP port number through which the protected + portions of the web site should be accessed. + + + + PLC_WWW_SSL_KEY + + + Type: file + + Default: /etc/planetlab/www_ssl.key + The SSL private key to use for encrypting HTTPS + traffic. If non-existent, one will be + generated. + + + + PLC_WWW_SSL_CRT + + + Type: file + + Default: /etc/planetlab/www_ssl.crt + The corresponding SSL public certificate for + the HTTP server. By default, this certificate is + self-signed. You may replace the certificate later with one + signed by a root CA. + + + + PLC_WWW_CA_SSL_CRT + + + Type: file + + Default: /etc/planetlab/www_ca_ssl.crt + The certificate of the root CA, if any, that + signed your server certificate. If your server certificate is + self-signed, then this file is the same as your server + certificate. + + + + PLC_BOOT_ENABLED + + + Type: boolean + + Default: true + Enable the boot server on this + machine. + + + + PLC_BOOT_HOST + + + Type: hostname + + Default: localhost.localdomain + The fully qualified hostname of the boot + server. + + + + PLC_BOOT_IP + + + Type: ip + + Default: 127.0.0.1 + The IP address of the boot server, if not + resolvable by the configured DNS servers. + + + + PLC_BOOT_PORT + + + Type: int + + Default: 80 + The TCP port number through which the + unprotected portions of the boot server should be + accessed. + + + + PLC_BOOT_SSL_PORT + + + Type: int + + Default: 443 + The TCP port number through which the protected + portions of the boot server should be + accessed. + + + + PLC_BOOT_SSL_KEY + + + Type: file + + Default: /etc/planetlab/boot_ssl.key + The SSL private key to use for encrypting HTTPS + traffic. + + + + PLC_BOOT_SSL_CRT + + + Type: file + + Default: /etc/planetlab/boot_ssl.crt + The corresponding SSL public certificate for + the HTTP server. By default, this certificate is + self-signed. You may replace the certificate later with one + signed by a root CA. + + + + PLC_BOOT_CA_SSL_CRT + + + Type: file + + Default: /etc/planetlab/boot_ca_ssl.crt + The certificate of the root CA, if any, that + signed your server certificate. If your server certificate is + self-signed, then this file is the same as your server + certificate. + + + diff --git a/plc-devel.sysconfig b/plc-devel.sysconfig new file mode 100644 index 0000000..f195566 --- /dev/null +++ b/plc-devel.sysconfig @@ -0,0 +1,3 @@ +PLC_ROOT=/plc/devel/root +PLC_DATA=/plc/devel/data +#PLC_OPTIONS="-v" diff --git a/plc.sysconfig b/plc.sysconfig new file mode 100644 index 0000000..c2f698f --- /dev/null +++ b/plc.sysconfig @@ -0,0 +1,3 @@ +PLC_ROOT=/plc/root +PLC_DATA=/plc/data +#PLC_OPTIONS="-v" diff --git a/plc_devel_config.xml b/plc_devel_config.xml new file mode 100644 index 0000000..cb9e5b0 --- /dev/null +++ b/plc_devel_config.xml @@ -0,0 +1,153 @@ + + + + + + + + + + Build Environment + These variables control the behavior of the + PlanetLab build environment. + + + + Fedora Core Release Version + 4 + Version number of Fedora Core upon which to + base the build environment. Warning: Currently, only Fedora + Core 4 is supported. + + + + Fedora Core Base Architecture + i386 + Base architecture of the build + environment. Warning: Currently, only i386 is + supported. + + + + Fedora Core Mirror URL + file:///usr/share/mirrors/fedora + Fedora Core mirror from which to install + filesystems. + + + + CVS Root + /cvs + CVSROOT to use when checking out code. + + + + Bootstrap Build + false + Controls whether MyPLC should be built inside + of its own development environment. + + + + + + + + development-libs + Development Libraries + true + The packages in this group are core libraries + needed to develop applications. + true + + + + + + + development-tools + Development Tools + true + These tools include core development tools such as + automake, gcc, perl, python, and debuggers. + true + + + + + + + legacy-software-development + Legacy Software Development + These packages provide compatibility support for + previous releases. + true + + + + + + + plc-build + PlanetLab Build Tools + Additional tools required to build PlanetLab + software. + + + kernel-vserver + + + gnupg + diffutils + + + vconfig + iptables + wget + beecrypt-devel + tetex-latex + gcc-c++ + + + libpcap + + + linuxdoc-tools + + + sudo + yum + createrepo + + + gperf + time + + + sharutils + + + nasm + mkisofs + dosfstools + + + rsync + + + + + + -- 2.47.0