Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Mihálik committed Apr 13, 2024
1 parent 6b9be65 commit 93cb358
Show file tree
Hide file tree
Showing 14 changed files with 122 additions and 19 deletions.
18 changes: 18 additions & 0 deletions .github/workflows/deploy-development.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: deploy-development

on:
push:
branches: [ multiple-environments ]

jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- 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: deployment/compose-development.yaml
args: up --build --force-recreate --detach
16 changes: 16 additions & 0 deletions .github/workflows/deploy-production.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: deploy-production

on: workflow_dispatch

jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- 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: deployment/compose-production.yaml
args: up --build --force-recreate --detach
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
name: deploy
name: deploy-testing

on: workflow_dispatch

jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- 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: compose.yaml
stack_file_name: deployment/compose-testing.yaml
args: up --build --force-recreate --detach
4 changes: 2 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Upgrade pip
run: pip3 install --upgrade pip
Expand All @@ -37,7 +37,7 @@ jobs:
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
- uses: actions/checkout@v4

- name: Upgrade pip
run: pip3 install --upgrade pip
Expand Down
5 changes: 4 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,11 @@
"editor.defaultFormatter": "ms-python.autopep8",
"editor.formatOnSave": true,
},
"files.associations": {
"compose-*.yaml": "dockercompose"
},
"git.branchProtection": [
"master"
],
"git.branchProtectionPrompt": "alwaysCommitToNewBranch"
}
}
1 change: 1 addition & 0 deletions Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ django-filter = "~=23.5"
djangorestframework = "~=3.14.0"
drf-writable-nested = "~=0.7.0"
pillow = "~=10.3.0"
psycopg = "~=3.1.18"
python-magic = "~=0.4.27"

[dev-packages]
Expand Down
32 changes: 20 additions & 12 deletions Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 18 additions & 0 deletions deployment/compose-development.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
version: "3"

services:
webstrom-backend:
build: ..

image: webstrom-backend-development

environment:
- DJANGO_SETTINGS_MODULE=webstrom.settings_development

volumes:
- /var/run/postgresql:/var/run/postgresql:rw

restart: "always"

ports:
- 8930:8000
Empty file.
15 changes: 15 additions & 0 deletions deployment/compose-testing.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
version: "3"

services:
webstrom-backend:
build: ..

image: webstrom-backend-testing

environment:
- DJANGO_SETTINGS_MODULE=webstrom.settings_testing

restart: "always"

ports:
- 8920:8000
3 changes: 2 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ oauthlib==3.2.2
openapi-codec==1.3.2
pillow==10.3.0
platformdirs==4.2.0
psycopg==3.1.18
pyasn1==0.6.0
pyasn1_modules==0.4.0
pycodestyle==2.11.1
Expand All @@ -51,7 +52,7 @@ requests-oauthlib==2.0.0
service-identity==24.1.0
simplejson==3.19.2
six==1.16.0
sqlparse==0.4.4
sqlparse==0.5.0
tomlkit==0.12.4
Twisted==24.3.0
txaio==23.1.1
Expand Down
16 changes: 16 additions & 0 deletions webstrom/settings_development.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# pylint: disable=wildcard-import,unused-wildcard-import

from .settings import *

ALLOWED_HOSTS = [
"development.strom.sk",
]


DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql',
'NAME': 'webstrom-development',
'USER': 'webstrom',
}
}
Empty file added webstrom/settings_production.py
Empty file.
7 changes: 7 additions & 0 deletions webstrom/settings_testing.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# pylint: disable=wildcard-import,unused-wildcard-import

from .settings import *

ALLOWED_HOSTS = [
"testing.strom.sk",
]

0 comments on commit 93cb358

Please sign in to comment.