Skip to content

Commit

Permalink
console: add gzip compression to deployments (hasura#94)
Browse files Browse the repository at this point in the history
  • Loading branch information
praveenweb authored and shahidhk committed Jul 11, 2018
1 parent 57f9bfc commit 6826cec
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
3 changes: 2 additions & 1 deletion .circleci/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ deploy_console() {
cd "$ROOT/console"
export VERSION=$(../scripts/get-version-circleci.sh)
export DIST_PATH="/build/_console_output"
make gzip-assets
make gcloud-cp-stable
make gcloud-set-metadata
unset VERSION
Expand Down Expand Up @@ -69,4 +70,4 @@ deploy_console
deploy_server
if [[ ! -z "$CIRCLE_TAG" ]]; then
draft_github_release
fi
fi
11 changes: 9 additions & 2 deletions console/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ DIST_PATH ?= ./static/dist
BUCKET_NAME ?= hasura-graphql-engine
VERSION ?= $(shell ../scripts/get-version.sh)

all: deps build gcloud-cp-stable gcloud-set-metadata
all: deps build gzip-assets gcloud-cp-stable gcloud-set-metadata

deps:
npm install
Expand All @@ -17,6 +17,13 @@ build:
test:
npm run dev & npm run test

gzip-assets:
gzip $(DIST_PATH)/*.js
gzip $(DIST_PATH)/*.css
mv $(DIST_PATH)/main.js.gz $(DIST_PATH)/main.js
mv $(DIST_PATH)/vendor.js.gz $(DIST_PATH)/vendor.js
mv $(DIST_PATH)/main.css.gz $(DIST_PATH)/main.css

# to be run inside circle-ci
ci-copy-assets:
mkdir -p /build/_console_output
Expand All @@ -31,4 +38,4 @@ gcloud-cp-stable:
gcloud-set-metadata:
gsutil setmeta -h "Content-Type: application/javascript" gs://$(BUCKET_NAME)/console/$(VERSION)/*.js
gsutil setmeta -h "Content-Type: text/css" gs://$(BUCKET_NAME)/console/$(VERSION)/*.css
#gsutil setmeta -h "Content-Encoding: gzip" gs:// + $(BUCKET_NAME) + '/console/' + $(VERSION) + '/*'
gsutil setmeta -h "Content-Encoding: gzip" gs://$(BUCKET_NAME)/console/$(VERSION)/*

0 comments on commit 6826cec

Please sign in to comment.