adsabs / ADSDeploy

Deployment, testing, and GUI pipeline for the ADS application tier
GNU General Public License v3.0
0 stars 2 forks source link

ADSDeploy

Deployment, testing, and GUI pipeline for the ADS application tier

Build Status Coverage Status

ADSDeploy is the 'Green Button' for deploying microservices. It is made of several components.

dev setup - vagrant (docker)

  1. vim ADSDeploy/local_config.py #edit, edit
  2. vagrant up db rabbitmq app --provider=docker
  3. vagrant ssh app
  4. cd /vagrant

This will start the pipeline inside the app container - make sure you have configured endpoints and access tokens correctly.

We are using 'docker' provider (ie. instead of virtualbox VM, you run the processes in docker). On some systems, it is necessary to do: export VAGRANT_DEFAULT_PROVIDER=docker or always specify `--provider docker' when you run vagrant.

The directory is synced to /vagrant/ on the guest.

dev setup - local editing

If you (also) hate when stuff is unnecessarily complicated, then you can run/develop locally (using whatever editor/IDE/debugger you like)

  1. ./manifests/production/app/eb-deploy-setup.sh
  2. virtualenv python
  3. source python/bin/activate
  4. pip install -r requirements.txt
  5. pip install -r dev-requirements.txt
  6. vagrant up db rabbitmq webapp --provider=docker

This will setup python virtualenv and the database + rabbitmq. You can run the pipeline and tests locally.

eb-deploy

$ ./manifests/production/app/eb-deploy-setup.sh

The script will checkout the internal ADS repository (you will need access to it). The script will also test if you have access. If not, it will initiate the setup. You will need to supply the AWS secret tokens.

RabbitMQ

vagrant up rabbitmq

The RabbitMQ will be on localhost:6672. The administrative interface on localhost:25672.

Database

vagrant up db

PostgreSQL on localhost:6432

WebApp

vagrant up webapp --provider=docker

The API gateway (microservice) will be on localhost:9000.

production setup

vagrant up prod

Before running this command, you must obtain the eb-deploy-key (for accessing GitHub repository) and aws_config with secrets for accessing AWS. These files have to placed into manifests/production/app

The setup will automatically download/install the latest release from the github (no, not your local changes - only from github).

If your /ADSDeploy/prod_config.py is available, it will copy and use it in place of local_config.py

No ports are exposed, no SSH access is possible. New releases will deployed automatically.

production setup - docker way

  1. cd manifests/production/app
  2. create aws_config and eb-deploy-key
  3. docker build -t prod .
  4. cd ../../..
  5. vim prod_config.py # edit, edit...
  6. docker run -d -v .:/vagrant/ --cap-add SYS_ADMIN --security-opt apparmor:unconfined --name ADSDeploy prod /sbin/my_init

Here are some useful commands: