diff --git a/setup/deploy/docker-compose-staging.yml b/setup/deploy/docker-compose-staging.yml index 4e5e260..38ee14d 100644 --- a/setup/deploy/docker-compose-staging.yml +++ b/setup/deploy/docker-compose-staging.yml @@ -41,10 +41,10 @@ services: replicas: 2 labels: traefik.enable: "true" - traefik.http.routers.my_project_name-stag-static-app.rule: Host(`my_project_name.static.asimt.sa`) - traefik.http.routers.my_project_name-stag-static-app.tls: "true" - traefik.http.routers.my_project_name-stag-static-app.tls.certresolver: prodResolver - traefik.http.services.my_project_name-stag-static-svc.loadbalancer.server.port: 80 + traefik.http.routers.${PROJECT_REPO_NAME}-stag-static-app.rule: Host(`my_project_name.static.asimt.sa`) + traefik.http.routers.${PROJECT_REPO_NAME}-stag-static-app.tls: "true" + traefik.http.routers.${PROJECT_REPO_NAME}-stag-static-app.tls.certresolver: prodResolver + traefik.http.services.${PROJECT_REPO_NAME}-stag-static-svc.loadbalancer.server.port: 80 resources: reservations: memory: 128M @@ -58,7 +58,7 @@ services: - main-public app-migrate: - image: ghcr.io/asim3/my_project_name:${PROJECT_IMAGE_TAG} + image: ghcr.io/asim3/${PROJECT_REPO_NAME}:${PROJECT_IMAGE_TAG} entrypoint: - "/bin/sh" - "-c" @@ -83,7 +83,7 @@ services: - main-public app: - image: ghcr.io/asim3/my_project_name:${PROJECT_IMAGE_TAG} + image: ghcr.io/asim3/${PROJECT_REPO_NAME}:${PROJECT_IMAGE_TAG} environment: TZ: Asia/Riyadh DJANGO_SETTINGS_MODULE: "my_project_name.settings.docker_staging" @@ -101,10 +101,10 @@ services: replicas: 1 labels: traefik.enable: "true" - traefik.http.routers.my_project_name-stag-app.rule: Host(`my_project_name.asimt.sa`) - traefik.http.routers.my_project_name-stag-app.tls: "true" - traefik.http.routers.my_project_name-stag-app.tls.certresolver: prodResolver - traefik.http.services.my_project_name-stag-svc.loadbalancer.server.port: 8000 + traefik.http.routers.${PROJECT_REPO_NAME}-stag-app.rule: Host(`my_project_name.asimt.sa`) + traefik.http.routers.${PROJECT_REPO_NAME}-stag-app.tls: "true" + traefik.http.routers.${PROJECT_REPO_NAME}-stag-app.tls.certresolver: prodResolver + traefik.http.services.${PROJECT_REPO_NAME}-stag-svc.loadbalancer.server.port: 8000 # https://doc.traefik.io/traefik/routing/providers/docker/ resources: reservations: diff --git a/setup/deploy/docker-compose.yml b/setup/deploy/docker-compose.yml index a7cd5fe..47f214e 100644 --- a/setup/deploy/docker-compose.yml +++ b/setup/deploy/docker-compose.yml @@ -41,10 +41,10 @@ services: replicas: 2 labels: traefik.enable: "true" - traefik.http.routers.my_project_name-prod-static-app.rule: Host(`static.my_project_name.sa`) - traefik.http.routers.my_project_name-prod-static-app.tls: "true" - traefik.http.routers.my_project_name-prod-static-app.tls.certresolver: prodResolver - traefik.http.services.my_project_name-prod-static-svc.loadbalancer.server.port: 80 + traefik.http.routers.${PROJECT_REPO_NAME}-prod-static-app.rule: Host(`static.my_project_name.sa`) + traefik.http.routers.${PROJECT_REPO_NAME}-prod-static-app.tls: "true" + traefik.http.routers.${PROJECT_REPO_NAME}-prod-static-app.tls.certresolver: prodResolver + traefik.http.services.${PROJECT_REPO_NAME}-prod-static-svc.loadbalancer.server.port: 80 resources: reservations: memory: 128M @@ -58,7 +58,7 @@ services: - main-public app-migrate: - image: ghcr.io/asim3/my_project_name:${PROJECT_IMAGE_TAG} + image: ghcr.io/asim3/${PROJECT_REPO_NAME}:${PROJECT_IMAGE_TAG} entrypoint: - "/bin/sh" - "-c" @@ -83,7 +83,7 @@ services: - main-public app: - image: ghcr.io/asim3/my_project_name:${PROJECT_IMAGE_TAG} + image: ghcr.io/asim3/${PROJECT_REPO_NAME}:${PROJECT_IMAGE_TAG} environment: TZ: Asia/Riyadh DJANGO_SETTINGS_MODULE: "my_project_name.settings.docker_production" @@ -101,10 +101,10 @@ services: replicas: 1 labels: traefik.enable: "true" - traefik.http.routers.my_project_name-prod-app.rule: Host(`my_project_name.sa`) - traefik.http.routers.my_project_name-prod-app.tls: "true" - traefik.http.routers.my_project_name-prod-app.tls.certresolver: prodResolver - traefik.http.services.my_project_name-prod-svc.loadbalancer.server.port: 8000 + traefik.http.routers.${PROJECT_REPO_NAME}-prod-app.rule: Host(`my_project_name.sa`) + traefik.http.routers.${PROJECT_REPO_NAME}-prod-app.tls: "true" + traefik.http.routers.${PROJECT_REPO_NAME}-prod-app.tls.certresolver: prodResolver + traefik.http.services.${PROJECT_REPO_NAME}-prod-svc.loadbalancer.server.port: 8000 # https://doc.traefik.io/traefik/routing/providers/docker/ resources: reservations: diff --git a/setup/workflows/prod-ci-cd.yml b/setup/workflows/prod-ci-cd.yml index 40672d8..f968a25 100644 --- a/setup/workflows/prod-ci-cd.yml +++ b/setup/workflows/prod-ci-cd.yml @@ -6,7 +6,7 @@ on: - prod/** env: - PROJECT_NAME: my_project_name + PROJECT_REPO_NAME: ${{ github.event.repository.name }} PROJECT_IMAGE_NAME: "ghcr.io/asim3/${{ github.event.repository.name }}" @@ -80,7 +80,7 @@ jobs: export PROJECT_IMAGE_TAG=${{ needs.docker_push.outputs.app_version }} && eval "$(ssh-agent -s)" && ssh-add - <<< $SSH_PRIVATE_KEY - && docker stack deploy -c ./deploy/docker-compose.yml ${PROJECT_NAME}-prod + && docker stack deploy -c ./deploy/docker-compose.yml ${PROJECT_REPO_NAME}-prod - name: Clean Up SSH if: always() diff --git a/setup/workflows/stag-ci-cd.yml b/setup/workflows/stag-ci-cd.yml index bc4a6f1..5418a7f 100644 --- a/setup/workflows/stag-ci-cd.yml +++ b/setup/workflows/stag-ci-cd.yml @@ -6,7 +6,7 @@ on: - stag/** env: - PROJECT_NAME: my_project_name + PROJECT_REPO_NAME: ${{ github.event.repository.name }} PROJECT_IMAGE_NAME: "ghcr.io/asim3/${{ github.event.repository.name }}" @@ -80,7 +80,7 @@ jobs: export PROJECT_IMAGE_TAG=${{ needs.docker_push.outputs.app_version }} && eval "$(ssh-agent -s)" && ssh-add - <<< $SSH_PRIVATE_KEY - && docker stack deploy -c ./deploy/docker-compose-staging.yml ${PROJECT_NAME}-stag + && docker stack deploy -c ./deploy/docker-compose-staging.yml ${PROJECT_REPO_NAME}-stag - name: Clean Up SSH if: always()