This repo host scripts for deploy sinewave new
- terraform
>= v0.12.6
Export AWS credential or profile to environment variable:
export AWS_ACCESS_KEY_ID=XXXX
export AWS_SECERT_ACCESS_KEY=XXXXX
export AWS_REGION=XXXXX
#or
export AWS_PROFILE=<your-profile-name>cd environments/dev/1-state
# install all modules(only needed at the first run)
terraform init
# examine changes to be applied
terraform plan -var-file="../terraform.tfvars"
# apply changes
terraform apply -var-file="../terraform.tfvars"components should be provisioned in the following order
- image-repo
- database
- app
Note: you may not need to provision image-repo and database frequently, the normal application deploy should just provision app component with environment variables in environments/<env>/terraform.tfvars
cd environments/dev/<component>
# install all modules(only needed at the first run)
terraform init
# examine changes to be applied
terraform plan -var-file="../terraform.tfvars"
# apply changes
terraform apply -var-file="../terraform.tfvars"- Add your ssh private key to ssh agent
ssh-add <path-to-your-private-key> - ssh to bastion with agent key forwarding enabled
ssh ubuntu@<bastion-ip> -A - find sinewave new ec2 instance IP and ssh to it?
ssh ec2-user@<sinewave-new-host-ip>
- Follow the previsou steps to ssh to sinewave new host
- Find the sinewave-new container
docker ps
- Attach to the running container and launch rails console
docker exec -it <container_id> /app/bin/rails console