Skip to content

Commit 76cd6b9

Browse files
Convert into config script
1 parent b935cb3 commit 76cd6b9

File tree

1 file changed

+16
-20
lines changed

1 file changed

+16
-20
lines changed

scripts/docker-compose.yaml

Lines changed: 16 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ services:
2020
- "${POSTGRES_PORT:-5430}:5432"
2121
volumes:
2222
- ${POSTGRES_DATA_VOLUME:-postgres_data}:/var/lib/postgresql/data
23+
configs:
24+
- source: postgres_init
25+
target: /docker-entrypoint-initdb.d/01-create-iceberg-catalog.sh
26+
mode: 0755
2327
command: >
2428
postgres
2529
-N 1000
@@ -33,24 +37,6 @@ services:
3337
timeout: 5s
3438
retries: 5
3539

36-
# Create database for iceberg catalog
37-
create-catalog-db:
38-
image: postgres:17
39-
container_name: create-catalog-db
40-
depends_on:
41-
postgres:
42-
condition: service_healthy
43-
environment:
44-
PGHOST: postgres
45-
PGPORT: 5432
46-
PGUSER: ${POSTGRES_USER:-postgres}
47-
PGPASSWORD: ${POSTGRES_PASSWORD:-postgres}
48-
entrypoint: >
49-
/bin/sh -c "
50-
psql -c 'create database \"iceberg-catalog\";';
51-
exit 0;
52-
"
53-
5440
# Start MinIO for S3-compatible object storage
5541
minio:
5642
image: minio/minio:latest
@@ -92,8 +78,8 @@ services:
9278
restart: "no"
9379
command: ["migrate"]
9480
depends_on:
95-
create-catalog-db:
96-
condition: service_completed_successfully
81+
postgres:
82+
condition: service_healthy
9783

9884
# Start lakekeeper, an iceberg REST catalog
9985
lakekeeper:
@@ -167,6 +153,16 @@ services:
167153
volumes:
168154
- ./warehouse.json:/home/curl_user/warehouse.json
169155

156+
configs:
157+
postgres_init:
158+
content: |
159+
#!/bin/bash
160+
set -e
161+
162+
psql -v ON_ERROR_STOP=1 --username "${POSTGRES_USER:-postgres}" --dbname "${POSTGRES_DB:-postgres}" <<-EOSQL
163+
CREATE DATABASE "iceberg-catalog";
164+
EOSQL
165+
170166
volumes:
171167
postgres_data:
172168
driver: local

0 commit comments

Comments
 (0)