Skip to content

Commit

Permalink
Tidy infra readme
Browse files Browse the repository at this point in the history
  • Loading branch information
jch254 committed Sep 10, 2017
1 parent 71d8a19 commit 6a6c984
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 20 deletions.
54 changes: 35 additions & 19 deletions infrastructure/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Deployment/Infrastructure

This project is deployed to AWS on S3. CloudFront is used as a CDN. Route 53 is used for DNS.
This project is built, tested and deployed to AWS by [codebuild-github-webhook](https://github.com/jch254/codebuild-github-webhook) and CodeBuild. Artifacts are served from S3. CloudFront is used as a CDN. Route 53 is used for DNS.

---

Expand All @@ -15,33 +15,49 @@ To deploy to AWS, you must:
1. Set your credentials as the environment variables `AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY`.
1. Run `aws configure` and fill in the details it asks for.
1. Run on an EC2 instance with an IAM Role.
1. Run via CodeBuild or ECS Task with an IAM Role.
1. Update the S3 backend in [main.tf](./main.tf):
```
terraform {
backend "s3" {
bucket = "YOUR_S3_BUCKET"
key = "603.nz.tfstate"
region = "YOUR_REGION"
encrypt= "true"
}
}
```
1. Run via CodeBuild or ECS Task with an IAM Role (see [buildspec-test.yml](../buildspec-test.yml) for workaround)

#### Deploying infrastructure

1. `terraform init`
1. `terraform plan -var-file main.tfvars -out main.tfplan`
1. Update and export all environment variables specified in the appropriate buildspec declaration (check all phases) and bash scripts
1. Initialise Terraform:
```
terraform init \
-backend-config 'bucket=YOUR_S3_BUCKET' \
-backend-config 'key=YOUR_S3_KEY' \
-backend-config 'region=YOUR_REGION' \
-get=true \
-upgrade=true
```
1. `terraform plan -out main.tfplan`
1. `terraform apply main.tfplan`

#### Updating infrastructure

1. Update and export all environment variables specified in the appropriate buildspec declaration (check all phases) and bash scripts
1. Make necessary infrastructure code changes.
1. `terraform init`
1. `terraform plan -var-file main.tfvars -out main.tfplan`
1. Initialise Terraform:
```
terraform init \
-backend-config 'bucket=YOUR_S3_BUCKET' \
-backend-config 'key=YOUR_S3_KEY' \
-backend-config 'region=YOUR_REGION' \
-get=true \
-upgrade=true
```
1. `terraform plan -out main.tfplan`
1. `terraform apply main.tfplan`

#### Destroying infrastructure (use with care)

1. `terraform init`
1. `terraform destroy -var-file main.tfvars`
1. Update and export all environment variables specified in the appropriate buildspec declaration (check all phases) and bash scripts
1. Initialise Terraform:
```
terraform init \
-backend-config 'bucket=YOUR_S3_BUCKET' \
-backend-config 'key=YOUR_S3_KEY' \
-backend-config 'region=YOUR_REGION' \
-get=true \
-upgrade=true
```
1. `terraform destroy`
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/jch254/603.nz"
"url": "https://github.com/jch254/603dotnz"
},
"dependencies": {
"moment": "^2.18.0"
Expand Down

0 comments on commit 6a6c984

Please sign in to comment.