Context
For self-hosters and dedicated private environments, configuring Node, Postgres, and Redis manually on a server is tedious and error-prone. We need a zero-friction, standard deployment configuration that spins up the entire Codra architecture locally or on a VPS with a single command.
Task
- Dockerfile (
apps/node/Dockerfile):
- Write a production-ready, multi-stage Dockerfile.
- Builder Stage: Use
node:20-alpine (or the current LTS version). Utilize npm workspaces (or turborepo if configured) to install all dependencies and run the build command specifically for the node app (npm run build --workspace=@codraoss/node-server).
- Runner Stage: Use a fresh
node:20-alpine image. Copy only the compiled dist files and production node_modules from the builder stage to keep the final image size minimal.
- Expose port
3000. Set the container CMD to ["node", "dist/index.js"].
- Docker Compose (
docker-compose.yml):
- Create a
docker-compose.yml file in the root of the repository.
- Service 1:
postgres: Use the official postgres:15-alpine image. Configure standard environment variables (POSTGRES_USER=postgres, POSTGRES_PASSWORD=password, POSTGRES_DB=codra). Map port 5432:5432.
- Service 2:
redis: Use the official redis:7-alpine image. Map port 6379:6379.
- Service 3:
codra-app: Build this service from the apps/node/Dockerfile. Map port 3000:3000. Set the DATABASE_URL environment variable to postgres://postgres:password@postgres:5432/codra and the REDIS_URL environment variable to redis://redis:6379.
- Add
depends_on rules to the codra-app service to ensure Redis and Postgres are booted before the Node app starts.
- Documentation:
- Add a short
README.md in apps/node (or update the main repository README) instructing users how to run docker compose up -d.
- Document how users should provide necessary GitHub App credentials and LLM API keys via an
.env file that Docker Compose will read.
Acceptance Criteria
- Running
docker compose up --build successfully compiles the Node application and starts Postgres, Redis, and the Codra Node app.
- The application container successfully resolves and connects to the adjacent Postgres and Redis containers using the internal Docker network.
- The API is accessible on
http://localhost:3000 from the host machine.
- The Docker image builds cleanly without including unnecessary source files or dev dependencies in the final runner stage.
Relevant Files/Paths
apps/node/Dockerfile (New)
docker-compose.yml (New)
README.md
Context
For self-hosters and dedicated private environments, configuring Node, Postgres, and Redis manually on a server is tedious and error-prone. We need a zero-friction, standard deployment configuration that spins up the entire Codra architecture locally or on a VPS with a single command.
Task
apps/node/Dockerfile):node:20-alpine(or the current LTS version). Utilizenpm workspaces(or turborepo if configured) to install all dependencies and run the build command specifically for the node app (npm run build --workspace=@codraoss/node-server).node:20-alpineimage. Copy only the compileddistfiles and productionnode_modulesfrom the builder stage to keep the final image size minimal.3000. Set the containerCMDto["node", "dist/index.js"].docker-compose.yml):docker-compose.ymlfile in the root of the repository.postgres: Use the officialpostgres:15-alpineimage. Configure standard environment variables (POSTGRES_USER=postgres,POSTGRES_PASSWORD=password,POSTGRES_DB=codra). Map port5432:5432.redis: Use the officialredis:7-alpineimage. Map port6379:6379.codra-app: Build this service from theapps/node/Dockerfile. Map port3000:3000. Set theDATABASE_URLenvironment variable topostgres://postgres:password@postgres:5432/codraand theREDIS_URLenvironment variable toredis://redis:6379.depends_onrules to thecodra-appservice to ensure Redis and Postgres are booted before the Node app starts.README.mdinapps/node(or update the main repository README) instructing users how to rundocker compose up -d..envfile that Docker Compose will read.Acceptance Criteria
docker compose up --buildsuccessfully compiles the Node application and starts Postgres, Redis, and the Codra Node app.http://localhost:3000from the host machine.Relevant Files/Paths
apps/node/Dockerfile(New)docker-compose.yml(New)README.md