Create scripts
This commit is contained in:
parent
cd666d24fd
commit
c8b7848351
11 changed files with 197 additions and 6 deletions
16
.dev.env
Normal file
16
.dev.env
Normal file
|
@ -0,0 +1,16 @@
|
|||
# Security Warning! Do not commit this file to any VCS!
|
||||
# This is a local file to speed up development process,
|
||||
# so you don't have to change your environment variables.
|
||||
#
|
||||
# This is not applied to `.env.template`!
|
||||
# Template files must be committed to the VCS, but must not contain
|
||||
# any secret values.
|
||||
|
||||
BOT_TOKEN=
|
||||
BOT_VER=DEV
|
||||
BOT_AUTHOR=Vylpes
|
||||
BOT_DATE=DEV
|
||||
BOT_OWNERID=147392775707426816
|
||||
|
||||
ABOUT_FUNDING=https://ko-fi.com/vylpes
|
||||
ABOUT_REPO=https://github.com/vylpes/vylbot-app
|
|
@ -9,8 +9,8 @@
|
|||
BOT_TOKEN=
|
||||
BOT_VER=3.1
|
||||
BOT_AUTHOR=Vylpes
|
||||
BOT_DATE=04 Sep 2022
|
||||
BOT_DATE=05 Sep 2022
|
||||
BOT_OWNERID=147392775707426816
|
||||
|
||||
ABOUT_FUNDING=
|
||||
ABOUT_REPO=
|
||||
ABOUT_FUNDING=https://ko-fi.com/vylpes
|
||||
ABOUT_REPO=https://github.com/vylpes/vylbot-app
|
16
.stage.env
Normal file
16
.stage.env
Normal file
|
@ -0,0 +1,16 @@
|
|||
# Security Warning! Do not commit this file to any VCS!
|
||||
# This is a local file to speed up development process,
|
||||
# so you don't have to change your environment variables.
|
||||
#
|
||||
# This is not applied to `.env.template`!
|
||||
# Template files must be committed to the VCS, but must not contain
|
||||
# any secret values.
|
||||
|
||||
BOT_TOKEN=
|
||||
BOT_VER=3.1
|
||||
BOT_AUTHOR=Vylpes
|
||||
BOT_DATE=05 Sep 2022
|
||||
BOT_OWNERID=147392775707426816
|
||||
|
||||
ABOUT_FUNDING=https://ko-fi.com/vylpes
|
||||
ABOUT_REPO=https://github.com/vylpes/vylbot-app
|
31
docker-compose.prod.yml
Normal file
31
docker-compose.prod.yml
Normal file
|
@ -0,0 +1,31 @@
|
|||
version: "3.9"
|
||||
|
||||
volumes:
|
||||
prod_database_data:
|
||||
|
||||
services:
|
||||
# discord:
|
||||
# build: .
|
||||
|
||||
database:
|
||||
image: mysql/mysql-server
|
||||
command: --default-authentication-plugin=mysql_native_password
|
||||
restart: always
|
||||
environment:
|
||||
- MYSQL_DATABASE=vylbot
|
||||
- MYSQL_USER=prod
|
||||
- MYSQL_PASSWORD=prod
|
||||
- MYSQL_ROOT_PASSWORD=root
|
||||
- MYSQL_ROOT_HOST=0.0.0.0
|
||||
ports:
|
||||
- "3121:3306"
|
||||
volumes:
|
||||
- prod_database_data:/var/lib/mysql
|
||||
|
||||
phpmyadmin:
|
||||
image: phpmyadmin
|
||||
restart: always
|
||||
ports:
|
||||
- "3122:80"
|
||||
environment:
|
||||
- PMA_ARBITRARY=1
|
31
docker-compose.stage.yml
Normal file
31
docker-compose.stage.yml
Normal file
|
@ -0,0 +1,31 @@
|
|||
version: "3.9"
|
||||
|
||||
volumes:
|
||||
stage_database_data:
|
||||
|
||||
services:
|
||||
# discord:
|
||||
# build: .
|
||||
|
||||
database:
|
||||
image: mysql/mysql-server
|
||||
command: --default-authentication-plugin=mysql_native_password
|
||||
restart: always
|
||||
environment:
|
||||
- MYSQL_DATABASE=vylbot
|
||||
- MYSQL_USER=stage
|
||||
- MYSQL_PASSWORD=stage
|
||||
- MYSQL_ROOT_PASSWORD=root
|
||||
- MYSQL_ROOT_HOST=0.0.0.0
|
||||
ports:
|
||||
- "3111:3306"
|
||||
volumes:
|
||||
- stage_database_data:/var/lib/mysql
|
||||
|
||||
phpmyadmin:
|
||||
image: phpmyadmin
|
||||
restart: always
|
||||
ports:
|
||||
- "3112:80"
|
||||
environment:
|
||||
- PMA_ARBITRARY=1
|
|
@ -1,4 +1,8 @@
|
|||
version: "3.9"
|
||||
|
||||
volumes:
|
||||
dev_database_data:
|
||||
|
||||
services:
|
||||
# discord:
|
||||
# build: .
|
||||
|
@ -12,13 +16,16 @@ services:
|
|||
- MYSQL_USER=dev
|
||||
- MYSQL_PASSWORD=dev
|
||||
- MYSQL_ROOT_PASSWORD=root
|
||||
- MYSQL_ROOT_HOST=0.0.0.0
|
||||
ports:
|
||||
- 3306:3306
|
||||
- "3101:3306"
|
||||
volumes:
|
||||
- dev_database_data:/var/lib/mysql
|
||||
|
||||
phpmyadmin:
|
||||
image: phpmyadmin
|
||||
restart: always
|
||||
ports:
|
||||
- 8080:80
|
||||
- "3102:80"
|
||||
environment:
|
||||
- PMA_ARBITRARY=1
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"type": "mysql",
|
||||
"host": "localhost",
|
||||
"port": 3306,
|
||||
"port": 3101,
|
||||
"username": "dev",
|
||||
"password": "dev",
|
||||
"database": "vylbot",
|
24
ormconfig.prod.json
Normal file
24
ormconfig.prod.json
Normal file
|
@ -0,0 +1,24 @@
|
|||
{
|
||||
"type": "mysql",
|
||||
"host": "localhost",
|
||||
"port": 3121,
|
||||
"username": "prod",
|
||||
"password": "prod",
|
||||
"database": "vylbot",
|
||||
"synchronize": false,
|
||||
"logging": false,
|
||||
"entities": [
|
||||
"dist/entity/**/*.js"
|
||||
],
|
||||
"migrations": [
|
||||
"dist/migration/**/*.js"
|
||||
],
|
||||
"subscribers": [
|
||||
"dist/subscriber/**/*.js"
|
||||
],
|
||||
"cli": {
|
||||
"entitiesDir": "dist/entity",
|
||||
"migrationsDir": "dist/migration",
|
||||
"subscribersDir": "dist/subscriber"
|
||||
}
|
||||
}
|
24
ormconfig.stage.json
Normal file
24
ormconfig.stage.json
Normal file
|
@ -0,0 +1,24 @@
|
|||
{
|
||||
"type": "mysql",
|
||||
"host": "localhost",
|
||||
"port": 3111,
|
||||
"username": "stage",
|
||||
"password": "stage",
|
||||
"database": "vylbot",
|
||||
"synchronize": false,
|
||||
"logging": false,
|
||||
"entities": [
|
||||
"dist/entity/**/*.js"
|
||||
],
|
||||
"migrations": [
|
||||
"dist/migration/**/*.js"
|
||||
],
|
||||
"subscribers": [
|
||||
"dist/subscriber/**/*.js"
|
||||
],
|
||||
"cli": {
|
||||
"entitiesDir": "dist/entity",
|
||||
"migrationsDir": "dist/migration",
|
||||
"subscribersDir": "dist/subscriber"
|
||||
}
|
||||
}
|
21
scripts/deploy_prod.sh
Normal file
21
scripts/deploy_prod.sh
Normal file
|
@ -0,0 +1,21 @@
|
|||
#! /bin/bash
|
||||
|
||||
export PATH="$HOME/.yarn/bin:$PATH"
|
||||
export PATH="$HOME/.nvm/versions/node/v16.17.0/bin/:$PATH"
|
||||
|
||||
cd ~/apps/vylbot/vylbot_prod \
|
||||
&& git checkout main \
|
||||
&& git fetch \
|
||||
&& git pull \
|
||||
&& docker-compose --file docker-compose.prod.yml down \
|
||||
&& (pm2 stop vylbot_prod || true) \
|
||||
&& (pm2 delete vylbot_prod || true) \
|
||||
&& cp .prod.env .env \
|
||||
&& cp ormconfig.prod.json ormconfig.json \
|
||||
&& yarn install --frozen-lockfile \
|
||||
&& yarn build \
|
||||
&& docker-compose --file docker-compose.prod.yml up -d \
|
||||
&& echo "Sleeping for 10 seconds to let database load..." \
|
||||
&& sleep 10 \
|
||||
&& yarn run db:up \
|
||||
&& NODE_ENV=production BOT_TOKEN=$BOT_TOKEN_PROD pm2 start --name vylbot_prod dist/vylbot.js
|
21
scripts/deploy_stage.sh
Normal file
21
scripts/deploy_stage.sh
Normal file
|
@ -0,0 +1,21 @@
|
|||
#! /bin/bash
|
||||
|
||||
export PATH="$HOME/.yarn/bin:$PATH"
|
||||
export PATH="$HOME/.nvm/versions/node/v16.17.0/bin/:$PATH"
|
||||
|
||||
cd ~/apps/vylbot/vylbot_stage \
|
||||
&& git checkout develop \
|
||||
&& git fetch \
|
||||
&& git pull \
|
||||
&& docker-compose --file docker-compose.stage.yml down \
|
||||
&& (pm2 stop vylbot_stage || true) \
|
||||
&& (pm2 delete vylbot_stage || true) \
|
||||
&& cp .stage.env .env \
|
||||
&& cp ormconfig.stage.json ormconfig.json \
|
||||
&& yarn install --frozen-lockfile \
|
||||
&& yarn build \
|
||||
&& docker-compose --file docker-compose.stage.yml up -d \
|
||||
&& echo "Sleeping for 10 seconds to let database load..." \
|
||||
&& sleep 10 \
|
||||
&& yarn run db:up \
|
||||
&& NODE_ENV=production BOT_TOKEN=$BOT_TOKEN_STAGE pm2 start --name vylbot_stage dist/vylbot.js
|
Loading…
Reference in a new issue