-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathdeploy.sh
More file actions
executable file
·39 lines (30 loc) · 1.15 KB
/
deploy.sh
File metadata and controls
executable file
·39 lines (30 loc) · 1.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/usr/bin/env bash
read -p "Did you run all unit tests? [y/n] " -n 1 -r
echo
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
echo "Stopping so you can run unit tests and make sure they all pass."
exit 0
fi
set -x
DEPLOYTO="${1:-/var/www/html/materialscommons}"
echo "Deploying to ${DEPLOYTO}"
DEPLOY_DATE=$(date +'%Y-%m-%dT%H:%M:%S.%Z')
CURRENT_VERSION=$(grep MC_SERVER_VERSION .env | sed 's/MC_SERVER_VERSION=//')
cp .env .env.save
LAST_VERSION_NUMBER=$(echo $CURRENT_VERSION | cut -d. -f3)
NEXT_V=$(($LAST_VERSION_NUMBER + 1))
FIRST_V=$(echo $CURRENT_VERSION | cut -d. -f1)
SECOND_V=$(echo $CURRENT_VERSION | cut -d. -f2)
cat .env | grep -v MC_SERVER_VERSION | grep -v MC_SERVER_LAST_UPDATED_AT >.env.tmp
echo "MC_SERVER_LAST_UPDATED_AT=${DEPLOY_DATE}" >>.env.tmp
echo "MC_SERVER_VERSION=${FIRST_V}.${SECOND_V}.${NEXT_V}" >>.env.tmp
mv .env.tmp .env
npm run prod
sudo ./deploy2.sh ${DEPLOYTO}
NGINXUSERACC="${NGINXUSER:-nginx}"
sudo chown -R $NGINXUSERACC:$NGINXUSERACC ${DEPLOYTO}
SUPERVISORSERVICENAME="${SUPERVISORSERVICE:-supervisord}"
#sudo systemctl status ${SUPERVISORSERVICENAME}
php artisan queue:restart
#sleep 5
#sudo systemctl status ${SUPERVISORSERVICENAME}