Skip to content

Commit

Permalink
Make docker-server binary fixed between unit/gunicorn images
Browse files Browse the repository at this point in the history
We want it to be a full drop-in replacement
  • Loading branch information
frankh committed Nov 27, 2023
1 parent 1d85df3 commit c7e16dd
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 4 deletions.
4 changes: 2 additions & 2 deletions .github/actions/build-n-cache-image/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 2 additions & 0 deletions bin/docker-server-unit
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
2 changes: 1 addition & 1 deletion bin/unit_metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down
3 changes: 3 additions & 0 deletions production-unit.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down
2 changes: 1 addition & 1 deletion unit.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"*:8001": {
"pass": "routes/metrics"
},
"*:8081": {
"*:8181": {
"pass": "routes/status"
}
},
Expand Down

0 comments on commit c7e16dd

Please sign in to comment.