From bb8853bfe2d506639f97e707331a61121e4dbf15 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Se=CC=81rgio=20Ramos?= Date: Tue, 21 Mar 2017 14:41:30 +0000 Subject: [PATCH] setup staging deploy fixes #368 --- bin/deploy | 4 +- circle.yml | 18 +++-- cloudapi-graphql/Makefile | 2 +- docker-compose.yml | 8 +- docs/Makefile | 8 +- frontend/.dockerignore | 151 ++++++++++++++++++++++++++++++++++++++ frontend/Makefile | 2 +- ui/Makefile | 2 +- 8 files changed, 174 insertions(+), 21 deletions(-) create mode 100644 frontend/.dockerignore diff --git a/bin/deploy b/bin/deploy index 2c42cfc1..9d442501 100755 --- a/bin/deploy +++ b/bin/deploy @@ -6,7 +6,7 @@ # set -euo pipefail -# Beware of CDPATH gotchas causing cd not to work correctly when a user +# Beware of CDPATH gotchas causing cd not to work correctly when a user # has set this in their environment # https://bosker.wordpress.com/2012/02/12/bash-scripters-beware-of-the-cdpath/ unset CDPATH @@ -27,4 +27,4 @@ export DOCKER_CERT_PATH=$_DOCKER_CERT_PATH export DOCKER_TLS_VERIFY= docker-compose pull -docker-compose up -d +COMPOSE_PROJECT_NAME=$(CIRCLE_BRANCH) docker-compose up -d diff --git a/circle.yml b/circle.yml index 2b402c16..fa35b270 100644 --- a/circle.yml +++ b/circle.yml @@ -8,7 +8,7 @@ machine: services: - docker node: - version: 6.9.3 + version: 7.7.3 dependencies: pre: @@ -33,7 +33,7 @@ test: - make -j2 lint-ci test-ci deployment: - production: # just a label; label names are completely up to you + development: branch: master commands: - ./bin/docker-login @@ -41,9 +41,11 @@ deployment: - make -j2 build - make -j2 push - ./bin/deploy - -## Custom notifications -# notify: -# webhooks: -# # A list of hashes representing hooks. Only the url field is supported. -# - url: https://someurl.com/hooks/circle + staging: + branch: staging + commands: + - ./bin/docker-login + - ./bin/on-changes-publish-ui + - make -j2 build + - make -j2 push + - ./bin/deploy diff --git a/cloudapi-graphql/Makefile b/cloudapi-graphql/Makefile index f4312ebe..6630cdfe 100644 --- a/cloudapi-graphql/Makefile +++ b/cloudapi-graphql/Makefile @@ -34,7 +34,7 @@ start: .PHONY: build build: - docker build -t quay.io/yldio/joyent-dashboard-$(NAME) . + docker build -t quay.io/yldio/joyent-dashboard-$(NAME):$(CIRCLE_BRANCH) . .PHONY: push push: diff --git a/docker-compose.yml b/docker-compose.yml index 328cea21..a1a4a88e 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -27,7 +27,7 @@ consul: # CloudAPI GraphQL ############################################################################# cloudapi: - image: quay.io/yldio/joyent-dashboard-cloudapi-graphql:latest + image: quay.io/yldio/joyent-dashboard-cloudapi-graphql:$CIRCLE_BRANCH mem_limit: 128m labels: - triton.cns.services=cloudapi @@ -42,7 +42,7 @@ cloudapi: # Frontend ############################################################################# frontend: - image: quay.io/yldio/joyent-dashboard-frontend:latest + image: quay.io/yldio/joyent-dashboard-frontend:$CIRCLE_BRANCH mem_limit: 512m labels: - triton.cns.services=frontend @@ -57,7 +57,7 @@ frontend: # UI ############################################################################# ui: - image: quay.io/yldio/joyent-dashboard-ui:latest + image: quay.io/yldio/joyent-dashboard-ui:$CIRCLE_BRANCH mem_limit: 512m labels: - triton.cns.services=ui @@ -101,7 +101,7 @@ prometheus: # it is included here for demo purposes and is not required ############################################################################# docs: - image: quay.io/yldio/joyent-portal-docs + image: quay.io/yldio/joyent-portal-docs:$CIRCLE_BRANCH restart: always mem_limit: 128m env_file: .env diff --git a/docs/Makefile b/docs/Makefile index 532f2e54..5f1c9c15 100644 --- a/docs/Makefile +++ b/docs/Makefile @@ -22,12 +22,12 @@ help: .PHONY: build build: - docker build -t quay.io/yldio/joyent-portal-$(NAME) . + docker build -t quay.io/yldio/joyent-portal-$(NAME):$(CIRCLE_BRANCH) . .PHONY: push push: docker push quay.io/yldio/joyent-portal-$(NAME) - + .PHONY: test test: @@ -35,13 +35,13 @@ test: test-ci: .PHONY: install -install: +install: .PHONY: start start: .PHONY: install-production -install-production: +install-production: .PHONY: clean clean: diff --git a/frontend/.dockerignore b/frontend/.dockerignore new file mode 100644 index 00000000..df4dcbab --- /dev/null +++ b/frontend/.dockerignore @@ -0,0 +1,151 @@ +### Bower ### +bower_components +.bower-cache +.bower-registry +.bower-tmp + + +### Git ### +*.orig + + +### macOS ### +*.DS_Store +.AppleDouble +.LSOverride + +# Thumbnails +._* +# Files that might appear in the root of a volume +.DocumentRevisions-V100 +.fseventsd +.Spotlight-V100 +.TemporaryItems +.Trashes +.VolumeIcon.icns +.com.apple.timemachine.donotpresent +# Directories potentially created on remote AFP share +.AppleDB +.AppleDesktop +Network Trash Folder +Temporary Items +.apdisk + + +### Node ### +# Logs +logs +*.log +npm-debug.log* + +# Runtime data +pids +*.pid +*.seed +*.pid.lock + +# Directory for instrumented libs generated by jscoverage/JSCover +lib-cov + +# Coverage directory used by tools like istanbul +coverage + +# nyc test coverage +.nyc_output + +# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) +.grunt + +# node-waf configuration +.lock-wscript + +# Compiled binary addons (http://nodejs.org/api/addons.html) +build/Release + +# Dependency directories +node_modules +jspm_packages + +# Optional npm cache directory +.npm + +# Optional eslint cache +.eslintcache + +# Optional REPL history +.node_repl_history + +# Output of 'npm pack' +*.tgz + + +### SublimeText ### +# cache files for sublime text +*.tmlanguage.cache +*.tmPreferences.cache +*.stTheme.cache + +# workspace files are user-specific +*.sublime-workspace + +# project files should be checked into the repository, unless a significant +# proportion of contributors will probably not be using SublimeText +# *.sublime-project + +# sftp configuration file +sftp-config.json + +# Package control specific files +Package Control.last-run +Package Control.ca-list +Package Control.ca-bundle +Package Control.system-ca-bundle +Package Control.cache/ +Package Control.ca-certs/ +bh_unicode_properties.cache + +# Sublime-github package stores a github token in this file +# https://packagecontrol.io/packages/sublime-github +GitHub.sublime-settings + + +### Vim ### +# swap +[._]*.s[a-w][a-z] +[._]s[a-w][a-z] +# session +Session.vim +# temporary +.netrwhist +*~ +# auto-generated tag files +tags + + +### Windows ### +# Windows image file caches +Thumbs.db +ehthumbs.db + +# Folder config file +Desktop.ini + +# Recycle Bin used on file shares +$RECYCLE.BIN/ + +# Windows Installer files +*.cab +*.msi +*.msm +*.msp + +# Windows shortcuts +*.lnk + + +### Application Specific ### +.env + +# PostCSS +*.postcss.js + diff --git a/frontend/Makefile b/frontend/Makefile index 5f485e79..1ab20055 100644 --- a/frontend/Makefile +++ b/frontend/Makefile @@ -45,7 +45,7 @@ endif .PHONY: build build: - docker build -t quay.io/yldio/joyent-dashboard-$(NAME) . + docker build -t quay.io/yldio/joyent-dashboard-$(NAME):$(CIRCLE_BRANCH) . .PHONY: push push: diff --git a/ui/Makefile b/ui/Makefile index 7391ac8c..6549b603 100644 --- a/ui/Makefile +++ b/ui/Makefile @@ -46,7 +46,7 @@ compile: install .PHONY: build build: - docker build -t quay.io/yldio/joyent-dashboard-$(NAME) . + docker build -t quay.io/yldio/joyent-dashboard-$(NAME):$(CIRCLE_BRANCH) . .PHONY: push push: