Skip to content

Deployment Instructions

James Case edited this page May 16, 2019 · 15 revisions

Deployment Instructions

These instructions supplement the primary README.md
What is not covered in these instructions:

  • CentOS Server setup
  • Database (postgresql) setup
  • Redis setup (remember to redis-cli flushdb on uframe state changes)
  • Python virtual environment setup (Python Version 2.7.9)

ooi-ui-services

It is recommended to perform a clean installation of the application.

Ensure any changes in config.yml are migrated to config_local.yml if re-using an existing config_local.yml.

This application depends on a pre-configured postgresql database.

Python version 2.7.9 required

  1. Get the code

    cd <your working directory>

    git clone https://github.com/asascience-open/ooi-ui-services.git

    cd ooi-ui-services

    git checkout <git hash, branch name or tag>

  2. Edit the config.yml or config_local.yml to match your environment.

  3. Install python packages

    pip install -r ooiservices/requirements/deployment.txt

  4. Deploy the database

    • ALWAYS CREATE A DATABASE BACKUP BEFORE PERFORMING ANY OF THE STEPS BELOW

    • To perform first-time deployment run the following:
      Note that this command should only be run once after initial database creation

    python ooiservices/manage.py deploy --password <admin-password> --psqluser <postgres authorized user> --production

    • To update the database and SAVE all existing users run the following:

    python ooiservices/manage.py rebuild_schema --schema <ooiui or per DBA> --schema_owner <postgres or per DBA> --save_users True

    OR

    • To update the database and ERASE all existing users run the following:

    python ooiservices/manage.py rebuild_schema --schema <ooiui or per DBA> --schema_owner <postgres or per DBA> --save_users False

    • To also save the disabledstreams table append --save_disabled_streams True

    • Typical usage during an upgrade:

    python ooiservices/manage.py rebuild_schema --schema ooiui --schema_owner postgres --save_users True --save_disabled_streams True

  5. Start the app manually (uwsgi option available)

    python ooiservices/manage.py runserver

  6. Bootstrap the Redis cache

  • Wait until each curl command completes before starting the next one.

  • After last curl command proceed to ooi-ui setup.

    redis-cli -h <redis ip address> flushdb

    cd <temporary log directory of choice>

    curl -H "Content-Type: application/json" -X GET 127.0.0.1:4000/uframe/build_assets_cache > asset_log.txt

    curl -H "Content-Type: application/json" -X GET 127.0.0.1:4000/uframe/build_stream_cache > stream_cache_log.txt

    curl -H "Content-Type: application/json" -X GET 127.0.0.1:4000/uframe/build_toc_rds > build_toc_rds_log.txt

    curl -H "Content-Type: application/json" -X GET 127.0.0.1:4000/uframe/build_instrument_list > instrument_list_log.txt

    curl -H "Content-Type: application/json" -X GET 127.0.0.1:4000/uframe/build_large_format_files > build_large_format_files_log.txt

    curl -H "Content-Type: application/json" -X GET 127.0.0.1:4000/uframe/build_large_format_index > build_large_format_index_log.txt

    curl -H "Content-Type: application/json" -X GET 127.0.0.1:4000/uframe/build_cam_images > build_cam_images_log.txt

ooi-ui

It is recommended to perform a clean installation of the application.

Ensure any changes in config.yml are migrated to config_local.yml if re-using an existing config_local.yml.

  1. Get the code

    cd <your working directory>

    git clone https://github.com/asascience-open/ooi-ui.git

    cd ooi-ui

    git checkout <git hash, branch name or tag>

  2. Edit the config.yml or config_local.yml to match your environment.

  3. Install python packages

    pip install -r requirements.txt

  4. Load JS libraries

    npm install
    bower install
    grunt

  5. Start the app manually (uwsgi option available)

    python app.py -s