From 54638ad2e741108ee980563f7cb537b2a7a36f35 Mon Sep 17 00:00:00 2001 From: Chris Hill-Scott Date: Tue, 18 Dec 2018 11:41:39 +0000 Subject: [PATCH] Copy static files to S3 when deploying MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit We have a nasty bug where Cloudfront is caching old files against new URLs because the new code rolls out gradually across the ~10 admin instances we have in production. The way we are going to fix this is by pointing Cloudfront at S3, which doesn’t have the concept of ‘instances’. This commit does the work to copy the files to the new buckets. It depends on the beuckets being set up. --- Makefile | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 56c087f32..ccbc9f706 100644 --- a/Makefile +++ b/Makefile @@ -97,6 +97,10 @@ upload-paas-artifact: $(if ${JENKINS_S3_BUCKET},,$(error Must specify JENKINS_S3_BUCKET)) aws s3 cp --region eu-west-1 --sse AES256 target/notifications-admin.zip s3://${JENKINS_S3_BUCKET}/build/notifications-admin/${DEPLOY_BUILD_NUMBER}.zip +.PHONY: upload-static ## Upload the static files to be served from S3 +upload-static: + aws s3 cp --region eu-west-1 --recursive ./app/static s3://${DNS_NAME}-static + .PHONY: test test: venv ## Run tests ./scripts/run_tests.sh @@ -199,7 +203,7 @@ generate-manifest: <(${DECRYPT_CMD} ${NOTIFY_CREDENTIALS}/credentials/${CF_SPACE}/paas/environment-variables.gpg) .PHONY: cf-deploy -cf-deploy: ## Deploys the app to Cloud Foundry +cf-deploy: upload-static ## Deploys the app to Cloud Foundry $(if ${CF_SPACE},,$(error Must specify CF_SPACE)) @cf app --guid notify-admin || exit 1 cf rename notify-admin notify-admin-rollback