Skip to content

fix: resolve Docker volume paths, IAM migration conflict, linter version, and PPC compose - #168

Merged
ilramdhan merged 4 commits into
mutugading:mainfrom
ilramdhan:fix/local-dev-environment-setup
Aug 19, 2026
Merged

fix: resolve Docker volume paths, IAM migration conflict, linter version, and PPC compose#168
ilramdhan merged 4 commits into
mutugading:mainfrom
ilramdhan:fix/local-dev-environment-setup

Conversation

@ilramdhan

Copy link
Copy Markdown
Member

Description

This PR addresses several setup, tooling, and database migration issues across the repository:

  • Updates PostgreSQL volume mount paths in root and IAM compose files to align with PostgreSQL 18's new data directory layout.
  • Drops obsolete thread-based chat tables from migration 000037 at the beginning of migration 000072 to resolve schema collisions during fresh database migrations.
  • Pins golangci-lint to v2.3.0 in service Makefiles to properly parse .golangci.yml (version: "2") and match CI configurations.
  • Adds missing services/ppc/deployments/docker-compose.yaml to satisfy standalone docker-up, docker-down, and docker-logs Makefile targets for the PPC service.

Type of Change

  • 🐛 Bug fix (non-breaking change that fixes an issue)
  • ✨ New feature (non-breaking change that adds functionality)
  • 💥 Breaking change (fix or feature that changes existing API)
  • ♻️ Refactor (code change without new feature or bug fix)
  • 📚 Documentation update
  • 🧪 Test update
  • 🔧 Chore (dependencies, config, etc.)

Service(s) Affected

  • Finance Service
  • IAM Service
  • PPC Service
  • Shared Proto (gen/)
  • Root/Common

Changes Made

  • Docker Mount Paths: Updated PostgreSQL named volume mounts from /var/lib/postgresql/data to /var/lib/postgresql across root compose and IAM service compose to comply with postgres:18-alpine (PGDATA=/var/lib/postgresql/18/docker).
  • IAM Migrations: Updated migration 000072 to drop legacy 000037 thread-based tables (chat_thread, legacy chat_message) prior to creating the conversation-based chat_message table, preventing is_deleted column mismatch errors on fresh databases.
  • Linter Version: Updated golangci-lint binary installation path and pinned version to v2.3.0 across all service Makefiles to support version: "2" config parsing and align local runs with CI.
  • PPC Deployments: Created services/ppc/deployments/docker-compose.yaml with PostgreSQL (port 5436) and Jaeger (OTLP port 4317) services, enabling standalone container lifecycle targets.

Related Issues

Fixes #
Related to #

API Changes (if applicable)

Proto Changes

# No proto changes

Breaking Changes

Testing Performed

Unit Tests

  • New unit tests added
  • Existing unit tests pass
  • Coverage maintained/improved

Integration Tests

  • New integration tests added
  • Existing integration tests pass

Manual Testing

# 1. Verify Docker compose startup & Postgres 18 data directory
docker compose up -d
docker compose exec postgres psql -U postgres -c "SHOW data_directory;"

# 2. Verify clean IAM migration from scratch up to current version
make migrate-up

# 3. Verify golangci-lint v2 configuration parsing
make lint
golangci-lint linters

# 4. Verify PPC standalone compose targets
cd services/ppc
make docker-up
make docker-logs
make docker-down

Lint & Build

  • golangci-lint run ./... passes
  • go build ./... succeeds
  • go test -race ./... passes

Database (if applicable)

  • Migration added
  • Migration tested (up and down)
  • No breaking schema changes (or documented)

Documentation

  • README.md updated (if needed)
  • RULES.md updated (if needed)
  • Proto comments updated
  • OpenAPI regenerated

Rollback Plan

  • Revert docker volume mount paths in root and IAM compose files if volume mounting issues arise.
  • Roll back migration 000072 modifications if schema conflicts occur during migration rollbacks.
  • Revert Makefile golangci-lint version to previous setting if tooling incompatibilities appear.
  • Remove services/ppc/deployments/docker-compose.yaml if PPC standalone environment requires rollback.

Screenshots/Logs (if applicable)


Pre-merge Checklist

  • I have read and followed RULES.md
  • I have read and followed CONTRIBUTING.md
  • Clean Architecture principles followed
  • All errors are properly handled
  • Context is passed appropriately
  • Structured logging is used
  • No hardcoded secrets
  • PR description is complete and clear
  • CI checks are passing

Reviewer Notes

  • Running services/ppc/deployments/docker-compose.yaml concurrently with the root compose is mutually exclusive due to shared port assignments (Postgres 5436, OTLP 4317), consistent with the existing Finance service setup.
  • Migration 000072 cleanly handles legacy tables for fresh databases while leaving environments already past version 72 intact.

ilramdhan and others added 4 commits August 19, 2026 12:11
postgres:18-alpine moves PGDATA to /var/lib/postgresql/18/docker and
declares /var/lib/postgresql as its VOLUME. Mounting a named volume one
level deeper, at /var/lib/postgresql/data, makes the entrypoint abort:

  Error: in 18+, these Docker images are configured to store database
  data in a format which is compatible with "pg_ctlcluster" [...]
  Counter to that, there appears to be PostgreSQL data in:
    /var/lib/postgresql/data (unused mount/volume)

All three Postgres services in the root compose plus the IAM per-service
compose still used the old path, so they exited with code 1 on any fresh
`docker compose up -d`. services/finance/deployments already carried the
corrected path from commit "chore: update postgres volume mount path in
docker-compose" -- that fix simply never reached the other four spots.

Verified: all three databases come up healthy and report
`data_directory = /var/lib/postgresql/18/docker`.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Migration 000037 created a thread-based chat schema whose message table
was also called `chat_message` (thread_id / ciphertext / nonce / key_version).
Migration 000072 then creates the conversation-based `chat_message`
(conversation_id / body_encrypted / is_deleted) with CREATE TABLE IF NOT
EXISTS, so on any database that had run 000037 the CREATE was silently
skipped and the next statement failed:

  error: migration failed: column "is_deleted" does not exist (column 11)
  in line 17 [...] (details: pq: column "is_deleted" does not exist)

That made `make migrate-up` fail at 72 on every freshly created database,
leaving schema_migrations dirty. No migration ever dropped the 000037
tables, and `chat_thread` is not referenced anywhere under internal/ --
the live design is the conversation-based one built by 000070-000074 and
000078, so the 000037 leftovers are dead weight.

Drop them at the top of 000072 instead of editing the already-applied
000037: environments that are past 72 keep the table they have, while
fresh databases and the ones stuck mid-migration get the correct schema.

Verified against a scratch database migrated from zero: reaches version
82 with dirty=false, `chat_message` has `is_deleted`, and no `chat_thread`
tables remain.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The service Makefiles installed golangci-lint v1.62.2, but .golangci.yml
declares `version: "2"`, which only v2 can parse. `make lint` therefore
failed locally while CI passed -- the workflows already pin v2.3.0, and
ppc-service.yml even documents the divergence inline:

  GOLANGCI_LINT_VERSION: 'v2.3.0'  # NOT the service Makefile's v1.62.2
                                   # -- v1 cannot parse a `version: "2"` config

v2 also moved the command to a /v2 module path, so bumping the version
alone would not install. Update both, in all three services.

Verified: `golangci-lint linters` loads the v2 config and reports the
configured linter set.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
services/ppc/Makefile has docker-up, docker-down and docker-logs targets
pointing at deployments/docker-compose.yaml, but the directory was empty,
so all three failed:

  open .../services/ppc/deployments/docker-compose.yaml: no such file or
  directory
  make: *** [docker-up] Error 1

IAM and Finance both ship a per-service compose for single-service
development; PPC was added later and only got wired into the shared root
compose. Restore parity so the existing targets work.

PPC needs less than the other two: its config.yaml declares no redis,
rabbitmq or minio section, so only PostgreSQL and Jaeger are included.
Ports follow config.yaml defaults (postgres 5436, OTLP 4317), which makes
this file and the root compose mutually exclusive -- the same tradeoff
services/finance/deployments already makes.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@ilramdhan ilramdhan added this to the Costing Release Milestone milestone Aug 19, 2026
@ilramdhan ilramdhan self-assigned this Aug 19, 2026
Copilot AI lite review requested due to automatic review settings August 19, 2026 05:29
@ilramdhan ilramdhan added bug Something isn't working enhancement New feature or request fix labels Aug 19, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@ilramdhan
ilramdhan merged commit 733bc38 into mutugading:main Aug 19, 2026
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working enhancement New feature or request fix

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants