Merge pull request #38 from mailvelope/dev/travis-aws-deploy

Dev/travis aws deploy
This commit is contained in:
Tankred Hase 2017-08-14 19:34:27 +08:00 committed by GitHub
commit f224f32e66
4 changed files with 33 additions and 63 deletions

View File

@ -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

View File

@ -1,13 +1,35 @@
sudo: false sudo: false
language: node_js language: node_js
node_js: node_js:
- "6" - "8"
before_script:
- mongo test_db --eval 'db.addUser("travis", "test");' env:
- NODE_ENV=integration MONGO_URI=127.0.0.1:27017/test_db MONGO_USER=travis MONGO_PASS=test
notifications: notifications:
email: email:
- build@mailvelope.com - build@mailvelope.com
services: services:
- mongodb - mongodb
env:
- NODE_ENV=integration MONGO_URI=127.0.0.1:27017/test_db MONGO_USER=travis MONGO_PASS=test 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

View File

@ -1,13 +1,13 @@
{ {
"name": "mailvelope-keyserver", "name": "mailvelope-keyserver",
"version": "1.2.6", "version": "2.0.0",
"license": "AGPL-3.0", "license": "AGPL-3.0",
"repository": { "repository": {
"type": "git", "type": "git",
"url": "https://github.com/mailvelope/keyserver.git" "url": "https://github.com/mailvelope/keyserver.git"
}, },
"engines": { "engines": {
"node": ">=6" "node": ">=8"
}, },
"scripts": { "scripts": {
"start": ": ${NODE_ENV=development} && node index.js", "start": ": ${NODE_ENV=development} && node index.js",
@ -15,7 +15,10 @@
"test:jshint": "jshint *.js src/**/*.js test/**/*.js", "test:jshint": "jshint *.js src/**/*.js test/**/*.js",
"test:jscs": "jscs *.js src/**/*.js test/**/*.js", "test:jscs": "jscs *.js src/**/*.js test/**/*.js",
"test:unit": "mocha --opts test/mocha.opts ./test/unit/", "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": { "dependencies": {
"addressparser": "^1.0.1", "addressparser": "^1.0.1",

View File

@ -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