# AWS EC2 Deployment ## Phase 1. Install Docker and check if it auto-starts. - Run this command, if necessary, to ensure the key is not publicly viewable. **Example:** ``` chmod 400 AFG2022.pem ``` - Connect to the instance using its Public DNS: **Example:** ``` ssh -i "AFG2022.pem" ec2-user@ec2-xx-xxx-xx-xx.compute-1.amazonaws.com ``` - Run programs as another user, by default the root user. ``` sudo su ``` - Update all the presently installed packages to their latest versions that are available in the repositories ``` yum update -y ``` - Install the most recent Docker Engine package. ``` sudo amazon-linux-extras install docker ``` - Start the Docker service. ``` sudo service docker start ``` - Add the ec2-user to the docker group so you can execute Docker commands without using sudo. ``` sudo usermod -a -G docker ec2-user ``` - Verify that the ec2-user can run Docker commands without sudo. ``` docker info ``` - (Optional) Check the version: ``` docker version ``` - Make docker auto-start. ``` sudo chkconfig docker on ``` - Reboot to verify it all loads fine on its own. ``` sudo reboot ``` ``` clear ``` ## Phase 2. Connect to the instance. ``` ssh -i "AFG2022.pem" ec2-user@ec2-34-205-25-22.compute-1.amazonaws.com ``` ``` sudo su ``` - Install git: ``` yum install git -y ``` - Install docker compose: Copy the appropriate docker-compose binary from GitHub: ``` sudo curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose ``` *NOTE: **OR** to get the latest version, run:* ``` sudo curl -L https://github.com/docker/compose/releases/latest/download/docker-compose-$(uname -s)-$(uname -m) -o /usr/local/bin/docker-compose ``` - Create a symbolic link to file1 named file2. ``` ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose ``` - Fix permissions after download: ``` sudo chmod +x /usr/local/bin/docker-compose ``` - Verify success: ``` docker-compose version ``` - Clone the repository: ``` git clone https://github.com/creativehope-inc/afg.git ``` - Go inside the `afg` folder and checkout to `release/ws`. ``` cd afg && git checkout release/ws ``` - Go to AFG README.md to run the Docker containers: https://github.com/creativehope-inc/afg