From 99bfa9874aa1a4612d53b439fada1bfa359346a6 Mon Sep 17 00:00:00 2001 From: Sven Heidemann Date: Wed, 27 Sep 2023 16:47:57 +0200 Subject: [PATCH 1/3] Renamed image #369 --- kdb-bot/cpl-workspace.json | 2 +- kdb-web/package.json | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/kdb-bot/cpl-workspace.json b/kdb-bot/cpl-workspace.json index 229bc577..29d7ef29 100644 --- a/kdb-bot/cpl-workspace.json +++ b/kdb-bot/cpl-workspace.json @@ -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;" diff --git a/kdb-web/package.json b/kdb-web/package.json index 59943f80..c640dd53 100644 --- a/kdb-web/package.json +++ b/kdb-web/package.json @@ -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" } -} \ No newline at end of file +} From 987a1a664be4ba97364b7a0af55684d4cd338bba Mon Sep 17 00:00:00 2001 From: Sven Heidemann Date: Wed, 27 Sep 2023 17:21:11 +0200 Subject: [PATCH 2/3] Tried to add CI/CD #369 --- .gitea/workflows/deploy_prod.yaml | 48 +++++++++++++++ .gitea/workflows/deploy_support.yaml | 62 +++++++++++++++++++ docker-compose.staging.yml | 89 ++++++++++++++++++++++++++++ docker-compose.yml | 86 +++++++++++++++++++++++++++ kdb-web/package.json | 1 + 5 files changed, 286 insertions(+) create mode 100644 .gitea/workflows/deploy_prod.yaml create mode 100644 .gitea/workflows/deploy_support.yaml create mode 100644 docker-compose.staging.yml create mode 100644 docker-compose.yml diff --git a/.gitea/workflows/deploy_prod.yaml b/.gitea/workflows/deploy_prod.yaml new file mode 100644 index 00000000..9c22f329 --- /dev/null +++ b/.gitea/workflows/deploy_prod.yaml @@ -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_(qVE&}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 \ No newline at end of file diff --git a/kdb-web/package.json b/kdb-web/package.json index c640dd53..2ec300d9 100644 --- a/kdb-web/package.json +++ b/kdb-web/package.json @@ -13,6 +13,7 @@ "predocker-build": "npm run update-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, From 8bbd57e82f04c0014ad190764efd8bb8e331104e Mon Sep 17 00:00:00 2001 From: Sven Heidemann Date: Wed, 27 Sep 2023 17:22:46 +0200 Subject: [PATCH 3/3] Fixed deploy #369 --- .gitea/workflows/deploy_support.yaml | 2 +- kdb-web/package.json | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/.gitea/workflows/deploy_support.yaml b/.gitea/workflows/deploy_support.yaml index 25ca19dc..993ed5ad 100644 --- a/.gitea/workflows/deploy_support.yaml +++ b/.gitea/workflows/deploy_support.yaml @@ -48,7 +48,7 @@ jobs: - name: Build docker web run: | docker image prune -f - npm run docker-build-stage + npm run docker-build - name: Deploy Stack to sh-edraft.de uses: https://github.com/kgierke/portainer-stack-deployment@v1 diff --git a/kdb-web/package.json b/kdb-web/package.json index 2ec300d9..c640dd53 100644 --- a/kdb-web/package.json +++ b/kdb-web/package.json @@ -13,7 +13,6 @@ "predocker-build": "npm run update-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,