From fa7829ba79d2b5c4629d80dd4ea2d095c6d97b5c Mon Sep 17 00:00:00 2001 From: Jacob Nesbitt Date: Wed, 26 Jun 2024 12:31:44 -0400 Subject: [PATCH 1/3] Configure flux pre-deployment for webhook-handler --- .../webhook-handler/{ => deploy}/deployments.yaml | 0 .../{ => deploy}/service-accounts.yaml | 0 .../webhook-handler/{ => deploy}/services.yaml | 0 .../custom/webhook-handler/flux/deploy.yaml | 15 +++++++++++++++ .../custom/webhook-handler/flux/pre-deploy.yaml | 14 ++++++++++++++ .../webhook-handler/pre-deploy/migration.job.yaml | 15 +++++++++++++++ 6 files changed, 44 insertions(+) rename k8s/production/custom/webhook-handler/{ => deploy}/deployments.yaml (100%) rename k8s/production/custom/webhook-handler/{ => deploy}/service-accounts.yaml (100%) rename k8s/production/custom/webhook-handler/{ => deploy}/services.yaml (100%) create mode 100644 k8s/production/custom/webhook-handler/flux/deploy.yaml create mode 100644 k8s/production/custom/webhook-handler/flux/pre-deploy.yaml create mode 100644 k8s/production/custom/webhook-handler/pre-deploy/migration.job.yaml diff --git a/k8s/production/custom/webhook-handler/deployments.yaml b/k8s/production/custom/webhook-handler/deploy/deployments.yaml similarity index 100% rename from k8s/production/custom/webhook-handler/deployments.yaml rename to k8s/production/custom/webhook-handler/deploy/deployments.yaml diff --git a/k8s/production/custom/webhook-handler/service-accounts.yaml b/k8s/production/custom/webhook-handler/deploy/service-accounts.yaml similarity index 100% rename from k8s/production/custom/webhook-handler/service-accounts.yaml rename to k8s/production/custom/webhook-handler/deploy/service-accounts.yaml diff --git a/k8s/production/custom/webhook-handler/services.yaml b/k8s/production/custom/webhook-handler/deploy/services.yaml similarity index 100% rename from k8s/production/custom/webhook-handler/services.yaml rename to k8s/production/custom/webhook-handler/deploy/services.yaml diff --git a/k8s/production/custom/webhook-handler/flux/deploy.yaml b/k8s/production/custom/webhook-handler/flux/deploy.yaml new file mode 100644 index 000000000..631a09a43 --- /dev/null +++ b/k8s/production/custom/webhook-handler/flux/deploy.yaml @@ -0,0 +1,15 @@ +apiVersion: kustomize.toolkit.fluxcd.io/v1 +kind: Kustomization +metadata: + name: webhook-handler-deploy +spec: + dependsOn: + - name: webhook-handler-pre-deploy + sourceRef: + kind: GitRepository + name: flux-system + path: "./deploy/" + interval: 5m + timeout: 5m + prune: true + wait: true diff --git a/k8s/production/custom/webhook-handler/flux/pre-deploy.yaml b/k8s/production/custom/webhook-handler/flux/pre-deploy.yaml new file mode 100644 index 000000000..d1bfe31a3 --- /dev/null +++ b/k8s/production/custom/webhook-handler/flux/pre-deploy.yaml @@ -0,0 +1,14 @@ +apiVersion: kustomize.toolkit.fluxcd.io/v1 +kind: Kustomization +metadata: + name: webhook-handler-pre-deploy +spec: + sourceRef: + kind: GitRepository + name: flux-system + path: "./pre-deploy/" + interval: 5m + timeout: 5m + prune: true + wait: true + force: true diff --git a/k8s/production/custom/webhook-handler/pre-deploy/migration.job.yaml b/k8s/production/custom/webhook-handler/pre-deploy/migration.job.yaml new file mode 100644 index 000000000..b7e99f9e8 --- /dev/null +++ b/k8s/production/custom/webhook-handler/pre-deploy/migration.job.yaml @@ -0,0 +1,15 @@ +apiVersion: batch/v1 +kind: Job +metadata: + name: webhook-handler-db-migration +spec: + template: + spec: + restartPolicy: Never + containers: + - name: migration + image: ghcr.io/spack/django:0.5.3 + command: + - python + - manage.py + - migrate From 2482da67bc99a058539bb76b986741c7a53fa035 Mon Sep 17 00:00:00 2001 From: Jacob Nesbitt Date: Wed, 25 Jun 2025 12:46:56 -0400 Subject: [PATCH 2/3] Remove webhook-handler image entrypoint --- analytics/Dockerfile | 2 -- analytics/entrypoint.sh | 8 -------- 2 files changed, 10 deletions(-) delete mode 100644 analytics/entrypoint.sh diff --git a/analytics/Dockerfile b/analytics/Dockerfile index 9167af7e5..296aca197 100644 --- a/analytics/Dockerfile +++ b/analytics/Dockerfile @@ -29,6 +29,4 @@ RUN pip install -r requirements.txt COPY . . -RUN chmod +x ./entrypoint.sh -ENTRYPOINT [ "./entrypoint.sh" ] CMD ["gunicorn", "--bind", "0.0.0.0:8080", "--access-logfile", "-", "analytics.wsgi"] diff --git a/analytics/entrypoint.sh b/analytics/entrypoint.sh deleted file mode 100644 index bc38904c5..000000000 --- a/analytics/entrypoint.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/sh -set -e - -# Always run migrate when invoking this image -python manage.py migrate - -# This will exec the CMD passed to docker, i.e. "gunicorn" or "celery" -exec "$@" From 7c002d0efca72229ff7bd14a20649d6f57875245 Mon Sep 17 00:00:00 2001 From: Jacob Nesbitt Date: Wed, 25 Jun 2025 12:49:46 -0400 Subject: [PATCH 3/3] Bump django image version to 0.5.4 --- .github/workflows/custom_docker_builds.yml | 2 +- k8s/production/custom/webhook-handler/deploy/deployments.yaml | 4 ++-- .../custom/webhook-handler/pre-deploy/migration.job.yaml | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/custom_docker_builds.yml b/.github/workflows/custom_docker_builds.yml index 5b78d353a..6882b2b6b 100644 --- a/.github/workflows/custom_docker_builds.yml +++ b/.github/workflows/custom_docker_builds.yml @@ -45,7 +45,7 @@ jobs: - docker-image: ./images/cache-indexer image-tags: ghcr.io/spack/cache-indexer:0.0.6 - docker-image: ./analytics - image-tags: ghcr.io/spack/django:0.5.3 + image-tags: ghcr.io/spack/django:0.5.4 - docker-image: ./images/ci-prune-buildcache image-tags: ghcr.io/spack/ci-prune-buildcache:0.0.4 - docker-image: ./images/protected-publish diff --git a/k8s/production/custom/webhook-handler/deploy/deployments.yaml b/k8s/production/custom/webhook-handler/deploy/deployments.yaml index a866b146d..9f6a0963e 100644 --- a/k8s/production/custom/webhook-handler/deploy/deployments.yaml +++ b/k8s/production/custom/webhook-handler/deploy/deployments.yaml @@ -23,7 +23,7 @@ spec: serviceAccountName: webhook-handler containers: - name: webhook-handler - image: ghcr.io/spack/django:0.5.3 + image: ghcr.io/spack/django:0.5.4 imagePullPolicy: Always resources: requests: @@ -146,7 +146,7 @@ spec: serviceAccountName: webhook-handler containers: - name: webhook-handler-worker - image: ghcr.io/spack/django:0.5.3 + image: ghcr.io/spack/django:0.5.4 command: [ "celery", diff --git a/k8s/production/custom/webhook-handler/pre-deploy/migration.job.yaml b/k8s/production/custom/webhook-handler/pre-deploy/migration.job.yaml index b7e99f9e8..f238b8051 100644 --- a/k8s/production/custom/webhook-handler/pre-deploy/migration.job.yaml +++ b/k8s/production/custom/webhook-handler/pre-deploy/migration.job.yaml @@ -8,7 +8,7 @@ spec: restartPolicy: Never containers: - name: migration - image: ghcr.io/spack/django:0.5.3 + image: ghcr.io/spack/django:0.5.4 command: - python - manage.py