ops: more terraform, docs
This commit is contained in:
parent
860fc1eb70
commit
5ab67ce7fe
|
@ -1,5 +1,6 @@
|
||||||
# Configuration
|
# Configuration
|
||||||
|
|
||||||
|
Code reads its configuration from the environment variables.
|
||||||
All configuration is done through environment variables.
|
All configuration is done through environment variables.
|
||||||
|
|
||||||
Not all of these are necessary to run the code. The most important ones are:
|
Not all of these are necessary to run the code. The most important ones are:
|
||||||
|
@ -23,7 +24,6 @@ Note that not all of these cookies are needed to use all parts of the source cod
|
||||||
|
|
||||||
- `GOODJUDGMENTOPENCOOKIE`
|
- `GOODJUDGMENTOPENCOOKIE`
|
||||||
- `INFER_COOKIE`
|
- `INFER_COOKIE`
|
||||||
- `CSETFORETELL_COOKIE`, deprecated, superseded by `INFER_COOKIE`.
|
|
||||||
- `HYPERMINDCOOKIE`
|
- `HYPERMINDCOOKIE`
|
||||||
- `GOOGLE_API_KEY`, necessary to fetch Peter Wildeford's predictions.
|
- `GOOGLE_API_KEY`, necessary to fetch Peter Wildeford's predictions.
|
||||||
- `SECRET_BETFAIR_ENDPOINT`
|
- `SECRET_BETFAIR_ENDPOINT`
|
||||||
|
|
45
docs/infra.md
Normal file
45
docs/infra.md
Normal file
|
@ -0,0 +1,45 @@
|
||||||
|
# Terraform
|
||||||
|
|
||||||
|
Infra is managed by [Terraform](https://www.terraform.io/) (WIP, not everything is migrated yet).
|
||||||
|
|
||||||
|
Managed with Terraform:
|
||||||
|
|
||||||
|
- Vercel
|
||||||
|
- Digital Ocean (database)
|
||||||
|
- Heroku
|
||||||
|
|
||||||
|
TODO:
|
||||||
|
|
||||||
|
- Algolia
|
||||||
|
- Twitter bot
|
||||||
|
- DNS?
|
||||||
|
|
||||||
|
## Recipes
|
||||||
|
|
||||||
|
### Set up a new dev repo for managing prod
|
||||||
|
|
||||||
|
1. Install [Terraform CLI](https://www.terraform.io/downloads)
|
||||||
|
2. `cd tf`
|
||||||
|
3. `terraform init`
|
||||||
|
4. Get a current version of prod tfvars configuration
|
||||||
|
- Source is in `metaforecast-notes-and-secrets` secret repo, `tf/prod.auto.tfvars` for now (will move to Terraform Cloud later)
|
||||||
|
- Store it in `tf/prod.auto.tfvars` (or somewhere else, there are [other ways](https://www.terraform.io/language/values/variables#assigning-values-to-root-module-variables))
|
||||||
|
5. Get a current version of terraform state
|
||||||
|
- Source is in `metaforecast-notes-and-secrets` secret repo for now (will move to Terraform Cloud or [pg backend](https://www.terraform.io/language/settings/backends/pg) later)
|
||||||
|
- Store it in `tf/terraform.tfstate`
|
||||||
|
|
||||||
|
Now everything is set up.
|
||||||
|
|
||||||
|
Check with `terraform plan`; it should output `"No changes. Your infrastructure matches the configuration."`.
|
||||||
|
|
||||||
|
### Edit environment variables in prod
|
||||||
|
|
||||||
|
1. Update terraform state and vars from `metaforecast-notes-and-secrets`
|
||||||
|
2. Modify `tf/prod.auto.tfvars` as needed
|
||||||
|
3. Run `terraform apply`
|
||||||
|
- Check if proposed actions list is appropriate
|
||||||
|
- Enter `yes`
|
||||||
|
- Terraform will push the new configuration to Heroku and Vercel.
|
||||||
|
4. Push terraform state and vars back to `metaforecast-notes-and-secrets`
|
||||||
|
|
||||||
|
(After we move to Terraform Cloud (1) and (4) won't be needed.)
|
2
tf/.gitignore
vendored
2
tf/.gitignore
vendored
|
@ -1,3 +1,3 @@
|
||||||
/*.tfstate*
|
/*.tfstate*
|
||||||
/.terraform*
|
/.terraform*
|
||||||
/prod.tfvars
|
/prod.*tfvars
|
||||||
|
|
|
@ -61,7 +61,7 @@ resource "vercel_project" "metaforecast" {
|
||||||
|
|
||||||
git_repository {
|
git_repository {
|
||||||
type = "github"
|
type = "github"
|
||||||
repo = "QURIresearch/metaforecast"
|
repo = "quantified-uncertainty/metaforecast"
|
||||||
}
|
}
|
||||||
|
|
||||||
domain {
|
domain {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user