Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Make deployment scripts handle multi-environment deployment #140

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from

Conversation

KlaasH
Copy link
Collaborator

@KlaasH KlaasH commented Aug 4, 2019

Overview

The existing deployment setup relied on single .env, .api-id and claudia.json files, so supporting multiple environments required shuffling different copies around and copying them onto those filenames, which incurs risk of confusion and error.

This uses the upcoming --env-file option for docker-compose to use the same basic .env-based deployment but make it support multiple remote environments.

This PR is WIP and not ready for merging because the --env-file option for docker-compose is in the v1.25 release candidate but not yet in a released version.

Also WIP because I need to revise the README to reflect these changes.

Demo

TK

Notes

  • The changes include making Terraform use separate tfstate files by environment. But the storage backend is still local (the default), not S3. The tfstate file is important to keep. Without it, Terraform doesn't know how to find the existing CloudFront distribution, so it will make a new one. So if this were going to be used in a situation where multiple people might deploy it, it would need to be switched to S3-backed, or some other way of sharing the tfstate files would need to be set up.

Testing Instructions

TK

Related to #129 (comment)

KlaasH added 4 commits August 3, 2019 22:29
Sets up the docker-compose config and deployment scripts to take advantage
of the new (or impending) docker-compose `--env-file` option. Creating a
.env.ENVIRON file then passing the name of the environment to `scripts/deploy`
should read that environment file into the project environment.
All the variables needed inside the tiler container have to be listed in
it's `environment` so they get passed through.

Adds a checked-in .env.local file, with credentials for the test database.
It doesn't need any of the Lambda or project variables, since it's local.
Changes the deployment-related scripts to expect an argument for which
environment to deploy. They'll look for a `.env.ENVIRON` file to set the
environment variables and will create claudia-ENVIRON.json and
.api-id-ENVIRON files rather than always using the same unqualified names.

Using separate claudia.json files means the config file is now given as
an argument, rather than using the default, and they go in a subdirectory.
Changes the terraform deployment steps to use local tfplan and tfstate
files to keep track of separate environments. The "local" backend is
the default, but specifying it explicitly enables specifying parameters
for it, i.e. the ENVIRON-based filenames to use.

This also switches from using `plan -auto-apply` to doing separate plan
and apply commands, though they're still within the same `publish` script.
The behavior will end up the same, but it now gives you 10 seconds to
bail out if the plan looks weird, rather than applying it as soon as it's
calculated.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant