Skip to content

Commit

Permalink
Add workflow deploying to server
Browse files Browse the repository at this point in the history
  • Loading branch information
mmihalik committed May 23, 2024
1 parent b34db90 commit 75a2f7d
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 11 deletions.
19 changes: 19 additions & 0 deletions .github/workflows/deploy-test.yaml
Original file line number Diff line number Diff line change
@@ -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: [email protected]
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
19 changes: 19 additions & 0 deletions .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Deploy to Production

on: push

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: [email protected]
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
13 changes: 7 additions & 6 deletions compose-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
11 changes: 7 additions & 4 deletions compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
daphne -b 0.0.0.0 -p 8000 mas_problem.asgi:application

0 comments on commit 75a2f7d

Please sign in to comment.