Skip to content

RBD Installation

Ethan Andrews edited this page Feb 10, 2021 · 9 revisions

Production Deployment

Prerequisites

To deploy a production instance of Roundabout, you need to have the following items in place:

  • A web server with ports 80 and 443 available
  • Docker and Docker Compose installed on the server - instructions
  • Git installed on the server

Environmental Variables

Roundabout relies heavily on environmental variables. The environmental variables include secrets like database usernames/passwords. These variable should NOT be kept in version control. The repository includes a .envs.example directory that you can use as a template to create your own .envs directory and files. Roundabout requires this ".envs" directory to be in the application root level directory. (ex. environmental variables file path: .envs/.production/.django)

.envs/
  -- .production/
    -- .django
    -- .postgres
  -- .local/
    -- .django
    -- .postgres

The environmental variables include several standard required Django settings that you should update to your own values, including:

  • DJANGO_SECRET_KEY
  • DJANGO_ALLOWED_HOSTS
  • POSTGRES_HOST
  • POSTGRES_PORT
  • POSTGRES_DB
  • POSTGRES_USER
  • POSTGRES_PASSWORD

In addition to standard Django variables, Roundabout uses some custom environmental variables to set the pattern for the auto-generation of Serial Numbers. There are several options available for you to choose from in the .env/production/django file:

  1. If you want to enable basic Serial Number auto-generation, set the RDB_SERIALNUMBER_CREATE variable to True. This will create Serial Numbers with a basic numeric pattern - "1, 2, 3, ... etc."
  2. If you want to use the Serial Number pattern recommended by OOI, then also set the RDB_SERIALNUMBER_OOI_DEFAULT_PATTERN variable to True. This will create Serial Numbers with the following pattern: "Part Number" + "-20001, -20002, -20003, etc."

NGINX Settings

The Docker production deployment uses a NGINX container as a web server and proxy to the Django app. An example NGINX conf file (nginx-example.conf.EXAMPLE) is included in the /compose/production/nginx/ directory that you can use as a template for HTTP or HTTPS deployment.

If using SSL, you also need to upload your SSL certificates to the the application root level directory in a new /.ssl/certs/ directory. These will be copied into the NGINX container when Docker builds the containers. This directory should also NOT be kept in version control. If you're not using SSL (you should really use SSL), comment out the following line in the production.yml file and update the NGINX conf file accordingly:

    volumes:
      - production_nginx:/var/log/nginx
      - ./.ssl/certs:/etc/ssl/certs/ # bind a local directory with the SSL certs <-- REMOVE THIS LINE

Deployment Steps

  1. Clone the repository to whatever directory on your server you want to use.
  2. Upload your NEW .envs directory and .ssl directory (if using) to the application root directory.
  3. Run the following Docker Compose commands:
    docker-compose -f production.yml build
    docker-compose -f production.yml up -d
  1. You're done! Site should be available at whatever domain you specified in NGINX.

Using Roundabout for the First Time

Not that your site is up and running, you can login by clicking the "Sign In" link and using the default user credentials created when the site was spun up for the first time. These credentials are set in the .env/production/django file, and -- unless you changed them before starting the site -- default to:

  • Username: admin
  • Password: admin

You should update these immediately after logging in the first time by clicking the "My Profile" link.

Local Docker Development

See detailed cookiecutter-django documentation