This is very simple example of how to use Terraform to bootstrap an instance in Google Cloud's Compute Engine and then install Dokku.
- Terraform ie:
brew update && brew install terraform
- GCE service account JSON file
This example tries to follow the Twelve-Factor app approach (sorta). Other then the json file you should have downloaded above, all configuration is stored in environment.
- Clone this repo locally
- Download your project's json key file and save it locally
- Copy the below to a text editor (like vim!) and amend the exports as necessary
- Either paste or source the exports after you have made changes
cd
into the repo and runterrafrom plan
. It should not prompt you for any variables, if it does, make sure the full path to the key is correct in the env and all of the other exports are present:env | grep TF_VAR
- Use
terraform apply
to apply these changes
# Replace export if your not using a bash / borne shell
export TF_VAR_JSON_PATH='project.json'
export TF_VAR_REGION='us-west1'
export TF_VAR_METADATA_SCRIPT='wget https://raw.githubusercontent.com/dokku/dokku/v0.7.0/bootstrap.sh && sudo DOKKU_TAG=v0.7.0 bash bootstrap.sh'
export TF_VAR_PROJECT='nameofproject-123456'
This really applies changes to your Google Cloud account! Charges may apply! Don't run this in production, unless you know what your doing! Please see the license.