commit afd35d9cec675d269b03c002a2a5187d3b9302c6 Author: stephen soltesz stephen.soltesz@gmail.com Date: Thu Jun 6 14:29:26 2013 +0000
Delete M-Lab specific init/* dir.
See instead: https://github.com/m-lab-tools/ooni-support/init --- scripts/init/initialize.sh | 88 ------------------------------------ scripts/init/prepare.sh | 108 -------------------------------------------- scripts/init/start.sh | 5 -- scripts/init/stop.sh | 4 -- 4 files changed, 205 deletions(-)
diff --git a/scripts/init/initialize.sh b/scripts/init/initialize.sh deleted file mode 100755 index 3196f16..0000000 --- a/scripts/init/initialize.sh +++ /dev/null @@ -1,88 +0,0 @@ -#!/bin/bash - -# 1. Fetch any dependencies -# we should have everything in the virtualenv? Or do we need to also get some -# system libraries? libyaml, anyone? -# XXX: Can we get a newer version of libyaml from a fc-xx repo? -# -# we'll need libyaml.h from the system's libraries, afaik. i don't know what -# the fc* repos have though. --isis -source /etc/mlab/slice-functions - -# 2. Generate a ssl certificate -SCRIPT_ROOT=`pwd` -cd $SCRIPT_ROOT - -#XXX: we should think about setting these fields more carefully -OPENSSL_SUBJECT="/C=US/ST=CA/CN="`hostname` -OPENSSL_PASS=file:$SCRIPT_ROOT/cert.pass -dd if=/dev/random of=$SCRIPT_ROOT/cert.pass bs=32 count=1 -openssl genrsa -des3 -passout $OPENSSL_PASS -out private.key 4096 -openssl req -new -passin $OPENSSL_PASS -key private.key -out server.csr -subj $OPENSSL_SUBJECT -cp private.key private.key.org - -# Remove passphrase from key -openssl rsa -passin file:$SCRIPT_ROOT/cert.pass -in private.key.org -out private.key -chmod 600 private.key -openssl x509 -req -days 365 -in server.csr -signkey private.key -out certificate.crt -rm private.key.org -rm cert.pass - -# get the UID and GID to drop privileges to -OONIB_UID=`id -u $SLICENAME` -OONIB_GID=`id -g $SLICENAME` - -# randomly select either a tcp backend helper or a http backend helper to listen on port 80. Otherwise, bind to port 81 -coin=$[$RANDOM % 2] -if [[ $coin > 0 ]]; then - TCP_ECHO_PORT=80 - HTTP_ECHO_PORT=81 -else - TCP_ECHO_PORT=81 - HTTP_ECHO_PORT=80 -fi - -# drop a config in $SCRIPT_ROOT -echo " -main: - report_dir: '/var/spool/$SLICENAME' - tor_datadir: - database_uri: 'sqlite://"$SCRIPT_ROOT"/oonib_test_db.db' - db_threadpool_size: 10 - tor_binary: '"$SCRIPT_ROOT"/bin/tor' - tor2webmode: true - pidfile: 'oonib.pid' - nodaemon: false - originalname: Null - chroot: Null - rundir: . - umask: Null - euid: Null - uid: $OONIB_UID - gid: $OONIB_GID - uuid: Null - no_save: true - profile: Null - debug: Null - -helpers: - http_return_request: - port: $HTTP_ECHO_PORT - server_version: Apache - - tcp_echo: - port: $TCP_ECHO_PORT - - daphn3: - yaml_file: Null - pcap_file: Null - port: 57003 - - dns: - udp_port: 57004 - tcp_port: 57005 - - ssl: - private_key: '"$SCRIPT_ROOT"/private.key' - certificate: '"$SCRIPT_ROOT"/certificate.crt' - port: 443" > $SCRIPT_ROOT/oonib.conf diff --git a/scripts/init/prepare.sh b/scripts/init/prepare.sh deleted file mode 100755 index f61de4d..0000000 --- a/scripts/init/prepare.sh +++ /dev/null @@ -1,108 +0,0 @@ -#!/bin/sh - -# Warning -# We advise installing virtualenv-1.9 or greater. Prior to version 1.9, the pip -# included in virtualenv did not not download from PyPI over SSL. -# Solution, use virtualenv-1.9 -# XXX: where is a signed release for any of virtualenv? - -# XXX -# Retrieved from http://www.virtualenv.org/en/1.9.X/news.html Mar 6 2013 -# Warning -# Python bugfix releases 2.6.8, 2.7.3, 3.1.5 and 3.2.3 include a change that will -# cause “import random” to fail with “cannot import name urandom” on any -# virtualenv created on a Unix host with an earlier release of Python -# 2.6/2.7/3.1/3.2, if the underlying system Python is upgraded. This is due to -# the fact that a virtualenv uses the system Python’s standard library but -# contains its own copy of the Python interpreter, so an upgrade to the system -# Python results in a mismatch between the version of the Python interpreter and -# the version of the standard library. It can be fixed by removing -# $ENV/bin/python and re-running virtualenv on the same target directory with the -# upgraded Python. - -# In the wild: -# http://stackoverflow.com/questions/10366821/python-importerror-cannot-import... - -# Solution: Redeploy oonib after upgrading python 2.6.6 to 2.6.8 - -OONIB_GIT_REPO=ooni-backend -OONIB_GIT_URL="https://github.com/TheTorProject/$OONIB_GIT_REPO.git" -OONIB_GIT_TAG=master -#OONIB_GIT_REPO=oonib -#OONIB_GIT_URL="https://github.com/TheTorProject/$OONIB_GIT_REPO.git" -#OONIB_GIT_TAG=0.0.10 - -VIRTUALENV_GIT_REPO=virtualenv -VIRTUALENV_GIT_URL="https://github.com/pypa/$VIRTUALENV_GIT_REPO.git" -VIRTUALENV_GIT_TAG=1.9rc2 - -echo Installing build tools -sudo yum groupinstall -y Development\ Tools - -echo Installing openssl-devel -sudo yum install -y openssl-devel - -echo Installing glibc-static -sudo yum install -y glibc-static - -echo Installing python-devel -sudo yum install -y python-devel - -SLICE_NAME=mlab_ooni -# Run relative to where the script was called -SCRIPT_ROOT=`pwd` -# Run relative to our slice path -#SCRIPT_ROOT=/home/$SLICE_NAME -DEPLOY_PATH=$SCRIPT_ROOT/oonib-deploy.`date +%s`.tar.gz - -echo Downloading $OONIB_GIT_REPO $OONIB_GIT_TAG -OONIB_PATH=$SCRIPT_ROOT/$OONIB_GIT_REPO -# does the repository already exist? If not, fetch it -if [ ! -e $OONIB_PATH ] ; then - echo Fetching the $OONIB_GIT_REPO repository - git clone $OONIB_GIT_URL $OONIB_PATH -fi -cd $OONIB_PATH -git fetch origin -git checkout $OONIB_GIT_TAG -#XXX: git-verify-tag $OONIB_GIT_TAG - -# Get a copy of virtualenv -echo Downloading $VIRTUALENV_GIT_REPO $VIRTUALENV_GIT_TAG -VIRTUALENV_PATH=$SCRIPT_ROOT/$VIRTUALENV_GIT_REPO -if [ ! -e $VIRTUALENV_PATH ] ; then - git clone $VIRTUALENV_GIT_URL $VIRTUALENV_PATH -fi -cd $VIRTUALENV_PATH -git fetch origin -git checkout $VIRTUALENV_GIT_TAG -#XXX: git verify-tag $VIRTUALENV_GIT_TAG - -# See warning. Remove python and redeploy virtualenv with current python -PYTHON_EXE=$SCRIPT_ROOT/bin/python -if [ -e $PYTHON_EXE ] ; then - rm $PYTHON_EXE -fi -python $VIRTUALENV_PATH/virtualenv.py --no-site-packages $SCRIPT_ROOT -if [ ! -e $PYTHON_EXE ] ; then - exit 1 -fi - -# run setup.py and fetch dependencies -cd $OONIB_PATH -$PYTHON_EXE setup.py install - -# build a static tor -mkdir -p $SCRIPT_ROOT/ -cd $SCRIPT_ROOT -$OONIB_PATH/scripts/build_tor2web_tor.sh - -# add to bin -if [ -e $SCRIPT_ROOT/tor ]; then - cp $SCRIPT_ROOT/tor $SCRIPT_ROOT/bin/ -fi - -# drop the init scripts into $SCRIPT_ROOT -cp -r $OONIB_GIT_REPO/scripts/init $SCRIPT_ROOT -# or just tar up the entire cwd and call it done, son. -tar -C $SCRIPT_ROOT -czf $DEPLOY_PATH bin lib init $OONIB_GIT_REPO diff --git a/scripts/init/start.sh b/scripts/init/start.sh deleted file mode 100755 index d4ec504..0000000 --- a/scripts/init/start.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/sh - -source /etc/mlab/slice-functions -cd $SLICEHOME -sudo -u $SLICENAME bin/oonib -c $SLICEHOME/oonib.conf & diff --git a/scripts/init/stop.sh b/scripts/init/stop.sh deleted file mode 100755 index af58da9..0000000 --- a/scripts/init/stop.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/sh -source /etc/mlab/slice-functions -cd $SLICEHOME -sudo -u $SLICENAME kill `cat $SLICEHOME/oonib.pid`
tor-commits@lists.torproject.org