Skip to content

Commit

Permalink
fix(payments): fix docker compose to test it locally (#880)
Browse files Browse the repository at this point in the history
  • Loading branch information
paul-nicolas authored Nov 21, 2023
1 parent a0c793a commit 9e76f30
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 10 deletions.
62 changes: 52 additions & 10 deletions components/payments/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,30 +11,72 @@ services:
timeout: 5s
retries: 5
ports:
- "5432:5432"
- "${POSTGRES_PORT:-5432}:${POSTGRES_PORT:-5432}"
environment:
POSTGRES_USER: "payments"
POSTGRES_PASSWORD: "payments"
POSTGRES_DB: "payments"
PGDATA: /data/postgres
command: -p ${POSTGRES_PORT:-5432}
volumes:
- postgres:/data/postgres
- ./local_env/postgres/init.sql:/docker-entrypoint-initdb.d/init.sql

payments:
image: golang:1.19.3-alpine3.16
command: go run ./ migrate up && go run ./ serve
payments-migrate:
image: golang:1.20.11-alpine3.18
command: go run ./ migrate up
depends_on:
postgres:
condition: service_healthy
volumes:
- .:/app/components/payments
- ../../libs:/app/libs
working_dir: /app/components/payments
environment:
POSTGRES_URI: postgres://payments:payments@postgres:${POSTGRES_PORT:-5432}/payments?sslmode=disable

payments-api:
image: golang:1.20.11-alpine3.18
command: go run ./ api server
healthcheck:
test: [ "CMD", "curl", "-f", "http://127.0.0.1:8080/_healthcheck" ]
interval: 10s
timeout: 5s
retries: 5
depends_on:
- postgres
postgres:
condition: service_healthy
payments-migrate:
condition: service_completed_successfully
ports:
- "8080:8080"
volumes:
- .:/app
working_dir: /app
- .:/app/components/payments
- ../../libs:/app/libs
working_dir: /app/components/payments
environment:
DEBUG: ${DEBUG:-"true"}
POSTGRES_URI: postgres://payments:payments@postgres:${POSTGRES_PORT:-5432}/payments?sslmode=disable
CONFIG_ENCRYPTION_KEY: mysuperencryptionkey

payments-connectors:
image: golang:1.20.11-alpine3.18
command: go run ./ connectors server
healthcheck:
test: [ "CMD", "curl", "-f", "http://127.0.0.1:8081/_healthcheck" ]
interval: 10s
timeout: 5s
retries: 5
depends_on:
postgres:
condition: service_healthy
payments-migrate:
condition: service_completed_successfully
ports:
- "8081:8080"
volumes:
- .:/app/components/payments
- ../../libs:/app/libs
working_dir: /app/components/payments
environment:
DEBUG: ${DEBUG:-"true"}
POSTGRES_URI: postgres://payments:payments@postgres/payments?sslmode=disable
POSTGRES_URI: postgres://payments:payments@postgres:${POSTGRES_PORT:-5432}/payments?sslmode=disable
CONFIG_ENCRYPTION_KEY: mysuperencryptionkey
1 change: 1 addition & 0 deletions components/payments/local_env/postgres/init.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ALTER ROLE payments SET search_path = public;

1 comment on commit 9e76f30

@vercel
Copy link

@vercel vercel bot commented on 9e76f30 Nov 21, 2023

Choose a reason for hiding this comment

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

Please sign in to comment.