diff --git a/.github/workflows/deploy-development.yml b/.github/workflows/deploy-development.yml new file mode 100644 index 00000000..8764ad8f --- /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@v4 + - 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..cd4068c0 --- /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@v4 + - 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 77% rename from .github/workflows/deploy.yml rename to .github/workflows/deploy-testing.yml index 4446fa95..e4bece86 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy-testing.yml @@ -1,4 +1,4 @@ -name: deploy +name: deploy-testing on: workflow_dispatch @@ -6,11 +6,11 @@ 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: 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/.github/workflows/main.yml b/.github/workflows/main.yml index 8192b463..13698a6b 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -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 @@ -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 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..aa2e19aa --- /dev/null +++ b/deployment/compose-development.yaml @@ -0,0 +1,15 @@ +version: "3" + +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..4cd25d6c --- /dev/null +++ b/deployment/compose-testing.yaml @@ -0,0 +1,15 @@ +version: "3" + +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", +]