Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,16 @@ const LEGACY_LOGFLARE_API_KEY = "api-key";
/**
* Go's Logflare entrypoint script (`start.go:358-362`): the image's own
* entrypoint conflicts with the container healthcheck due to a 15-second
* sleep, so Go writes its own `run.sh` and runs that instead. Transcribed
* byte-for-byte, including the trailing newline after `EOF` (Go's raw string
* literal ends with a newline before the closing backtick).
* sleep, so Go writes its own `run.sh` and runs that instead.
*
* Deliberate divergence from Go, do not revert in a parity sweep (issue
* #6088): `migrate && start`, so a failed migrate exits the container and the
* `unless-stopped` restart policy retries until the db is ready — Go boots
* Logflare against the unmigrated database, where Oban dies on the missing
* `public.oban_jobs`.
*/
const LEGACY_LOGFLARE_ENTRYPOINT_SCRIPT =
"cat <<'EOF' > run.sh && sh run.sh\n./logflare eval Logflare.Release.migrate\n./logflare start --sname logflare\nEOF\n";
"cat <<'EOF' > run.sh && sh run.sh\n./logflare eval Logflare.Release.migrate &&\n./logflare start --sname logflare\nEOF\n";

export interface LegacyLogflareContainerSpecInput {
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ describe("legacyBuildLogflareContainerSpec", () => {
expect(spec.entrypoint).toBe("sh");
expect(spec.cmd).toEqual([
"-c",
"cat <<'EOF' > run.sh && sh run.sh\n./logflare eval Logflare.Release.migrate\n./logflare start --sname logflare\nEOF\n",
"cat <<'EOF' > run.sh && sh run.sh\n./logflare eval Logflare.Release.migrate &&\n./logflare start --sname logflare\nEOF\n",
]);
expect(spec.exposedPorts).toEqual([{ containerPort: "4000" }]);
expect(spec.ports).toEqual([{ hostPort: "54327", containerPort: "4000" }]);
Expand Down
4 changes: 3 additions & 1 deletion packages/stack/src/services/analytics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,10 @@ export const makeAnalyticsServiceDocker = (opts: DockerAnalyticsOptions): Servic
entrypoint: "sh",
cmd: [
"-c",
// migrate && start: a failed migrate exits the container and the
// unless-stopped restart retries until the db is ready (supabase/cli#6088).
`cat <<'EOF' > /tmp/run.sh && sh /tmp/run.sh
./logflare eval Logflare.Release.migrate
./logflare eval Logflare.Release.migrate &&
./logflare start --sname logflare
EOF
`,
Expand Down
3 changes: 3 additions & 0 deletions packages/stack/src/services/services.unit.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -600,6 +600,9 @@ describe("docker-backed auxiliary services", () => {
expect(args).toContain("PHX_HTTP_PORT=4000");
expect(args).toContain("54328:4000");
expect(args).toContain("LOGFLARE_NODE_HOST=0.0.0.0");
expect(args.at(-1)).toBe(
`cat <<'EOF' > /tmp/run.sh && sh /tmp/run.sh\n./logflare eval Logflare.Release.migrate &&\n./logflare start --sname logflare\nEOF\n`,
);
});

it("keeps analytics on its container port when Linux uses bridge networking", () => {
Expand Down
Loading