Skip to content

Deployment

Martin Müller edited this page Jun 3, 2018 · 12 revisions

Deployment to production on AWS EC2 (Ubuntu 16.04)

A few things to note:

  • Needs at least a t2.small instance to work properly, however should also work on a micro
  • For this installation to work make sure ports 80 and 433 are open to public in the AWS security group attached to the EC2, and the respective domains for Elasticserach and the API are registered on the DNS provider and are pointing to the correct IP on EC2.

Instructions

  1. Create SSL keypair
ssh-keygen -t rsa -b 4096 -C "example@email.com"
  1. Add public key to deploy keys in github repository
  2. Set secrets in secrets.list
cp secrets.list.example secrets.list
  1. Install docker and docker-compose
  2. Run certbot, get certificates for domains
sudo docker run -it -p 443:443 -p 80:80 --name certbot -v /etc/letsencrypt:/etc/letsencrypt -v /var/lib/letsencrypt-lib/:/var/lib/letsencrypt certbot/certbot certonly
  1. Create elasticsearch passwd
sudo htpasswd elasticsearch.pwd elasticsearch
  1. Deploy
source build_production.sh

Old solution: SSL certificate without docker Following this.

sudo add-apt-repository ppa:certbot/certbot
sudo apt-get update
sudo apt-get install python-certbot-nginx -y
sudo certbot --nginx -d api-stg.crowdbreaks.org

This should automatically modify the nginx config as well as add all necessary certificates. The current certificate will need to be renewed every 2 months. Run /opt/letsencrypt/letsencrypt-auto —debug or set up a cron job to renew certificates.

Clone this wiki locally