This project will leverage GCP to quickly land a google compute instance with docker installed. Firewall rules are strict and disallow inbound ports including SSH. To deploy scripts without SSH I used templates and GCP's metadata startup script. This instance should be always free and a new account comes with $300 usable during the first 12 months.
Install Terraform and Git. I suggest using chocolatey for Windows or homebrew for Mac.
- Create Google Cloud Platform account
- Take note of your generated project name and ID (or create your own project name)
- Create a service account and download your subsequent JSON key
- Clone Repo and run terraform init
git clone https://github.com/terraformed/terraform-docker-gcp.git cd ./terraform-docker-gcp terraform init
- Copy downloaded json credential file to this project location and rename it to gcp-key.json
- Modify gcp_project value in vars.tf to match the your project ID in google cloud
- Execute Terraform plan and apply
terraform plan terraform apply -auto-approve
- Log into GCP console and confirm your docker container(s) is running
sudo docker container ls #on google cloud vm instance
By default I included a postgres db but you can put specify containers in docker-compose-build.tpl which becomes docker-compose.yml on the host.
To enable 80 and 443 uncomment the 'tags' line in main.tf
https://cloud.google.com/community/tutorials/getting-started-on-gcp-with-terraform