Skip to content

Commit 873361f

Browse files
Convert into config script
1 parent cb580cf commit 873361f

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
@@ -93,8 +79,8 @@ services:
9379
restart: "no"
9480
command: ["migrate"]
9581
depends_on:
96-
create-catalog-db:
97-
condition: service_completed_successfully
82+
postgres:
83+
condition: service_healthy
9884

9985
# Start lakekeeper, an iceberg REST catalog
10086
lakekeeper:
@@ -168,6 +154,16 @@ services:
168154
volumes:
169155
- ./warehouse.json:/home/curl_user/warehouse.json
170156

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

0 commit comments

Comments
 (0)