A demo repository for deployment examples of a Phoenix project.
- aws cli
- open-ssh
- docker, docker-compose
- terraform
- ansible
- kubectl
- helm, helmfile
We are not going to develop in the root user. The user should have administrator privileges. Create an access key pair for cloud development.
aws configure
with the access credentials of the IAM user.
Use the AWS Route53 service. Here my domain name is tamasweb.com.
cd ./keys
ssh-keygen
cd ./terraform/ec2_deploy
terraform apply
Make sure that the nameserver addresses of the NS record are referenced correctly in the domain name registry.
source ./source_env.sh
This logs in to Docker with AWS credentials, exports AWS related variables. Make sure that the domain name at the beginning of the script is correct.
docker-compose build phx-server
docker push ${AWS_ECR_REPO}:deploy_demo_0.1
- Check public IP address of the EC2 instance:
aws ec2 describe-instances --query "Reservations[].Instances[].PublicIpAddress"
Replace this IP address with the address in ./ansible/aws_inventory
- Fix RSA key for Ansible:
Make sure your private RSA key path is referenced correctly in ./ansible/group_vars/webservers.yml
cd ./ansible
ansible-playbook -i aws_inventory provision_playbook.yml
ssh -i keys/id_rsa ubuntu@15.188.75.62
docker-compose up -d
The IP address of the SSH target has to be the public IP address of the EC2 instance.
Now the server should be available on the domain name in your browser.
cd ./terraform/eks_deploy
terraform apply
Make sure that the nameserver addresses of the NS record are referenced correctly in the domain name registry.
source ./source_env.sh
This logs in to Docker with AWS credentials, exports AWS related variables. Make sure that the domain name at the beginning of the script is correct.
docker-compose build phx-server
docker push ${AWS_ECR_REPO}:deploy_demo_0.1
helmfile apply
Now the server should be available on the domain name in your browser.