From c7e16dd868c589de55de81c28c373ba3eb96f43f Mon Sep 17 00:00:00 2001 From: Frank Hamand Date: Fri, 24 Nov 2023 12:00:33 +0000 Subject: [PATCH] Make docker-server binary fixed between unit/gunicorn images We want it to be a full drop-in replacement --- .github/actions/build-n-cache-image/action.yml | 4 ++-- bin/docker-server-unit | 2 ++ bin/unit_metrics.py | 2 +- production-unit.Dockerfile | 3 +++ unit.json | 2 +- 5 files changed, 9 insertions(+), 4 deletions(-) diff --git a/.github/actions/build-n-cache-image/action.yml b/.github/actions/build-n-cache-image/action.yml index a114e276025e3..e3bf01ea78f52 100644 --- a/.github/actions/build-n-cache-image/action.yml +++ b/.github/actions/build-n-cache-image/action.yml @@ -49,8 +49,8 @@ runs: with: buildx-fallback: false # buildx is so slow it's better to just fail file: production-unit.Dockerfile - tags: ${{ steps.emit.outputs.tag }} - platforms: linux/amd64 + tags: posthog/posthog:unit-${{ github.sha }} + platforms: linux/amd64,linux/arm64 build-args: COMMIT_HASH=${{ github.sha }} save: ${{ inputs.save }} env: diff --git a/bin/docker-server-unit b/bin/docker-server-unit index f1caab6a71174..55d5961bb6a5b 100755 --- a/bin/docker-server-unit +++ b/bin/docker-server-unit @@ -1,6 +1,8 @@ #!/bin/bash set -e +./bin/migrate-check + # To ensure we are able to expose metrics from multiple processes, we need to # provide a directory for `prometheus_client` to store a shared registry. export PROMETHEUS_MULTIPROC_DIR=$(mktemp -d) diff --git a/bin/unit_metrics.py b/bin/unit_metrics.py index 227139cf10b09..8ec2f5782f2e3 100644 --- a/bin/unit_metrics.py +++ b/bin/unit_metrics.py @@ -42,7 +42,7 @@ def application(environ, start_response): - connection = http.client.HTTPConnection("localhost:8081") + connection = http.client.HTTPConnection("localhost:8181") connection.request("GET", "/status") response = connection.getresponse() diff --git a/production-unit.Dockerfile b/production-unit.Dockerfile index 197cdbb229223..df9d91e29a6e6 100644 --- a/production-unit.Dockerfile +++ b/production-unit.Dockerfile @@ -295,6 +295,9 @@ COPY --chown=posthog:posthog posthog posthog/ COPY --chown=posthog:posthog ee ee/ COPY --chown=posthog:posthog hogvm hogvm/ +# Keep server command backwards compatible +RUN cp ./bin/docker-server-unit ./bin/docker-server + # Setup ENV. ENV NODE_ENV=production \ CHROME_BIN=/usr/bin/chromium \ diff --git a/unit.json b/unit.json index 3d80936e14fb1..49541eb1f8e60 100644 --- a/unit.json +++ b/unit.json @@ -6,7 +6,7 @@ "*:8001": { "pass": "routes/metrics" }, - "*:8081": { + "*:8181": { "pass": "routes/status" } },