2022-09-06 19:24:40 +01:00
|
|
|
#! /bin/bash
|
|
|
|
|
|
|
|
export PATH="$HOME/.yarn/bin:$PATH"
|
2022-12-27 15:22:11 +00:00
|
|
|
export PATH="$HOME/.nodeuse/bin:$PATH"
|
2022-09-06 19:24:40 +01:00
|
|
|
|
2022-09-06 19:34:47 +01:00
|
|
|
export BOT_TOKEN=$(cat $HOME/scripts/vylbot/prod_key.txt)
|
|
|
|
|
2022-09-06 19:24:40 +01:00
|
|
|
cd ~/apps/vylbot/vylbot_prod \
|
|
|
|
&& git checkout main \
|
|
|
|
&& git fetch \
|
|
|
|
&& git pull \
|
2022-12-27 15:22:11 +00:00
|
|
|
&& docker compose --file docker-compose.prod.yml down \
|
2022-09-06 19:24:40 +01:00
|
|
|
&& (pm2 stop vylbot_prod || true) \
|
|
|
|
&& (pm2 delete vylbot_prod || true) \
|
|
|
|
&& cp .prod.env .env \
|
|
|
|
&& cp ormconfig.prod.json ormconfig.json \
|
2022-12-27 15:22:11 +00:00
|
|
|
&& yarn clean \
|
2022-09-06 19:24:40 +01:00
|
|
|
&& yarn install --frozen-lockfile \
|
|
|
|
&& yarn build \
|
2022-12-27 15:22:11 +00:00
|
|
|
&& docker compose --file docker-compose.prod.yml up -d \
|
2022-09-06 19:24:40 +01:00
|
|
|
&& echo "Sleeping for 10 seconds to let database load..." \
|
|
|
|
&& sleep 10 \
|
|
|
|
&& yarn run db:up \
|
2022-09-06 19:34:47 +01:00
|
|
|
&& NODE_ENV=production pm2 start --name vylbot_prod dist/vylbot.js
|