diff --git a/.github/workflows/deploy-development.yml b/.github/workflows/deploy-development.yml new file mode 100644 index 00000000..fb6fa173 --- /dev/null +++ b/.github/workflows/deploy-development.yml @@ -0,0 +1,18 @@ +name: deploy-development + +on: + push: + branches: [ multiple-environments ] + +jobs: + deploy: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - 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: deployment/compose-development.yaml + args: up --build --force-recreate --detach diff --git a/.github/workflows/deploy-production.yml b/.github/workflows/deploy-production.yml new file mode 100644 index 00000000..5631de5d --- /dev/null +++ b/.github/workflows/deploy-production.yml @@ -0,0 +1,16 @@ +name: deploy-production + +on: workflow_dispatch + +jobs: + deploy: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - 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: deployment/compose-production.yaml + args: up --build --force-recreate --detach diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy-testing.yml similarity index 84% rename from .github/workflows/deploy.yml rename to .github/workflows/deploy-testing.yml index 4446fa95..03d148e7 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy-testing.yml @@ -1,4 +1,4 @@ -name: deploy +name: deploy-testing on: workflow_dispatch @@ -12,5 +12,5 @@ jobs: 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: compose.yaml + stack_file_name: deployment/compose-testing.yaml args: up --build --force-recreate --detach diff --git a/.vscode/settings.json b/.vscode/settings.json index 3784257a..05430d69 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -6,8 +6,11 @@ "editor.defaultFormatter": "ms-python.autopep8", "editor.formatOnSave": true, }, + "files.associations": { + "compose-*.yaml": "dockercompose" + }, "git.branchProtection": [ "master" ], "git.branchProtectionPrompt": "alwaysCommitToNewBranch" -} \ No newline at end of file +} diff --git a/deployment/compose-development.yaml b/deployment/compose-development.yaml new file mode 100644 index 00000000..f6f8fe05 --- /dev/null +++ b/deployment/compose-development.yaml @@ -0,0 +1,17 @@ +version: "3" + +name: "webstrom-development" + +services: + webstrom: + build: ../.. + + image: webstrom-development + + environment: + - DJANGO_SETTINGS_MODULE=webstrom.settings_development + + restart: "always" + + ports: + - 8930:8000 diff --git a/deployment/compose-production.yaml b/deployment/compose-production.yaml new file mode 100644 index 00000000..e69de29b diff --git a/deployment/compose-testing.yaml b/deployment/compose-testing.yaml new file mode 100644 index 00000000..97b41a25 --- /dev/null +++ b/deployment/compose-testing.yaml @@ -0,0 +1,17 @@ +version: "3" + +name: "webstrom-testing" + +services: + webstrom: + build: ../.. + + image: webstrom-testing + + environment: + - DJANGO_SETTINGS_MODULE=webstrom.settings_testing + + restart: "always" + + ports: + - 8920:8000 diff --git a/webstrom/settings_development.py b/webstrom/settings_development.py new file mode 100644 index 00000000..8f96dcb5 --- /dev/null +++ b/webstrom/settings_development.py @@ -0,0 +1,7 @@ +# pylint: disable=wildcard-import,unused-wildcard-import + +from .settings import * + +ALLOWED_HOSTS = [ + "development.strom.sk", +] diff --git a/webstrom/settings_production.py b/webstrom/settings_production.py new file mode 100644 index 00000000..e69de29b diff --git a/webstrom/settings_testing.py b/webstrom/settings_testing.py new file mode 100644 index 00000000..5646bea7 --- /dev/null +++ b/webstrom/settings_testing.py @@ -0,0 +1,7 @@ +# pylint: disable=wildcard-import,unused-wildcard-import + +from .settings import * + +ALLOWED_HOSTS = [ + "testing.strom.sk", +]