Skip to content

compose: api service missing NODE_ENV=production — libs gate prod optimizations on it #197

@CryptoJones

Description

@CryptoJones

Problem

docker-compose.yml's migrate service sets NODE_ENV: production (line 78), but the api service doesn't. In compose deployments the api process runs without NODE_ENV set, so libraries that gate optimizations on process.env.NODE_ENV === 'production' silently fall back to dev mode:

  • Express: view cache off
  • Sequelize: extra debug paths active
  • pg: pool sizing defaults differ
  • Many others in the dep tree

Not a functional bug — every code path still works — but an operational quality issue: compose deployments aren't actually running in production mode by these libraries' standards, despite the operator's intent.

Fix

Add NODE_ENV: ${NODE_ENV:-production} to the api service environment block. Defaults compose to production mode; operators who explicitly want dev compose can override via NODE_ENV=development in .env.

Acceptance

  • docker-compose.yml api service sets NODE_ENV with a production default
  • Override path via .env documented in the inline comment

Proudly Made in Nebraska. Go Big Red! 🌽 https://xkcd.com/2347/

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions