From 4e490213b8c3bff9851d8ff816dbeccb0d3729fd Mon Sep 17 00:00:00 2001 From: Taka Goto Date: Thu, 20 Sep 2018 16:02:47 -0500 Subject: [PATCH] update supfile and deploy script for production --- Supfile | 29 +++++++++++++++++++---------- bin/deploy.sh | 2 ++ 2 files changed, 21 insertions(+), 10 deletions(-) diff --git a/Supfile b/Supfile index cc8cafa6..ba558f76 100644 --- a/Supfile +++ b/Supfile @@ -1,43 +1,49 @@ --- version: 0.5 +env: + VDB_PATH: /root/go_projects/src/github.com/vulcanize/vulcanizedb + VDB_PG_USER: vulcanize + VDB_PG_PW: vulcanize + networks: staging: - env: - VDB_PATH: /root/go_projects/src/github.com/vulcanize/vulcanizedb - VDB_PG_USER: vulcanize - VDB_PG_PW: vulcanize hosts: - root@147.75.96.51 + prod: + hosts: + - root@147.75.197.13 targets: deploy: - remove - transfer - - migrate - buildPostgraphile - buildVDB + - migrate - lightSync - postgraphile commands: remove: 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: desc: transfer repo to remote server - local: rsync -r . root@147.75.96.51:$VDB_PATH + upload: + - src: . + dst: $VDB_PATH migrate: desc: run migration run: > 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 buildPostgraphile: desc: build postgraphile app run: > cd $VDB_PATH/postgraphile && - yarn install && - tsc + yarn && tsc buildVDB: desc: build vulcanizedb run: > @@ -47,7 +53,10 @@ commands: cp -r . /usr/local/vulcanizedb lightSync: 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: desc: start postgraphile run: systemctl daemon-reload && sudo systemctl restart postgraphile.service diff --git a/bin/deploy.sh b/bin/deploy.sh index 8bf6dbd1..1d1a4dd9 100755 --- a/bin/deploy.sh +++ b/bin/deploy.sh @@ -1,3 +1,5 @@ if [ $TRAVIS_BRANCH == 'staging' ]; then sup --debug staging deploy +elif [ $TRAVIS_BRANCH == 'master' ]; then + sup --debug prod deploy fi