Merge pull request #38 from mailvelope/dev/travis-aws-deploy
Dev/travis aws deploy
This commit is contained in:
commit
f224f32e66
@ -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
|
32
.travis.yml
32
.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
|
||||
|
||||
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
|
||||
|
@ -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",
|
||||
|
@ -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
|
Loading…
Reference in New Issue
Block a user