-
Notifications
You must be signed in to change notification settings - Fork 31
Expand file tree
/
Copy pathdeploy.sh
More file actions
23 lines (23 loc) · 859 Bytes
/
deploy.sh
File metadata and controls
23 lines (23 loc) · 859 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/bin/bash
if [ $(hostname) = ximera-1.asc.ohio-state.edu ]; then
echo On the deployment machine.
echo Pulling latest version from github, protecting our dotenv...
mv -f .env .env.backup
git pull
mv -f .env.backup .env
echo Updating npm...
npm install
echo Running gulp...
node ./node_modules/gulp/bin/gulp.js js
node ./node_modules/gulp/bin/gulp.js service-worker
node ./node_modules/gulp/bin/gulp.js css
echo Stopping old copies of app.js...
pm2 stop ximera
echo Starting a new copy of app.js...
pm2 start ecosystem.config.js --env production
else
echo not on the deployment machine...
echo copying environment and keys to deployment machine...
rsync -avz -f"- .git/" private_key.pem .env ximera:/var/www/apps/ximera
ssh ximera "cd /var/www/apps/ximera ; source deploy.sh"
fi