...
The procedure for deploying is the same for both EC2 instancesall environments. First, download the key pair file corresponding to the instance and run
| Code Block |
|---|
chmod 400 /path/to/DIAPER-*-key.pem |
Then, ssh into the corresponding EC2 instance using
| Code Block |
|---|
ssh -i /path/to/DIAPER-*-key.pem ec2-user@<domain> |
Pull your Docker image and other relevant file from GitHub. Once pulled, navigate to your project folder and run the Docker using the folder containing docker-compose up with files and run the corresponding yml filecommand as explained below:
| Code Block |
|---|
// For test environments. sudo./deploy.sh docker-compose-n "Your Name" -f docker-compose-test.yml up -d --force-recreatem "Reason for deployment" test // For production environments. sudo./deploy.sh docker-compose-n "Your Name" -f docker-compose-prod.yml up -d --force-recreatem "Reason for deployment" prod // For local development on your laptop. // These two commands are equivalents (i.e. default is docker-compose.yml) sudo docker-compose -f docker-compose.yml up -d --force-recreate sudo docker-compose up -d --force-recreate |
For test and production environments, your deployment will be logged in deploymentHistory.log under the same directory.
The commands above We have different yml files because production and test environments use different SSL certificates. We use the -d option here to run your container in detached mode so that your service from doesn't block the console. However, once a container is run in detached mode, all of its runtime errors will not be reported to the console. Thus, as the last step of deployment, you need to manually check that no runtime errors occurred during the launching of your service by looking at its log using
...