-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Deploy test environment to docker swarm.
- Loading branch information
Erik van Velzen
committed
Aug 28, 2024
1 parent
1cf05c2
commit e8ca630
Showing
6 changed files
with
120 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,7 @@ on: | |
- main | ||
- production | ||
- acceptance | ||
- swarm | ||
workflow_dispatch: | ||
|
||
permissions: | ||
|
@@ -74,7 +75,7 @@ jobs: | |
--push | ||
## This job takes pretty long and can be split up to parallelize the deploy. | ||
deploy-wagtail: | ||
deploy-wagtail-azure: | ||
needs: | ||
- build-and-push-images | ||
- variables | ||
|
@@ -141,8 +142,7 @@ jobs: | |
--name wagtail-${{ github.ref_name }} | ||
--hostname ${{ fromJson(needs.variables.outputs.result).WAGTAIL_HOSTNAME }} | ||
deploy-next: | ||
deploy-next-azure: | ||
needs: | ||
- build-and-push-images | ||
- variables | ||
|
@@ -195,3 +195,41 @@ jobs: | |
--environment holon-env | ||
--name next-${{ github.ref_name }} | ||
--hostname www.holontool.nl | ||
deploy-swarm: | ||
runs-on: ubuntu-latest | ||
environment: ${{ fromJson(needs.variables.outputs.result).GITHUB_ENVIRONMENT }} | ||
needs: | ||
- build-and-push-images | ||
- variables | ||
steps: | ||
- name: Check out repository | ||
uses: actions/checkout@v4 | ||
with: | ||
sparse-checkout: docker | ||
- name: Deploy to Docker Swarm | ||
uses: sagebind/docker-swarm-deploy-action@v2 | ||
env: | ||
# Shared | ||
TAG: ${{ needs.variables.outputs.tag }} | ||
WAGTAIL_HOSTNAME: ${{ fromJson(needs.variables.outputs.result).WAGTAIL_HOSTNAME }} | ||
# Wagtail | ||
AZURE_STORAGE_KEY: ${{ secrets.AZURE_STORAGE_KEY }} | ||
MEDIA_LOCATION: ${{ fromJson(needs.variables.outputs.result).MEDIA_LOCATION }} | ||
STATIC_LOCATION: ${{ fromJson(needs.variables.outputs.result).STATIC_LOCATION }} | ||
DB_USER: ${{ fromJson(needs.variables.outputs.result).DB_USER }} | ||
DB_NAME: ${{ fromJson(needs.variables.outputs.result).DB_NAME }} | ||
DB_PASSWORD: ${{ secrets.POSTGRES_PASSWORD }} | ||
RETURN_SCENARIO: ${{ fromJson(needs.variables.outputs.result).RETURN_SCENARIO }} | ||
SECRET_KEY: "${{ secrets.SECRET_KEY }}" | ||
SENTRY_ENVIRONMENT: ${{ fromJson(needs.variables.outputs.result).SENTRY_ENVIRONMENT }} | ||
DOMAIN_HOST: ${{ fromJson(needs.variables.outputs.result).DOMAIN_HOST }} | ||
EMAIL_HOST_PASSWORD: ${{ secrets.EMAIL_HOST_PASSWORD }} | ||
# NextJS | ||
NEXT_HOSTNAME: ${{ fromJson(needs.variables.outputs.result).NEXT_HOSTNAME }} | ||
NEXT_PUBLIC_TINY_URL_API_KEY: ${{ secrets.TINY_URL_API_KEY }} | ||
with: | ||
remote_host: ssh://[email protected] | ||
ssh_private_key: ${{ secrets.SWARM_SSH_PRIVATE_KEY }} | ||
ssh_public_key: ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJ1E4LUG22qgzc8U7oNYGWCn0cyA31+iyX2pck9wcPMS | ||
args: stack deploy --compose-file ./docker/compose-prod.yaml holon-${{ fromJson(needs.variables.outputs.result).GITHUB_ENVIRONMENT.toLowerCase() }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
## Compose file for Docker Swarm environments | ||
version: "3.8" | ||
|
||
services: | ||
wagtail: | ||
image: ghcr.io/zenmo/holon-wagtail:${TAG} | ||
environment: | ||
ALLOWED_HOSTS: "*" | ||
AZURE_ACCOUNT_NAME: holonstorage | ||
AZURE_STORAGE_KEY: ${AZURE_STORAGE_KEY} | ||
MEDIA_LOCATION: ${MEDIA_LOCATION} | ||
STATIC_LOCATION: ${STATIC_LOCATION} | ||
DB_HOST: postgres | ||
DB_USER: ${DB_USER} | ||
DB_NAME: ${DB_NAME} | ||
DB_PASSWORD: ${DB_PASSWORD} | ||
RETURN_SCENARIO: ${RETURN_SCENARIO} | ||
SECRET_KEY: ${SECRET_KEY} | ||
SENTRY_DSN: "https://764e9f2b886741bcbcfd2acd74a7f7b0@o4505045746384896.ingest.sentry.io/4505045759361024" | ||
SENTRY_ENVIRONMENT: ${SENTRY_ENVIRONMENT} | ||
DOMAIN_HOST: ${DOMAIN_HOST} | ||
N_WORKERS: 8 | ||
EMAIL_HOST_PASSWORD: ${EMAIL_HOST_PASSWORD} | ||
WAGTAILADMIN_BASE_URL: https://${WAGTAIL_HOSTNAME} | ||
labels: | ||
caddy: ${WAGTAIL_HOSTNAME} | ||
caddy.reverse_proxy: "{{upstreams 8000}}" | ||
networks: | ||
- caddy_default | ||
- postgres_default | ||
- default | ||
deploy: | ||
resources: | ||
limits: | ||
cpus: "8" | ||
memory: 8G | ||
|
||
nextjs: | ||
image: ghcr.io/zenmo/holon-nextjs:${TAG} | ||
environment: | ||
WAGTAIL_API_URL: http://wagtail:8000/wt/api/nextjs | ||
NEXT_PUBLIC_WAGTAIL_API_URL: https://${WAGTAIL_HOSTNAME}/wt/api/nextjs | ||
NEXT_PUBLIC_TINY_URL_API_KEY: ${NEXT_PUBLIC_TINY_URL_API_KEY} | ||
labels: | ||
caddy: ${NEXT_HOSTNAME} | ||
caddy.reverse_proxy: "{{upstreams 3000}}" | ||
networks: | ||
- caddy_default | ||
- default | ||
deploy: | ||
resources: | ||
limits: | ||
cpus: "4" | ||
memory: 4G | ||
|
||
networks: | ||
caddy_default: | ||
external: true | ||
postgres_default: | ||
external: true | ||
default: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
# For development | ||
AWS_ACCESS_KEY_ID= | ||
AWS_SECRET_ACCESS_KEY= | ||
AWS_BUCKET_NAME= | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters