From b9380f9f20d9d7cf483287c8da9cbf0f48700dbd Mon Sep 17 00:00:00 2001 From: Tankred Hase Date: Mon, 14 Aug 2017 19:27:21 +0800 Subject: [PATCH 1/3] Add release npm script for travis deployment --- package.json | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 9d50215..db7a497 100644 --- a/package.json +++ b/package.json @@ -1,13 +1,13 @@ { "name": "mailvelope-keyserver", - "version": "1.2.6", + "version": "2.0.0", "license": "AGPL-3.0", "repository": { "type": "git", "url": "https://github.com/mailvelope/keyserver.git" }, "engines": { - "node": ">=6" + "node": ">=8" }, "scripts": { "start": ": ${NODE_ENV=development} && node index.js", @@ -15,7 +15,10 @@ "test:jshint": "jshint *.js src/**/*.js test/**/*.js", "test:jscs": "jscs *.js src/**/*.js test/**/*.js", "test:unit": "mocha --opts test/mocha.opts ./test/unit/", - "test:integration": "mocha --opts test/mocha.opts ./test/integration" + "test:integration": "mocha --opts test/mocha.opts ./test/integration", + "release": "npm run release:install && npm run release:archive", + "release:install": "rm -rf node_modules/ && npm install --production", + "release:archive": "zip -rq release.zip package.json package-lock.json node_modules/ *.js src/ config/" }, "dependencies": { "addressparser": "^1.0.1", From bbf24d6c53bf3347a27fc944a643091f24791f2c Mon Sep 17 00:00:00 2001 From: Tankred Hase Date: Mon, 14 Aug 2017 19:29:16 +0800 Subject: [PATCH 2/3] Add AWS Elastic Beanstalk deployment plugin to travis config Run npm release script before deployment Upgrade to node v8 in travis job --- .travis.yml | 32 +++++++++++++++++++++++++++----- 1 file changed, 27 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index c2c4e5f..ef916cd 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,13 +1,35 @@ sudo: false language: node_js node_js: - - "6" -before_script: - - mongo test_db --eval 'db.addUser("travis", "test");' + - "8" + +env: + - NODE_ENV=integration MONGO_URI=127.0.0.1:27017/test_db MONGO_USER=travis MONGO_PASS=test + notifications: email: - build@mailvelope.com + services: - mongodb -env: - - NODE_ENV=integration MONGO_URI=127.0.0.1:27017/test_db MONGO_USER=travis MONGO_PASS=test \ No newline at end of file + +before_script: + - mongo test_db --eval 'db.addUser("travis", "test");' + +before_deploy: + - npm run release + +deploy: + skip_cleanup: true + provider: elasticbeanstalk + access_key_id: $AWS_ACCESS_KEY + secret_access_key: $AWS_SECRET_ACCESS_KEY + region: eu-west-1 + app: keyserver + env: keyserver-prod + zip_file: release.zip + bucket_name: elasticbeanstalk-eu-west-1-936909551620 + bucket_path: keyserver + on: + repo: mailvelope/keyserver + branch: master From 7800dafce323e880cade3a22f3f0c60bcebe2a6b Mon Sep 17 00:00:00 2001 From: Tankred Hase Date: Mon, 14 Aug 2017 19:30:23 +0800 Subject: [PATCH 3/3] Remove .elasticbeanstalk/config.yml and shell script for local deployment --- .elasticbeanstalk/config.yml | 12 ---------- res/aws_release.sh | 43 ------------------------------------ 2 files changed, 55 deletions(-) delete mode 100644 .elasticbeanstalk/config.yml delete mode 100755 res/aws_release.sh diff --git a/.elasticbeanstalk/config.yml b/.elasticbeanstalk/config.yml deleted file mode 100644 index 6ac17fc..0000000 --- a/.elasticbeanstalk/config.yml +++ /dev/null @@ -1,12 +0,0 @@ -branch-defaults: - release/prod: - environment: keyserver-prod - release/test: - environment: keyserver-test -global: - application_name: keyserver - default_ec2_keyname: null - default_platform: Node.js - default_region: eu-west-1 - profile: eb-cli - sc: git diff --git a/res/aws_release.sh b/res/aws_release.sh deleted file mode 100755 index 8d9d109..0000000 --- a/res/aws_release.sh +++ /dev/null @@ -1,43 +0,0 @@ -#!/bin/sh - -# go to root -cd `dirname $0` -cd .. - -if [ "$1" != "prod" ] && [ "$1" != "test" ] ; then - echo 'Usage: ./res/aws_release prod|test' - exit 0 -fi - -# switch branch -git checkout master -git branch -D release/$1 -git checkout -b release/$1 -git merge master --no-edit - -# abort if tests fail -set -e - -# build and test -rm -rf node_modules -npm install -npm test - -# install only production dependencies -rm -rf node_modules/ -npm install --production - -# delete .gitignore files before adding to git for aws deployment -find node_modules/ -name ".gitignore" -exec rm -rf {} \; - -# Add runtime dependencies to git -sed -i "" '/node_modules/d' .gitignore -git add .gitignore node_modules/ -git commit -m "Update release" - -# push to aws -eb deploy keyserver-$1 - -# switch back to master branch -git checkout master -npm install