Skip to content

fix(compose): improve dev/prod startup reliability#28

Open
lfrallon wants to merge 1 commit into
mainfrom
codex/check-and-update-dockerfile-and-compose.yml
Open

fix(compose): improve dev/prod startup reliability#28
lfrallon wants to merge 1 commit into
mainfrom
codex/check-and-update-dockerfile-and-compose.yml

Conversation

@lfrallon
Copy link
Copy Markdown
Owner

Motivation

  • The Compose file had runtime fragility when .env values were missing which could prevent services from starting.
  • Redis was configured to load a local ./redis/redis.conf that does not exist in the repository, causing startup failures.
  • Healthchecks and mounts were overly specific (auth flags in Redis healthcheck and SELinux :Z mount) which reduce cross-platform compatibility.

Description

  • Added safe default fallbacks for host port mappings APP_PORT, PROD_PORT, and DB_PORT using ${VAR:-default} to allow Compose to start when env vars are absent.
  • Added default values for PostgreSQL env vars in db and the dev service (POSTGRES_DB, POSTGRES_USER, POSTGRES_PASSWORD) to avoid empty values breaking DB initialization.
  • Removed the Redis custom command and the non-existent ./redis/redis.conf bind mount so the official Redis image uses its default configuration.
  • Simplified the Redis healthcheck to redis-cli ping to avoid requiring ACL username/password flags and removed the SELinux-specific :Z suffix from the dev source mount for better portability.

Testing

  • Ran npm run typecheck and TypeScript type checking completed successfully.
  • Attempted to run docker compose config validation but the Docker CLI is not available in this environment so the Compose validation could not be executed here.

Codex Task

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a9a6963b13

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread compose.yml
POSTGRES_PASSWORD: '${POSTGRES_PASSWORD}'
POSTGRES_DB: '${POSTGRES_DB:-fastifydb}'
POSTGRES_USER: '${POSTGRES_USER:-postgres}'
POSTGRES_PASSWORD: '${POSTGRES_PASSWORD:-postgres}'
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Align the production DB password default

When the production profile is started without POSTGRES_PASSWORD, the database is initialized with the new default postgres, but fastify-prod still connects with its own default todoapp_password (line 71). A fresh docker compose --profile prod up therefore brings up Postgres successfully but the API cannot authenticate to it; use the same fallback in both places or require the variable explicitly.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant