Skip to content
This repository has been archived by the owner on Sep 23, 2020. It is now read-only.

Commit

Permalink
Config options for enabling web or services
Browse files Browse the repository at this point in the history
  • Loading branch information
labisso committed Apr 12, 2010
1 parent 7ae3b08 commit 10030d4
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 35 deletions.
9 changes: 0 additions & 9 deletions home/bin/nimbus-configure
Expand Up @@ -41,12 +41,3 @@ if [ $EXITCODE -ne 42 ]; then
exit 2
fi
fi


#TODO this functionality should be moved into nimbusconfigure.py
$NIMBUS_WEBDIR/sbin/new-conf.sh
if [ $? -ne 0 ]; then
echo ""
echo "Nimbus web is not set up properly, exiting."
exit 2
fi
7 changes: 7 additions & 0 deletions home/sbin/nimbusconfigure.py
Expand Up @@ -29,6 +29,9 @@
keystore: var/keystore.jks
keystore.pass: changeit
services.enabled: True
web.enabled: False
"""
CONFIG_STATE_PATH = 'nimbus-setup.conf'

Expand Down Expand Up @@ -378,6 +381,10 @@ def perform_setup(self):
gtcontainer.adjust_broker_config(ca_cert, ca_key, self.webdir,
self.gtdir, log)

# run the web newconf script, if enabled
if self.config.getboolean(CONFIGSECTION, 'web.enabled'):
ret = os.system(os.path.join(self.webdir, 'sbin/new-conf.sh'))

def print_gridftpenv(setup, gridftp_globus_path):
lines = get_gridftpenv_sample(setup, gridftp_globus_path)

Expand Down
71 changes: 46 additions & 25 deletions home/sbin/nimbusctl.py
Expand Up @@ -5,6 +5,7 @@

import ProcessManager
from ProcessManager import Process
import ConfigParser

USAGE_TEXT = """\
Expand All @@ -19,6 +20,7 @@
%(commands)s\
"""


NIMBUS_HOME = os.getenv("NIMBUS_HOME")

if not NIMBUS_HOME:
Expand All @@ -27,40 +29,59 @@
if not os.path.isdir(NIMBUS_HOME):
sys.exit("$NIMBUS_HOME does not exist: "+ NIMBUS_HOME)


CONFIG_PATH = os.path.join(NIMBUS_HOME, 'nimbus-setup.conf')
_NO_CONFIG_ERROR = """
Could not find the Nimbus setup config file:
%s
This file is created after successful completion of the nimbus-configure
program. You should try running nimbus-configure before using this program.
""" % CONFIG_PATH
config = ConfigParser.SafeConfigParser()
if not config.read(CONFIG_PATH):
sys.exit(_NO_CONFIG_ERROR)
web_enabled = config.getboolean('nimbussetup', 'web.enabled')
services_enabled = config.getboolean('nimbussetup', 'services.enabled')

if not (web_enabled or services_enabled):
sys.exit("Neither Nimbus services nor Nimbus web are enabled. "+
"See the '%s' config file to adjust this setting." % CONFIG_PATH)

NIMBUS_RUN_DIR = os.path.join(NIMBUS_HOME, 'var/run/')
if not os.path.isdir(NIMBUS_RUN_DIR):
try:
os.mkdir(NIMBUS_RUN_DIR)
except:
sys.exit("Failed to create run directory: %s" % NIMBUS_RUN_DIR)

NIMBUS_SERVICES_EXE = os.path.join(NIMBUS_HOME, 'sbin/run-services.sh')
if not os.path.exists(NIMBUS_SERVICES_EXE):
sys.exit("The services executable does not exist: " + NIMBUS_SERVICES_EXE)

NIMBUS_WEB_EXE = os.path.join(NIMBUS_HOME, 'sbin/run-web.sh')
if not os.path.exists(NIMBUS_WEB_EXE):
sys.exit("The web executable does not exist: " + NIMBUS_WEB_EXE)

ProcessManager.init(dataDir = NIMBUS_RUN_DIR)

ProcessManager.add( Process(
name = "services",
desc = "Nimbus IaaS Services",
program = NIMBUS_SERVICES_EXE,
args = [],
workingDir = NIMBUS_HOME,
postStartDelay=5
))

ProcessManager.add( Process(
name = "web",
desc = "Nimbus Web Application",
program = NIMBUS_WEB_EXE,
args = [],
workingDir = NIMBUS_HOME,
postStartDelay=3
))
if services_enabled:
NIMBUS_SERVICES_EXE = os.path.join(NIMBUS_HOME, 'sbin/run-services.sh')
if not os.path.exists(NIMBUS_SERVICES_EXE):
sys.exit("The services executable does not exist: " +
NIMBUS_SERVICES_EXE)
ProcessManager.add( Process(
name = "services",
desc = "Nimbus IaaS Services",
program = NIMBUS_SERVICES_EXE,
args = [],
workingDir = NIMBUS_HOME,
postStartDelay=5
))

if web_enabled:
NIMBUS_WEB_EXE = os.path.join(NIMBUS_HOME, 'sbin/run-web.sh')
if not os.path.exists(NIMBUS_WEB_EXE):
sys.exit("The web executable does not exist: " + NIMBUS_WEB_EXE)
ProcessManager.add( Process(
name = "web",
desc = "Nimbus Web Application",
program = NIMBUS_WEB_EXE,
args = [],
workingDir = NIMBUS_HOME,
postStartDelay=3
))

argv = sys.argv
if len(argv) == 2:
Expand Down
3 changes: 2 additions & 1 deletion home/sbin/run-services.sh
Expand Up @@ -10,5 +10,6 @@ X509_CERT_DIR="$NIMBUS_HOME/var/ca/trusted-certs"
export X509_CERT_DIR

LOGFILE="$NIMBUS_HOME/var/services.log"
PORT="8443"

exec $NIMBUS_HOME/services/bin/globus-start-container > $LOGFILE 2>&1
exec $NIMBUS_HOME/services/bin/globus-start-container -p $PORT > $LOGFILE 2>&1

0 comments on commit 10030d4

Please sign in to comment.