update supfile and deploy script for production

This commit is contained in:
Taka Goto 2018-09-20 16:02:47 -05:00
parent e138e58120
commit 4e490213b8
2 changed files with 21 additions and 10 deletions

27
Supfile
View File

@ -1,43 +1,49 @@
--- ---
version: 0.5 version: 0.5
networks: env:
staging:
env:
VDB_PATH: /root/go_projects/src/github.com/vulcanize/vulcanizedb VDB_PATH: /root/go_projects/src/github.com/vulcanize/vulcanizedb
VDB_PG_USER: vulcanize VDB_PG_USER: vulcanize
VDB_PG_PW: vulcanize VDB_PG_PW: vulcanize
networks:
staging:
hosts: hosts:
- root@147.75.96.51 - root@147.75.96.51
prod:
hosts:
- root@147.75.197.13
targets: targets:
deploy: deploy:
- remove - remove
- transfer - transfer
- migrate
- buildPostgraphile - buildPostgraphile
- buildVDB - buildVDB
- migrate
- lightSync - lightSync
- postgraphile - postgraphile
commands: commands:
remove: remove:
desc: remove old vulcanizedb desc: remove old vulcanizedb
run: rm -rf $VDB_PATH && rm -rf /usr/local/vulcanizedb && mkdir $VDB_PATH run: rm -rf $VDB_PATH && rm -rf /usr/local/vulcanizedb && mkdir -p $VDB_PATH
transfer: transfer:
desc: transfer repo to remote server desc: transfer repo to remote server
local: rsync -r . root@147.75.96.51:$VDB_PATH upload:
- src: .
dst: $VDB_PATH
migrate: migrate:
desc: run migration desc: run migration
run: > run: >
cd $VDB_PATH && cd $VDB_PATH &&
make installtools &&
/root/go_projects/bin/migrate -database postgresql://$VDB_PG_USER:$VDB_PG_PW@127.0.0.1:5432/vulcanize_public?sslmode=disable -path ./db/migrations up /root/go_projects/bin/migrate -database postgresql://$VDB_PG_USER:$VDB_PG_PW@127.0.0.1:5432/vulcanize_public?sslmode=disable -path ./db/migrations up
buildPostgraphile: buildPostgraphile:
desc: build postgraphile app desc: build postgraphile app
run: > run: >
cd $VDB_PATH/postgraphile && cd $VDB_PATH/postgraphile &&
yarn install && yarn && tsc
tsc
buildVDB: buildVDB:
desc: build vulcanizedb desc: build vulcanizedb
run: > run: >
@ -47,7 +53,10 @@ commands:
cp -r . /usr/local/vulcanizedb cp -r . /usr/local/vulcanizedb
lightSync: lightSync:
desc: start vdb light sync desc: start vdb light sync
run: systemctl daemon-reload && sudo systemctl restart vulcanizedb_light_sync.service && sudo systemctl restart vulcanizedb_log_sync.service run: >
systemctl daemon-reload &&
sudo systemctl restart vulcanizedb_light_sync.service &&
sudo systemctl restart vulcanizedb_log_sync.service
postgraphile: postgraphile:
desc: start postgraphile desc: start postgraphile
run: systemctl daemon-reload && sudo systemctl restart postgraphile.service run: systemctl daemon-reload && sudo systemctl restart postgraphile.service

View File

@ -1,3 +1,5 @@
if [ $TRAVIS_BRANCH == 'staging' ]; then if [ $TRAVIS_BRANCH == 'staging' ]; then
sup --debug staging deploy sup --debug staging deploy
elif [ $TRAVIS_BRANCH == 'master' ]; then
sup --debug prod deploy
fi fi