Contact info
Tan | ts864@cornell.edu
Overview
Currently, the way Docker containers are deployed on AWS is basically having them run on EC2 instances. This means that each service occupies a unique port on the machine. Below is a list of running services and the ports they are using.
Service | Port |
---|---|
Backend online | 5001 |
Test and production environments are deployed separately on the EC2 instances below.
Function | IP address | Key pair file |
---|---|---|
Test | 3.232.82.82 | DIAPER-test-key.pem |
Production | 35.168.248.57 | DIAPER-production-key.pem |
Procedure
The procedure for deploying is the same for both EC2 instances. First, download the key pair file corresponding to the instance and run
chmod 400 /path/to/DIAPER-*-key.pem
Then, ssh into the EC2 instance using
ssh -i /path/to/DIAPER-*-key.pem ec2-user@<ip address>
Pull your Docker image and other relevant file from GitHub. Once pulled, navigate to your project folder and you'll see multiple docker. To keep your service from blocking the console, you should run your Docker in detached mode using the -d option.
Now you can log out and the service will continue running on the EC2 instance.
Note: You must specify which .yml file to use when launching docker. See details at Domains of backend APIs and SSL > "Specify which yml file to use when launching docker on production and test environment"
Common Issues
BioHPC database timeout
If you are experiencing timeout when connecting to the BioHPC database, it' probably because the EC2 instance isn't connected to Cornell's VPN. To connect to the VPN, run the following command
openconnect -b cuvpn.cuvpn.cornell.edu
and enter necessary information as prompted.
Specify which yml file to use when launching docker on production and test environment
Separate docker-compose config files named docker-compose-prod.yml and docker-compose-test.yml are created.
Since only production and test environment will use this cert. When launching docker, must specify this yml file.
Command Line
// For production at 35.168.248.57 docker-compose -f docker-compose-prod.yml up -d // For test at 3.232.82.82 docker-compose -f docker-compose-test.yml up -d // For local development on your laptop // These two commands are equivalents (i.e. default is docker-compose.yml) docker-compose -f docker-compose.yml up -d docker-compose up -d