Closed TylerFisher closed 3 years ago
Okay, I think I've figured out how to do this. I've borrowed much of the specifics of the approach to the example the webiny folks mentioned.
tinynewsplatform-state-bucket-prod
tinynewsplatform-environment-bucket-prod
prod
with actual $ENVIRONMENT
aws s3 cp api/.env.json "s3://tinynewsplatform-environment-bucket-prod/api.env.json"
aws s3 cp .env.json "s3://tinynewsplatform-environment-bucket-prod/root.env.json"
aws s3 cp .webiny s3://tinynewsplatform-state-bucket-prod/ --recursive
aws s3 cp s3://tinynewsplatform-state-bucket-prod/ .webiny --recursive
aws s3 cp "s3://tinynewsplatform-environment-bucket-prod/api.env.json" api/.env.json
aws s3 cp "s3://tinynewsplatform-environment-bucket-prod/root.env.json" .env.json
yarn
answer: probably a good idea to run it if only to catch any errors, updates
yarn webiny deploy api --env=prod
# replace prod
with actual $ENVIRONMENT
aws s3 cp api/.env.json "s3://tinynewsplatform-environment-bucket-prod/api.env.json"
aws s3 cp .env.json "s3://tinynewsplatform-environment-bucket-prod/root.env.json"
aws s3 cp .webiny s3://tinynewsplatform-state-bucket-prod/ --recursive
setup
: create 2 private s3 buckets; initial push of filesdeploy
: download files from s3; yarn; yarn webiny deploy; upload files to s3
In order to predictably keep the same deployment locations for different environments, we should sync the deployment state to an S3 bucket as part of the deployment process.
This probably means writing a custom script that:
This functionality could also work as part of a CI integration like Github Actions. That's probably a good idea for the future, but let's make sure this S3 sync idea works first.