cloudhubs / tms2020

0 stars 1 forks source link

TMS 2020

Local deployment

$ ls -R ssl
certs/ keys/

ssl/certs:
tcs_ecs_baylor_edu.crt

ssl/keys:
tcs_ecs_baylor_edu.key
$ ./build.sh
$ docker-compose push
$ docker-compose down --remove-orphans
$ docker volume rm tms2020_postgres_data
$ docker-compose up --no-build --detach
$ docker ps
$ docker-compose logs -f
$ docker-compose logs -f {container-name}
ex: $ docker-compose logs -f qms
$ cat /etc/hosts

127.0.0.1 tcs.ecs.baylor.edu

Production Redeploy

It was decided to not have code in the server, instead docker images are built and pushed from your local machine, and then images are pulled in production and deployed.

  1. Building images on your local: Once you test you latest updates, and push your code to bitbucket, you just need to build images on your local ./build.sh
  2. Push images: Now you need to push images, docker-compose push. Before that you may need to docker login with username: cloudhubs2 and for password you should ask from previous developers or Dr. Cerny.
  3. Pull images in production: go to tcs.ecs.baylor.edu (either from Baylor's network or via fire.ecs.baylor.edu tunnel), cd /tms and pull images sudo docker-compose pull. You may need to docker login.
  4. Deploy: run sudo docker-compose down and sudo docker-compose up --no-build --detach

Production deployment from scratch

$ sudo docker network inspect {app-internal-network} # note the subnet address
$ sudo firewall-cmd --zone=public --add-masquerade --permanent
$ sudo firewall-cmd --permanent --zone=public --change-interface=docker0
$ sudo firewall-cmd --permanent --zone=public --add-rich-rule='rule family=ipv4 source address=172.18.0.0/16 accept'
$ ls -R ssl
certs/ keys/

ssl/certs:
tcs_ecs_baylor_edu.crt

ssl/keys:
tcs_ecs_baylor_edu.key
docker-compose pull
$ docker-compose down --remove-orphans
$ docker volume rm tms_postgres_data
$ docker-compose up --no-build --detach

Port forwarding

$ sudo ssh -L 443:127.0.0.1:1234 das@fire.ecs.baylor.edu
$ ssh -L 1234:127.0.0.1:443 das@tcs.ecs.baylor.edu
$ cat /etc/hosts

127.0.0.1 tcs.ecs.baylor.edu

Development note: React subdirectory

The QMS client is deployed to the subdirectory /questions, which requires these changes:

Other Development notes: