Skip to content

Instantly share code, notes, and snippets.

@tdrach
Last active January 30, 2020 17:59
Show Gist options
  • Save tdrach/dd2db94ba490ff34376257bad05a4f23 to your computer and use it in GitHub Desktop.
Save tdrach/dd2db94ba490ff34376257bad05a4f23 to your computer and use it in GitHub Desktop.
Previous setup for testing and deploying Cleverstack

Initial Setup

$ yarn
$ change-java-version 8

change-java-version was a command in Semaphore I used that allowed node-sass to compile correctly without errors.

Test run

$ yarn test
$ yarn lint

If this is good to go, checks pass!

Deployment

S3_BUCKET_NAME : cs-staging-frontend
S3_INDEX_DOC : index.html
S3_DIRECTORY : ././dist
AWS_DEFAULT_REGION : us-west-2
AWS_SECRET_ACCESS_KEY : XXX
AWS_ACCESS_KEY_ID : XXX

ENV vars for staging (only the S3_BUCKET_NAME changes for prod)

yarn 
yarn build-staging
aws s3 sync $S3_DIRECTORY s3://$S3_BUCKET_NAME/ --acl=public-read --delete --exclude '.git/*'
aws configure set preview.cloudfront true
aws cloudfront create-invalidation --distribution-id $CLOUDFRONT_DIST --paths /index.html
aws s3 sync $S3_DIRECTORY s3://$S3_BUCKET_NAME/ --acl=public-read --delete --exclude '.git/*'

This deploys to staging!

Promoting to production

Currently, what we've been doing, is the above... Then after playing with it on staging, manually promoting it to production.

For this, we basically used a button that did the same as above, but made the S3_BUCKET_NAME the production bucket, and used yarn build

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment