From bdb5982377b9ae51f44ec906d8c86e6c28d2fd73 Mon Sep 17 00:00:00 2001 From: Jorrit Strikwerda Date: Thu, 25 Jan 2024 09:31:14 +0100 Subject: [PATCH 1/5] Change 'docker-compose' to newer 'docker compose' . --- .github/workflows/ci-cd.yaml | 6 +++--- Makefile | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci-cd.yaml b/.github/workflows/ci-cd.yaml index 0ded12e..d9fef86 100644 --- a/.github/workflows/ci-cd.yaml +++ b/.github/workflows/ci-cd.yaml @@ -30,16 +30,16 @@ jobs: uses: actions/checkout@v3 - name: Build Docker test image - run: docker-compose -f docker-compose.test.yaml build + run: docker compose -f docker-compose.test.yaml build - name: Create Docker network run: docker network create mbc_network - name: Start Docker Containers - run: docker-compose -f docker-compose.test.yaml up -d + run: docker compose -f docker-compose.test.yaml up -d - name: Run Tests - run: docker-compose -f docker-compose.test.yaml run app python manage.py test + run: docker compose -f docker-compose.test.yaml run app python manage.py test deploy-acc: name: Acceptance release diff --git a/Makefile b/Makefile index 36149aa..a20165d 100644 --- a/Makefile +++ b/Makefile @@ -1,8 +1,8 @@ # Build scripts to run commands within the Docker container or create local environments # Docker variables -RUN_IN_NEW_WEBCONTEXT = docker-compose run -it mbc_app -EXEC_IN_WEB = docker-compose run mbc_app +RUN_IN_NEW_WEBCONTEXT = docker compose run -it mbc_app +EXEC_IN_WEB = docker compose run mbc_app EXEC_IN_WEB_CMD = $(EXEC_IN_WEB) python manage.py # General @@ -23,12 +23,12 @@ run_frontend: stop: ## Stop containers @echo Stopping containers. - docker-compose down + docker compose down clear_docker_volumes: ## clear docker volumes check_clean_db @echo Stopping and removing containers. - docker-compose down -v + docker compose down -v create_superuser: ## create superuser for public tenant @echo Create superuser. You will be prompted for email and password From 30b50d4caff685818bde7004d6af03368d82e8af Mon Sep 17 00:00:00 2001 From: Maurice Guikema Date: Wed, 31 Jan 2024 14:08:33 +0100 Subject: [PATCH 2/5] change: mor-core signaal post api --- app/apps/main/forms.py | 2 +- app/apps/signalen/managers.py | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/app/apps/main/forms.py b/app/apps/main/forms.py index 856a998..3fbbfb6 100644 --- a/app/apps/main/forms.py +++ b/app/apps/main/forms.py @@ -289,7 +289,7 @@ def _to_base64(self, file): def get_onderwerp_urls(self, onderwerp_ids): return [ - c + {"bron_url": c} for c in Categorie.objects.all() .filter(pk__in=onderwerp_ids) .values_list("onderwerp", flat=True) diff --git a/app/apps/signalen/managers.py b/app/apps/signalen/managers.py index a852d2a..eb36fa7 100644 --- a/app/apps/signalen/managers.py +++ b/app/apps/signalen/managers.py @@ -40,7 +40,9 @@ def signaal_aanmaken(self, signaal_data, request, db="default"): "v1:signaal-detail", kwargs={"uuid": signaal.uuid}, request=request, - ) + ), + "bron_id": "B&C Service formulier", + "bron_signaal_id": signaal.uuid, } ) signaal_response = MeldingenService().signaal_aanmaken( From 5709f8b440c3c110c01f0ef0737df6b16b488c65 Mon Sep 17 00:00:00 2001 From: Maurice Guikema Date: Wed, 31 Jan 2024 14:55:29 +0100 Subject: [PATCH 3/5] git sha --- .github/workflows/ci-cd.yaml | 4 +++- .github/workflows/deploy-prd.yaml | 4 +++- .github/workflows/deploy-test.yaml | 4 +++- app/Dockerfile | 3 +++ app/apps/main/templates/base.html | 1 + app/config/context_processors.py | 1 + app/config/settings.py | 1 + app/requirements.txt | 2 +- 8 files changed, 16 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci-cd.yaml b/.github/workflows/ci-cd.yaml index d9fef86..ae3ffb5 100644 --- a/.github/workflows/ci-cd.yaml +++ b/.github/workflows/ci-cd.yaml @@ -67,7 +67,7 @@ jobs: id: meta_app uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38 with: - images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-app-develop + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-app - name: Build and push app Docker image uses: docker/build-push-action@v3 @@ -76,6 +76,8 @@ jobs: push: true tags: ${{ steps.meta_app.outputs.tags }} labels: ${{ steps.meta_app.outputs.labels }} + build-args: | + GIT_SHA=${{ github.sha }} - name: Start rollout on k8s platform uses: actions-hub/kubectl@master diff --git a/.github/workflows/deploy-prd.yaml b/.github/workflows/deploy-prd.yaml index 9ba4cd5..a9fcc0e 100644 --- a/.github/workflows/deploy-prd.yaml +++ b/.github/workflows/deploy-prd.yaml @@ -33,7 +33,7 @@ jobs: id: meta_app uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38 with: - images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-app-production + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-app - name: Build and push app Docker image uses: docker/build-push-action@v3 @@ -42,6 +42,8 @@ jobs: push: true tags: ${{ steps.meta_app.outputs.tags }} labels: ${{ steps.meta_app.outputs.labels }} + build-args: | + GIT_SHA=${{ github.sha }} - name: Start rollout on k8s platform uses: actions-hub/kubectl@master diff --git a/.github/workflows/deploy-test.yaml b/.github/workflows/deploy-test.yaml index db305b1..4d2daaf 100644 --- a/.github/workflows/deploy-test.yaml +++ b/.github/workflows/deploy-test.yaml @@ -33,7 +33,7 @@ jobs: id: meta_app uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38 with: - images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-app-test + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-app - name: Build and push app Docker image uses: docker/build-push-action@v3 @@ -42,6 +42,8 @@ jobs: push: true tags: ${{ steps.meta_app.outputs.tags }} labels: ${{ steps.meta_app.outputs.labels }} + build-args: | + GIT_SHA=${{ github.sha }} - name: Start rollout on k8s platform uses: actions-hub/kubectl@master diff --git a/app/Dockerfile b/app/Dockerfile index 5af6c7e..b474760 100644 --- a/app/Dockerfile +++ b/app/Dockerfile @@ -63,4 +63,7 @@ RUN mkdir -p /media \ USER $APP_USER +ARG GIT_SHA +ENV GIT_SHA=$GIT_SHA + CMD ["bash", "/app/deploy/docker-entrypoint.sh"] diff --git a/app/apps/main/templates/base.html b/app/apps/main/templates/base.html index 8d7a6c3..3885622 100644 --- a/app/apps/main/templates/base.html +++ b/app/apps/main/templates/base.html @@ -5,6 +5,7 @@ + {% block title %}Begraven en Cremeren{% endblock %} diff --git a/app/config/context_processors.py b/app/config/context_processors.py index 3422942..38fef09 100644 --- a/app/config/context_processors.py +++ b/app/config/context_processors.py @@ -26,4 +26,5 @@ def general_settings(context): "SESSION_STATE": token_decoded.get("session_state"), "LOGOUT_URL": reverse("oidc_logout"), "LOGIN_URL": f"{reverse('oidc_authentication_init')}?next={absolute(context).get('FULL_URL')}", + "GIT_SHA": settings.GIT_SHA, } diff --git a/app/config/settings.py b/app/config/settings.py index 5fd50a6..319815c 100644 --- a/app/config/settings.py +++ b/app/config/settings.py @@ -16,6 +16,7 @@ "DJANGO_SECRET_KEY", os.environ.get("SECRET_KEY", os.environ.get("APP_SECRET")) ) +GIT_SHA = os.getenv("GIT_SHA") ENVIRONMENT = os.getenv("ENVIRONMENT") DEBUG = ENVIRONMENT == "development" diff --git a/app/requirements.txt b/app/requirements.txt index 73e2c08..2680577 100644 --- a/app/requirements.txt +++ b/app/requirements.txt @@ -7,7 +7,7 @@ psycopg2-binary==2.9.5 django-webpack-loader==1.7.0 requests debugpy -django-health-check +django-health-check==3.17.0 django_redis django-permissions-policy==4.14.0 django-cors-headers==3.13.0 From 17a22a141179c7bb69357717f7d6cd5ca43128c6 Mon Sep 17 00:00:00 2001 From: Maurice Guikema Date: Wed, 31 Jan 2024 15:07:42 +0100 Subject: [PATCH 4/5] git sha --- .github/workflows/ci-cd.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci-cd.yaml b/.github/workflows/ci-cd.yaml index ae3ffb5..faf22e8 100644 --- a/.github/workflows/ci-cd.yaml +++ b/.github/workflows/ci-cd.yaml @@ -67,7 +67,7 @@ jobs: id: meta_app uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38 with: - images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-app + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-app-develop - name: Build and push app Docker image uses: docker/build-push-action@v3 From 1f80aca98899d19dff468d379f99579b6095793f Mon Sep 17 00:00:00 2001 From: Maurice Guikema Date: Wed, 31 Jan 2024 15:22:34 +0100 Subject: [PATCH 5/5] change: mor-core signaal post api --- .github/workflows/deploy-prd.yaml | 2 +- .github/workflows/deploy-test.yaml | 2 +- app/apps/signalen/managers.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/deploy-prd.yaml b/.github/workflows/deploy-prd.yaml index a9fcc0e..76cfd71 100644 --- a/.github/workflows/deploy-prd.yaml +++ b/.github/workflows/deploy-prd.yaml @@ -33,7 +33,7 @@ jobs: id: meta_app uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38 with: - images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-app + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-app-production - name: Build and push app Docker image uses: docker/build-push-action@v3 diff --git a/.github/workflows/deploy-test.yaml b/.github/workflows/deploy-test.yaml index 4d2daaf..0027e24 100644 --- a/.github/workflows/deploy-test.yaml +++ b/.github/workflows/deploy-test.yaml @@ -33,7 +33,7 @@ jobs: id: meta_app uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38 with: - images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-app + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}-app-test - name: Build and push app Docker image uses: docker/build-push-action@v3 diff --git a/app/apps/signalen/managers.py b/app/apps/signalen/managers.py index eb36fa7..5671d66 100644 --- a/app/apps/signalen/managers.py +++ b/app/apps/signalen/managers.py @@ -42,7 +42,7 @@ def signaal_aanmaken(self, signaal_data, request, db="default"): request=request, ), "bron_id": "B&C Service formulier", - "bron_signaal_id": signaal.uuid, + "bron_signaal_id": str(signaal.uuid), } ) signaal_response = MeldingenService().signaal_aanmaken(