#369 #370

Merged
edraft merged 3 commits from #369 into support 2023-09-27 17:24:41 +02:00
6 changed files with 290 additions and 5 deletions

View File

@ -0,0 +1,48 @@
name: Deploy dev on push
run-name: Deploy dev on push
on:
push:
branches:
- master
jobs:
on-push-deploy_sh-edraft:
runs-on: [ dobby.sh-edraft.de, ubuntu-latest ]
container: catthehacker/ubuntu:act-latest
steps:
- name: Setup Python 3.10
uses: actions/setup-python@v3
with:
python-version: "3.10.12"
- run: python -v
- name: Setup docker
uses: https://github.com/papodaca/install-docker-action@main
- run: docker -v
- name: Clone Repository
uses: https://github.com/actions/checkout@v3
- name: Install cpl cli
run: |
pip install --extra-index-url https://pip.sh-edraft.de cpl-cli
- name: Install deps
run: cpl i
- name: Build docker
run: |
docker stack rm service_observer
docker image prune -f
cpl docker-build
- name: Deploy Stack to sh-edraft.de
uses: https://github.com/kgierke/portainer-stack-deployment@v1
with:
portainer-url: "https://docker.sh-edraft.de"
portainer-username: "gitea_job"
portainer-password: "$T8bS5;ge_(q<B9e^:9W4}=)"
portainer-endpoint: 2
name: service_observer
file: ./docker-compose.yml
variables: '{}'

View File

@ -0,0 +1,62 @@
name: Deploy dev on push
run-name: Deploy dev on push
on:
push:
branches:
- support
jobs:
on-push-deploy_sh-edraft:
runs-on: [ dobby.sh-edraft.de, ubuntu-latest ]
container: catthehacker/ubuntu:act-latest
steps:
- name: Setup Python 3.10
uses: actions/setup-python@v3
with:
python-version: "3.10.12"
- run: python -v
- name: Setup docker
uses: https://github.com/papodaca/install-docker-action@main
- run: docker -v
- name: Clone Repository
uses: https://github.com/actions/checkout@v3
- name: Shutdown stack
run: docker stack rm kdb_staging
- name: Prepare bot build
run: |
cd kdb-bot
pip install --extra-index-url https://pip.sh-edraft.de cpl-cli
cpl i
- name: Build docker bot
run: |
docker image prune -f
cpl docker-build
- name: Setup node
uses: https://github.com/actions/setup-node@v3
- name: Prepare web build
run: |
cd ../kdb-web
npm i
- name: Build docker web
run: |
docker image prune -f
npm run docker-build
- name: Deploy Stack to sh-edraft.de
uses: https://github.com/kgierke/portainer-stack-deployment@v1
with:
portainer-url: "https://docker.sh-edraft.de"
portainer-username: "gitea_job"
portainer-password: "$T8bS5;ge_(q<B9e^:9W4}=)"
portainer-endpoint: 2
name: kdb_staging
file: ./docker-compose.staging.yml
variables: '{}'

View File

@ -0,0 +1,89 @@
version: "3.9"
volumes:
kdb_db_staging_1:
services:
kdb_bot_staging_1:
image: sh-edraft.de/kdb-bot:1.1.6
container_name: kdb_bot_staging_1
depends_on:
- kdb_db_staging_1
networks:
- kdb_test
- reverse_proxy
volumes:
- /opt/kdb/staging/bot/config:/app/bot/config
- /opt/kdb/staging/bot/api_config:/app/bot_api/config
- /opt/kdb/staging/bot/logs:/app/bot/logs
environment:
KDB_ENVIRONMENT: "staging"
KDB_TOKEN: "OTk4MTU5ODAyMzkzOTY0NTk0.G-csct.b2Y-HxvLz0SfFLl5HpukROv2GaiWhcMABbMzYE"
KDB_PREFIX: "!kt "
command: bash /app/bot/bot -stage
deploy:
mode: replicated
replicas: 1
placement:
constraints: [ node.role == manager ]
resources:
reservations:
cpus: "0.5"
memory: 1024M
kdb_web_staging_1:
image: sh-edraft.de/kdb-web:1.1.6
container_name: kdb_web_staging_1
depends_on:
- kdb_bot_staging_1
networks:
- kdb_test
- reverse_proxy
volumes:
- /opt/kdb/staging/web/config.json:/usr/share/nginx/html/assets/config.json
environment:
BOT_CONTAINER_NAME: "kdb_bot_staging_1"
deploy:
mode: replicated
replicas: 1
placement:
constraints: [ node.role == manager ]
resources:
limits:
cpus: "0.4"
memory: 400M
reservations:
cpus: "0.1"
memory: 20M
kdb_db_staging_1:
image: mysql:latest
container_name: kdb_db_staging_1
command: mysqld --default-authentication-plugin=mysql_native_password --log_bin_trust_function_creators=1
networks:
- kdb_test
environment:
MYSQL_ROOT_PASSWORD: "kd_kdb"
MYSQL_USER: "kd_kdb"
MYSQL_PASSWORD: "~qELxjvtjJ3r7yg4PZr5!,V}d.{TC4rg"
MYSQL_DATABASE: "kd_kdb"
ports:
- "3308:3306"
volumes:
- kdb_db_staging_1:/var/lib/mysql
deploy:
mode: replicated
replicas: 1
placement:
constraints: [ node.role == manager ]
resources:
reservations:
cpus: "0.1"
memory: 150M
networks:
reverse_proxy:
external: true
kdb_test:
driver: overlay
attachable: true

86
docker-compose.yml Normal file
View File

@ -0,0 +1,86 @@
version: "3.9"
volumes:
kdb_db_prod_1:
services:
kdb_bot_prod_1:
image: sh-edraft.de/kdb-bot:1.1.6
depends_on:
- kdb_db_prod_1
networks:
- kdb_prod
- reverse_proxy
volumes:
- /opt/kdb/production/bot/config:/app/bot/config
- /opt/kdb/production/bot/api_config:/app/bot_api/config
- /opt/kdb/production/bot/logs:/app/bot/logs
environment:
KDB_ENVIRONMENT: "production"
KDB_TOKEN: "OTk4MTU5NTEyNDYyNzA4Nzg2.Gx0hSB.Ouq2dfRKxLBJvHfEq8OrFBHVUF24AQrVf55coM"
KDB_PREFIX: "!k "
deploy:
mode: replicated
replicas: 1
placement:
constraints: [ node.role == manager ]
resources:
reservations:
cpus: "0.5"
memory: 1024M
kdb_web_prod_1:
image: sh-edraft.de/kdb-web:1.1.6
depends_on:
- kdb_bot_prod_1
networks:
- kdb_prod
- reverse_proxy
volumes:
- /opt/kdb/production/web/config.json:/usr/share/nginx/html/assets/config.json
environment:
BOT_CONTAINER_NAME: "kdb_bot_prod_1"
deploy:
mode: replicated
replicas: 1
placement:
constraints: [ node.role == manager ]
resources:
limits:
cpus: "0.4"
memory: 400M
reservations:
cpus: "0.1"
memory: 20M
kdb_db_prod_1:
image: mysql:latest
command: mysqld --default-authentication-plugin=mysql_native_password --log_bin_trust_function_creators=1
networks:
- kdb_prod
restart: unless-stopped
environment:
MYSQL_ROOT_PASSWORD: "kd_kdb"
MYSQL_USER: "kd_kdb"
MYSQL_PASSWORD: ",2#MzfN4J=7r(q,Tz3npDkCR§>VE&}7T"
MYSQL_DATABASE: "kd_kdb"
ports:
- "3307:3306"
volumes:
- kdb_db_prod_1:/var/lib/mysql
deploy:
mode: replicated
replicas: 1
placement:
constraints: [ node.role == manager ]
resources:
reservations:
cpus: "0.1"
memory: 150M
networks:
reverse_proxy:
external: true
kdb_prod:
driver: overlay
attachable: true

View File

@ -35,7 +35,7 @@
"stage": "export KDB_ENVIRONMENT=staging; export KDB_NAME=KDB-Stage; cpl start;",
"pre-dev": "cpl build",
"dev": "export KDB_ENVIRONMENT=development; export KDB_NAME=KDB-Dev; cpl start;",
"docker-build": "cpl build $ARGS; docker build -t kdb-bot/kdb-bot:$(cpl gv) .;",
"docker-build": "cpl build $ARGS; docker build -t sh-edraft.de/kdb-bot:$(cpl gv) .;",
"dc-up": "docker-compose up -d",
"dc-down": "docker-compose down",
"docker": "cpl dc-down; cpl docker-build; cpl dc-up;"

View File

@ -11,9 +11,9 @@
"watch": "ng build --watch --configuration development",
"test": "ng test",
"predocker-build": "npm run update-version",
"docker-build": "export VERSION=$npm_package_version; ng build; docker build -t kdb-web/kdb-web:$VERSION .",
"docker-build-dev": "export VERSION=$npm_package_version; ng build --configuration development; docker build -t kdb-web/kdb-web:$VERSION .",
"docker-build-stage": "export VERSION=$npm_package_version; ng build --configuration staging; docker build -t kdb-web/kdb-web:$VERSION ."
"docker-build": "export VERSION=$npm_package_version; ng build; docker build -t sh-edraft.de/kdb-web:$VERSION .",
"docker-build-dev": "export VERSION=$npm_package_version; ng build --configuration development; docker build -t sh-edraft.de/kdb-web:$VERSION .",
"docker-build-stage": "export VERSION=$npm_package_version; ng build --configuration staging; docker build -t sh-edraft.de/kdb-web:$VERSION ."
},
"private": true,
"dependencies": {
@ -51,4 +51,4 @@
"tslib": "^2.4.1",
"typescript": "~4.9.5"
}
}
}