def install_sysv_init_script(nsd, nuser, cfgfile): """ Install the init script for an operational deployment of RASVAMT. The init script is an old System V init system. In the presence of a systemd-enabled system we use the update-rc.d tool to enable the script as part of systemd (instead of the System V chkconfig tool which we use instead). The script is prepared to deal with both tools. """ with settings(user=env.AWS_SUDO_USER): print(red("Initialising deployment")) sudo('usermod -a -G {} ec2-user'.format(env.APP_USER)) sudo('mkdir -p /etc/supervisor/') sudo('mkdir -p /etc/supervisor/conf.d/') sudo('cp {0}/fabfile/init/sysv/nginx.conf /etc/nginx/.'. format(APP_source_dir())) # copy nginx and supervisor conf files sudo('cp {0}/fabfile/init/sysv/rasvama.conf /etc/supervisor/conf.d/.'. format(APP_source_dir())) # create the DB with settings(user=env.APP_USER): virtualenv('cd {0}/db; python create_db.py'.format(env.APP_SRC_DIR)) #check if nginx is running else print(red("Server setup and ready to deploy")) #Think we have success("Init scripts installed")
def start_APP_and_check_status(): """ Starts the APP daemon process and checks that the server is up and running then it shuts down the server """ virtualenv('dlg --help') success('dlg help is working...')
def build_APP(): """ Builds and installs APP into the target virtualenv. """ with cd(APP_source_dir()): extra_pkgs = extra_python_packages() if extra_pkgs: virtualenv('pip install %s' % ' '.join(extra_pkgs)) develop = False no_doc_dependencies = APP_doc_dependencies() build_cmd = APP_build_cmd() print(build_cmd) if build_cmd != '': virtualenv(build_cmd) success("{0} built and installed".format(env.APP_NAME))
def start_APP_and_check_status(): """ Starts the APP daemon process and checks that the server is up and running then it shuts down the server """ with cd('{0}/pyvospace/server/deploy'.format(APP_source_dir())): # >>>> Darwin docker shows a permission issue with keychain access <<<< if get_linux_flavor() != 'Darwin': virtualenv('docker-compose build') else: info('>>>> Darwin reuqires to build docker container manually') info('>>>> docker-compose build') virtualenv( 'docker run -d -p 5435:5432 pyvospace/pyvospace-db -h 0.0.0.0') time.sleep(10) with cd('{0}'.format(APP_source_dir())): virtualenv('python -m unittest discover test') # run('mkdir -p /tmp/fuse') # virtualenv('posix_space --cfg test_vo.ini > /tmp/space.log 2>&1') # time.sleep(2) # virtualenv('posix_storage --cfg test_vo.ini > /tmp/storage.log 2>&1') # time.sleep(2) # virtualenv('python -m pyvospace.client.fuse --host localhost --port 8080 --username test --password test --mountpoint /tmp/fuse/`` > /tmp/fusemnt.log 2>&1') # time.sleep(2) # run("cd /tmp/fuse && mkdir -p newdir && cd newdir && echo 'Hello World!' >> data && cat data") success('{0} is working...'.format(env.APP_NAME))
def start_APP_and_check_status(): """ Starts the ngamsDaemon process and checks that the server is up and running. Then it shuts down the server """ # We sleep 2 here as it was found on Mac deployment to docker container that the # shell would exit before the ngasDaemon could detach, thus resulting in no startup. virtualenv('ngamsDaemon start -cfg {0} && sleep 2'.format(env.tgt_cfg)) try: res = virtualenv('ngamsDaemon status -cfg {0}'.format(env.tgt_cfg), warn_only=True) if res.failed: failure( "Couldn't contact NGAS server after starting it. " "Check log files under %s/log/ to find out what went wrong" % APP_source_dir(), with_stars=False) else: success('NGAS server started correctly :)') finally: info("Shutting NGAS server down now") virtualenv("ngamsDaemon stop -cfg {0}".format(env.tgt_cfg))
def build_APP(): """ Builds and installs APP into the target virtualenv. """ with cd(APP_source_dir()): develop = False no_doc_dependencies = APP_doc_dependencies() build_cmd = APP_build_cmd() print(build_cmd) if build_cmd != '': virtualenv(build_cmd) with cd(APP_install_dir()): virtualenv( 'pip install --no-binary zc.recipe.egg -r {0}'.format(ZOPE_URL)) # virtualenv('pip install -U zope.interface') virtualenv('pip install Products.ExternalMethod') virtualenv('pip install Products.PythonScripts') virtualenv('pip install Products.ZSQLMethods==2.13.5') # virtualenv('easy_install Products.SQLAlchemyDA') virtualenv('pip install psycopg2-binary') virtualenv('mkzopeinstance -d {0}/ngas -u {1}:{2}'.format( APP_install_dir(), 'admin', 'admin4zope')) with cd('/tmp'): virtualenv( 'git clone https://github.com/zopefoundation/Products.SQLAlchemyDA.git SQLAlchemyDA' ) virtualenv('cd SQLAlchemyDA; python setup.py install')