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 14, 2024
1 parent 6b9be65 commit c743909
Show file tree
Hide file tree
Showing 18 changed files with 143 additions and 29 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
18 changes: 18 additions & 0 deletions .github/workflows/migrate-development.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Migrate 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: run webstrom-backend python manage.py migrate --noinput
Empty file.
Empty file.
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"
}
}
2 changes: 0 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ RUN pipenv sync --dev --system

COPY . /app

RUN python manage.py restoredb

EXPOSE 8000

ENTRYPOINT [ "daphne", "-b", "0.0.0.0", "-p", "8000", "webstrom.asgi:application" ]
3 changes: 2 additions & 1 deletion Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@ name = "pypi"
[packages]
daphne = "~=4.0.0"
dj-rest-auth = "~=5.0.1"
django = "~=3.2.23"
django = "~=4.2.11"
django-allauth = "~=0.58.2"
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
44 changes: 26 additions & 18 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
5 changes: 3 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ daphne==4.0.0
defusedxml==0.7.1
dill==0.3.8
dj-rest-auth==5.0.2
Django==3.2.25
Django==4.2.11
django-allauth==0.58.2
django-filter==23.5
django-rest-swagger==2.2.0
Expand All @@ -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
11 changes: 11 additions & 0 deletions webstrom/settings_development.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# pylint: disable=wildcard-import,unused-wildcard-import

from .settings import *

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 = [
"localhost",
]

0 comments on commit c743909

Please sign in to comment.