|
| 1 | +# Not recommended for production use, and should only be used for local development! |
| 2 | +# This is only a template, feel free to tweak this to fit your needs. |
| 3 | +name: cardano-db-sync |
| 4 | + |
| 5 | +services: |
| 6 | + postgres: |
| 7 | + image: postgres:14.10-alpine |
| 8 | + environment: |
| 9 | + - POSTGRES_LOGGING=true |
| 10 | + - POSTGRES_DB=cexplorer |
| 11 | + - POSTGRES_USER=postgres |
| 12 | + - POSTGRES_PASSWORD=v8hlDV0yMAHHlIurYupj |
| 13 | + networks: |
| 14 | + - postgres |
| 15 | + ports: |
| 16 | + - 5432:5432 |
| 17 | + volumes: |
| 18 | + - postgres:/var/lib/postgresql/data |
| 19 | + restart: on-failure |
| 20 | + healthcheck: |
| 21 | + # Use pg_isready to check postgres is running. Substitute different |
| 22 | + # user `postgres` if you've setup differently to config/pgpass-mainnet |
| 23 | + test: ["CMD-SHELL", "pg_isready -U postgres"] |
| 24 | + interval: 10s |
| 25 | + timeout: 5s |
| 26 | + retries: 5 |
| 27 | + command: |
| 28 | + - -c |
| 29 | + - maintenance_work_mem=1GB |
| 30 | + - -c |
| 31 | + - max_parallel_maintenance_workers=4 |
| 32 | + logging: |
| 33 | + driver: "json-file" |
| 34 | + options: |
| 35 | + max-size: "200k" |
| 36 | + max-file: "10" |
| 37 | + |
| 38 | + cardano-node: |
| 39 | + image: ghcr.io/intersectmbo/cardano-node:9.0.0 |
| 40 | + environment: |
| 41 | + - NETWORK=${NETWORK:-mainnet} |
| 42 | + networks: |
| 43 | + - cardano-node |
| 44 | + volumes: |
| 45 | + - node-db:/data/db |
| 46 | + - node-ipc:/ipc |
| 47 | + restart: on-failure |
| 48 | + healthcheck: |
| 49 | + # Ping the EKG port to see if it responds. |
| 50 | + # Assuming if EKG isn't up then the rest of cardano-node isn't either. |
| 51 | + test: ["CMD-SHELL", "curl -f 127.0.0.1:12788 || exit 1"] |
| 52 | + interval: 60s |
| 53 | + timeout: 10s |
| 54 | + retries: 5 |
| 55 | + logging: |
| 56 | + driver: "json-file" |
| 57 | + options: |
| 58 | + max-size: "200k" |
| 59 | + max-file: "10" |
| 60 | + |
| 61 | + cardano-db-sync: |
| 62 | + image: ghcr.io/intersectmbo/cardano-db-sync:13.3.0.0 |
| 63 | + environment: |
| 64 | + - NETWORK=${NETWORK:-mainnet} |
| 65 | + - POSTGRES_HOST=postgres |
| 66 | + - POSTGRES_PORT=5432 |
| 67 | + - POSTGRES_DB=cexplorer |
| 68 | + - POSTGRES_USER=postgres |
| 69 | + - POSTGRES_PASSWORD=v8hlDV0yMAHHlIurYupj |
| 70 | + depends_on: |
| 71 | + # Depend on both services to be healthy before starting. |
| 72 | + cardano-node: |
| 73 | + condition: service_healthy |
| 74 | + postgres: |
| 75 | + condition: service_healthy |
| 76 | + networks: |
| 77 | + - cardano-node |
| 78 | + - postgres |
| 79 | + volumes: |
| 80 | + - db-sync-data:/var/lib/cexplorer |
| 81 | + - node-ipc:/node-ipc |
| 82 | + restart: on-failure |
| 83 | + logging: |
| 84 | + driver: "json-file" |
| 85 | + options: |
| 86 | + max-size: "200k" |
| 87 | + max-file: "10" |
| 88 | + |
| 89 | +volumes: |
| 90 | + volumes: |
| 91 | + db-sync-data: |
| 92 | + postgres: |
| 93 | + node-db: |
| 94 | + node-ipc: |
| 95 | + |
| 96 | +networks: |
| 97 | + cardano-node: {} |
| 98 | + postgres: {} |
0 commit comments