diff --git a/.github/workflows/deploy-test.yaml b/.github/workflows/deploy-test.yaml new file mode 100644 index 0000000..4dd80b5 --- /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: mas-problem-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: mas-problem-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..7e55572 --- /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: mas-problem + + - 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: mas-problem/compose.yaml + args: up --build --force-recreate --detach diff --git a/compose-test.yaml b/compose-test.yaml index 08e332d..0792ec8 100644 --- a/compose-test.yaml +++ b/compose-test.yaml @@ -9,18 +9,19 @@ services: ports: - "8630:8000" volumes: - - "staticfiles:/app/static:ro" + - "staticfiles:/app/static:rw" - type: "bind" - source: "./db.sqlite3" + source: "/data/www/mas-problem-test/db.sqlite3" target: "/app/db.sqlite3" - type: "bind" - source: "./media" + source: "/data/www/mas-problem-test/media" target: "/app/media" - - + - type: "bind" + source: "/data/www/mas-problem-test/.secrets" + target: "/app/.secrets" static: - image: "nginx:1.23" + image: "nginx:1.25" depends_on: - "website" ports: diff --git a/compose.yaml b/compose.yaml index 5dbaa07..ac50dca 100644 --- a/compose.yaml +++ b/compose.yaml @@ -6,17 +6,20 @@ services: ports: - "8620:8000" volumes: - - "staticfiles:/app/static:ro" + - "staticfiles:/app/static:rw" - type: "bind" - source: "./db.sqlite3" + source: "/data/www/mas-problem/db.sqlite3" target: "/app/db.sqlite3" - type: "bind" - source: "./media" + source: "/data/www/mas-problem/media" target: "/app/media" + - type: "bind" + source: "/data/www/mas-problem/.secrets" + target: "/app/.secrets" restart: always static: - image: "nginx:1.23" + image: "nginx:1.25" depends_on: - "website" ports: diff --git a/entrypoint.sh b/entrypoint.sh index bd0a435..7990315 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -10,4 +10,4 @@ python manage.py migrate # Start server echo "Starting server" -daphne -b 0.0.0.0 -p 8000 mas_problem.asgi:application \ No newline at end of file +daphne -b 0.0.0.0 -p 8000 mas_problem.asgi:application