Skip to content
This repository
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

executable file 118 lines (93 sloc) 4.342 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117
#!/bin/bash

OWNER_IS_RUNNER_ASSUMPTION="yes"

PYTHON_EXE="/usr/bin/env python -Wignore::DeprecationWarning"

NIMBUS_WEBDIR_REL="`dirname $0`/.."
NIMBUS_WEBDIR=`cd $NIMBUS_WEBDIR_REL; pwd`

NIMBUS_WEBCONF="$NIMBUS_WEBDIR/nimbusweb.conf"
if [ ! -f "$NIMBUS_WEBCONF" ]; then
echo "Cannot find conf file, exiting. (expected at '$NIMBUS_WEBCONF')"
    exit 1
fi

NIMBUS_CONFIGURED="$NIMBUS_WEBDIR/.nimbusconfigured"
if [ ! -f "$NIMBUS_CONFIGURED" ]; then
echo "It looks like you have not configured the webapp with nimbus-configure."
    echo "Set 'web.enabled' to true and re-run nimbus-configure with no arguments."
    exit 1
fi

NIMBUS_PYLIB="$NIMBUS_WEBDIR/lib/python"
NIMBUS_PYSRC="$NIMBUS_WEBDIR/src/python"

PYTHONPATH="$NIMBUS_PYSRC:$NIMBUS_PYLIB:$PYTHONPATH"
export PYTHONPATH

# ------------------------------------------------------------------------------

if [ "X$OWNER_IS_RUNNER_ASSUMPTION" = "Xyes" ]; then
    # The following script expands the tarballs in lib/
    $NIMBUS_WEBDIR/sbin/install-deps.sh $DEBUG
    if [ $? -ne 0 ]; then
echo "Dependencies are not set up properly, exiting."
        exit 3
    fi
fi

$PYTHON_EXE $NIMBUS_PYSRC/nimbusweb/setup/setup.py --checkssl --conf $NIMBUS_WEBCONF --basedir $NIMBUS_WEBDIR
if [ $? -ne 0 ]; then
echo ""
    echo "SSL is not set up properly, exiting."
    exit 2
fi

if [ "X$OWNER_IS_RUNNER_ASSUMPTION" == "Xyes" ]; then
    
    # This script will make sure the configurations in the webapp directory
    # and cherrypy are correct before launch. The configurations in the
    # 'settings.py' file are the 'actual' configurations when the webapp runs
    # (it can run outside this standalone framework for example).
    
    $NIMBUS_WEBDIR/sbin/new-conf.sh $DEBUG
    if [ $? -ne 0 ]; then
echo ""
        echo "Problem configuring webapp, exiting."
        exit 4
    fi
fi

# ------------------------------------------------------------------------------

PORT=`$PYTHON_EXE $NIMBUS_PYSRC/nimbusweb/setup/setup.py --printport --conf $NIMBUS_WEBCONF --basedir $NIMBUS_WEBDIR`
if [ $? -ne 0 ]; then
exit 5
fi
HOST=`$PYTHON_EXE $NIMBUS_PYSRC/nimbusweb/setup/setup.py --printhost --conf $NIMBUS_WEBCONF --basedir $NIMBUS_WEBDIR`
if [ $? -ne 0 ]; then
exit 5
fi
CERTPATH=`$PYTHON_EXE $NIMBUS_PYSRC/nimbusweb/setup/setup.py --printcertpath --conf $NIMBUS_WEBCONF --basedir $NIMBUS_WEBDIR`
if [ $? -ne 0 ]; then
exit 5
fi
KEYPATH=`$PYTHON_EXE $NIMBUS_PYSRC/nimbusweb/setup/setup.py --printkeypath --conf $NIMBUS_WEBCONF --basedir $NIMBUS_WEBDIR`
if [ $? -ne 0 ]; then
exit 5
fi

echo -e "\n*****************************************************************"
echo -e "*****************************************************************\n"

echo "Point your browser to: https://localhost:$PORT/nimbus/"
echo -e "\nAccept the \"certificate from an unknown authority\""
echo -e "\nUse CTRL-C to stop the server (you can get it to daemonize later)"

echo -e "\n*****************************************************************"
echo -e "*****************************************************************\n"

exec $PYTHON_EXE $NIMBUS_PYSRC/nimbusweb/portal/manage.py runcpserver "host=$HOST" "port=$PORT" "workdir=$NIMBUS_PYSRC/nimbusweb/portal/" "ssl_certificate=$CERTPATH" "ssl_private_key=$KEYPATH"


# Available options:

#
# Optional CherryPy server settings: (setting=value)
# host=HOSTNAME hostname to listen on
# Defaults to localhost
# port=PORTNUM port to listen on
# Defaults to 8088
# server_name=STRING CherryPy's SERVER_NAME environ entry
# Defaults to localhost
# daemonize=BOOL whether to detach from terminal
# Defaults to False
# pidfile=FILE write the spawned process-id to this file
# workdir=DIRECTORY change to this directory when daemonizing
# threads=NUMBER Number of threads for server to use
# ssl_certificate=FILE SSL certificate file
# ssl_private_key=FILE SSL private key file
# server_user=STRING user to run daemonized process
# Defaults to www-data
# server_group=STRING group to daemonized process
# Defaults to www-data
# request_queue_size=INT Size of connections queue


Something went wrong with that request. Please try again.