martibosch / doge-test

Example DOGE workflow for a "Hello World!" app

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Staging/production deployment

First-time setup

1. Initialize terraform

make init-base

2. Create github repository and import into terraform state

git init
git add .
git commit -m "initial commit"
gh repo create --public --source=. --push --remote=origin
terraform -chdir="./terraform/deploy/base" import -var-file=vars.tfvars module.base.github_repository.repo doge-test

1. Initialize terraform

From the terraform directory, initalize terraform with the following command, which should only be run once (unless the provider/module versions change):

cd terraform
terraform init

2. Setup secrets

2.1 Create GitHub token and add it to Terraform Cloud

Create a GitHub token

"Variables" tab, "Add variable", select "Environment variable", with GITHUB_TOKEN as key and the token as value.

2.2 Create DigitalOcean token and add it to Terraform Cloud

Create a DigitalOcean personal access token

"Variables" tab, "Add variable", select "Environment variable", with DIGITALOCEAN_TOKEN as key and the token as value.

4. Infrastructure provisioning

a) Provision GitHub repository using Terraform

Plan the changes:

terraform plan -var-file=staging.tfvars

review and apply them:

terraform apply -var-file=staging.tfvars

and then add commits on top of the initial commit provisioned by Terraform.

b) Import the repository into Terraform state

Create a GitHub repository and push the initial commit. Then, import it into the Terraform state as in:

terraform import -var-file=staging.tfvars module.base.github_repository.repo doge-test

Finally, plan, review and apply the changes as described above in the option a).

5. Create a Terraform Cloud token and add it as GitHub repository secret

Create token https://app.terraform.io/app/settings/tokens

4. Plan and apply

Plan the changes:

terraform plan -var-file=staging.tfvars

review them, and apply:

terraform apply -var-file=staging.tfvars

Deployment

The actual deployment strategy follows a git-ops workflow.

About

Example DOGE workflow for a "Hello World!" app

License:GNU General Public License v3.0


Languages

Language:HCL 91.4%Language:Makefile 7.2%Language:Dockerfile 0.9%Language:Python 0.5%