Skip to content

Latest commit

 

History

History

deploy

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Deployment scripts

This folder contains Ansible scripts and other artifacts needed for deploying RDX to a VM. There are two playbooks:

  • system.yml that installs necessary packages, sets up cron schedule and let's encrypt certificates. Normally, you need to run it only once;
  • and containers.yml that uses docker-compose and takes care of (re-)deploying all Docker containers that run RDX and accompanying services. You can run it manually or configure a CI system to do it (e.g. GitLab). See: .gitlab-ci.yml.

Applying a playbook:

To apply playbooks on a server, you will need Python's pipenv (tested on version 2021.11.23).

$ cd deploy
$ pipenv install
$ pipenv run ansible-playbook -i inventory.yml -u ubuntu <playbook_you_want_to_run>

How to setup a brand new server

Pre-requisites

  1. Server with Ubuntu 18.04.X:
  • with a fully qualified domain name;
  • with user ubuntu;
  • with your public ssh key in ubuntu's authorised keys;
  • with access to git.ia.surfsara.nl.
  1. Generated access token for Docker registry.

  2. Research Drive's Webdav username and password.

  3. Mail server configuration.

Steps

  1. Apply playbook system.yml (setups machine configuration and installs all missing packages)

  2. Setup required Environment variables on the machine where you are running ansible commands

  3. Modify/Create inventory-prod.yml add/replace host name. Read here for more information regarding inventory.

  4. Apply playbook containers.yml (downloads components images and starts all required processes)

pipenv run ansible-playbook -i inventory-prod.yml -u ubuntu playbooks/containers.yml

  1. Validate setup
  • Check that docker containers started and not producing any errors. On the machine run:
# To check running containers
docker ps

# To check logs in case of the continuous container restarts
 docker logs --tail 50 --follow --timestamps rdx_backend_1

  • Check if UI works

Go to $RDX_WEB_URL in your browser to see the index page.

Environment variables

All these variables must be set on the machine that runs Ansible. They will be propagated to the appropriate Docker containers.

DOCKER_IMAGE_TAG = "latest"
DOCKER_USERNAME = "<configure in GitLab>. See https://docs.gitlab.com/ee/user/packages/container_registry/"
DOCKER_PASSWORD = "<configure in GitLab>. See https://docs.gitlab.com/ee/user/packages/container_registry/"
RDX_SMTP_HOST = "<e.g. smtp.mailtrap.io>"
RDX_SMTP_PORT = 2525
RDX_SMTP_USER = "<e.g. make a free account on mailtrap.io>"
RDX_SMTP_PASSWORD = "<e.g. make a free account on mailtrap.io>"
RDX_WEB_URL="https://rdx.lab.surf.nl"  # Public web URL starting with protocol.
RDX_WEBDAV_PASSWORD = "<configure in Research Drive>"
RDX_WEBDAV_USER = "<configure in Research Drive>"
DB_USER = "postgres"

Use the SSH_ADDITIONAL_SOURCES variable to add additional SSH sources.

SSH_ADDITIONAL_SOURCES = '[{ "src": "1.2.3.4/32", "comment": "Additional ssh source" }]'