Skip to content

feat: add docker-compose.yml for local development#2462

Open
pablo-ibco wants to merge 1 commit into
developfrom
pborges/feat-add-docker-compose-for-local-dev
Open

feat: add docker-compose.yml for local development#2462
pablo-ibco wants to merge 1 commit into
developfrom
pborges/feat-add-docker-compose-for-local-dev

Conversation

@pablo-ibco
Copy link
Copy Markdown
Contributor

Summary

  • Add docker-compose.yml at the repo root for local development
  • Add scripts/init-databases.sql to bootstrap both databases in a single Postgres instance

Motivation

Setting up the local environment currently requires multiple manual steps spread across different READMEs:

  1. Run app/scripts/start-db.sh for the app database
  2. Manually create the ccglobal user and database for the global-api
  3. Manually configure each service to connect to the right database

There is no unified way to bring up the full local stack. This makes onboarding slow and error-prone — especially for new team members.

Changes

docker-compose.yml

  • db: Postgres 16 Alpine with persistent volume, healthcheck, and an init script that creates both citycatalyst (primary) and ccglobal (global-api) databases
  • global-api: Builds from ./global-api/Dockerfile, connects to the db service. Behind the full profile so it only starts when explicitly requested

scripts/init-databases.sql

  • Creates the ccglobal user and database on first Postgres startup (the citycatalyst database is created automatically via POSTGRES_DB)

Usage

Database only (most common for app development)

docker compose up -d

Then run the app locally with hot reload

cd app && npm run dev

Full stack (database + global-api)

docker compose --profile full up -d

Test plan

  • docker compose up -d starts Postgres and both databases are created
  • docker compose --profile full up -d additionally starts the global-api service
  • App connects to the database and migrations run successfully
  • docker compose down -v cleans up volumes
  • Existing app/scripts/start-db.sh still works independently

Previously, setting up the local environment required manually running
Docker commands for Postgres, creating multiple databases and users by
hand, and configuring each service independently.

This adds a docker-compose.yml at the repo root that provides:
- A Postgres 16 instance with healthcheck, persistent volume, and
  automatic initialization of both databases (citycatalyst + ccglobal)
- The global-api service behind a full profile for when it's needed

Usage:
  docker compose up           # just the database
  docker compose --profile full up  # database + global-api
Comment thread docker-compose.yml
@@ -0,0 +1,36 @@
services:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Currently this file only starts the different database services, not the individual frontends and backend microservices. While that's fine and can certainly be helpful for local development, should we add citycatalyst, hiap, global-api etc. here for a full local deployment?

Previously we did this with e.g. minikube and our k8s config files (the idea was to not have separate configs for deployment and local development), but I think a docker-compose setup is certainly easier to get going with...

Copy link
Copy Markdown
Contributor

@lemilonkh lemilonkh left a comment

Choose a reason for hiding this comment

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

Thanks, let's see if we can expand it in the future 👍

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants