From 4db99e03fc88c009a3415b152b46d81dae875c3e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Mih=C3=A1lik?= Date: Thu, 23 May 2024 22:17:38 +0200 Subject: [PATCH] Add workflow to deploy --- .github/workflows/deploy-test.yaml | 19 +++++++++++++++++++ .github/workflows/deploy.yaml | 19 +++++++++++++++++++ compose-test.yaml | 9 ++++++--- compose.yaml | 9 ++++++--- 4 files changed, 50 insertions(+), 6 deletions(-) create mode 100644 .github/workflows/deploy-test.yaml create mode 100644 .github/workflows/deploy.yaml diff --git a/.github/workflows/deploy-test.yaml b/.github/workflows/deploy-test.yaml new file mode 100644 index 0000000..ef08e07 --- /dev/null +++ b/.github/workflows/deploy-test.yaml @@ -0,0 +1,19 @@ +name: Deploy to Testing + +on: workflow_dispatch + +jobs: + deploy: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + path: kos-test + + - uses: wshihadeh/docker-deployment-action@v2 + with: + remote_docker_host: webstrom@server.strom.sk + ssh_private_key: ${{ secrets.WEBSTROM_DEPLOY_SSH_PRIVATE_KEY }} + ssh_public_key: ${{ secrets.WEBSTROM_DEPLOY_SSH_PUBLIC_KEY }} + stack_file_name: kos-test/compose-test.yaml + args: up --build --force-recreate --detach diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml new file mode 100644 index 0000000..d93ea74 --- /dev/null +++ b/.github/workflows/deploy.yaml @@ -0,0 +1,19 @@ +name: Deploy to Production + +on: workflow_dispatch + +jobs: + deploy: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + path: kos + + - uses: wshihadeh/docker-deployment-action@v2 + with: + remote_docker_host: webstrom@server.strom.sk + ssh_private_key: ${{ secrets.WEBSTROM_DEPLOY_SSH_PRIVATE_KEY }} + ssh_public_key: ${{ secrets.WEBSTROM_DEPLOY_SSH_PUBLIC_KEY }} + stack_file_name: kos/compose.yaml + args: up --build --force-recreate --detach diff --git a/compose-test.yaml b/compose-test.yaml index 59ed6bd..0750646 100644 --- a/compose-test.yaml +++ b/compose-test.yaml @@ -11,15 +11,18 @@ services: volumes: - "staticfiles:/app/static" - type: "bind" - source: "./db.sqlite3" + source: "/data/www/kos-test/db.sqlite3" target: "/app/db.sqlite3" - type: "bind" - source: "./media" + source: "/data/www/kos-test/media" target: "/app/media" + - type: "bind" + source: "/data/www/kos-test/.secrets" + target: "/app/.secrets" restart: always static: - image: "nginx:1.23" + image: "nginx:1.25" depends_on: - "website" ports: diff --git a/compose.yaml b/compose.yaml index 4ee21b2..5deb4f6 100644 --- a/compose.yaml +++ b/compose.yaml @@ -11,15 +11,18 @@ services: volumes: - "staticfiles:/app/static" - type: "bind" - source: "./db.sqlite3" + source: "/data/www/kos/db.sqlite3" target: "/app/db.sqlite3" - type: "bind" - source: "./media" + source: "/data/www/kos/media" target: "/app/media" + - type: "bind" + source: "/data/www/kos/.secrets" + target: "/app/.secrets" restart: always static: - image: "nginx:1.23" + image: "nginx:1.25" depends_on: - "website" ports: