Skip to content

Commit 279f97f

Browse files
committed
feat(scalardb-analytics-spark-sample): enable automatic sample data loading
- Remove profile requirement for sample-data-loader service - Add volume-based flag to track data loading completion - Implement idempotent data loading with skip on subsequent runs - Add healthcheck dependencies for database readiness
1 parent 1c6f597 commit 279f97f

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

scalardb-analytics-spark-sample/docker-compose.yml

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -142,15 +142,23 @@ services:
142142
- ./config/scalardb.properties:/etc/scalardb.properties
143143
- ./schema.json:/etc/schema.json
144144
- ./data:/data
145+
- sample-data-flags:/flags
145146
networks:
146147
- scalar-network
147-
profiles:
148-
- dev
149148
depends_on:
150-
- scalardb-cassandra
151-
- scalardb-mysql
152-
- postgres
153-
command: ["/app/bin/sample-data-loader"]
149+
scalardb-cassandra:
150+
condition: service_healthy
151+
scalardb-mysql:
152+
condition: service_healthy
153+
entrypoint: |
154+
sh -c '
155+
if [ -f /flags/.data-loaded ]; then
156+
echo "Sample data already loaded, skipping..."
157+
exit 0
158+
fi
159+
echo "Loading sample data..."
160+
/app/bin/sample-data-loader && touch /flags/.data-loaded
161+
'
154162
155163
# ===========================================
156164
# Query Execution Services
@@ -183,6 +191,7 @@ volumes:
183191
analytics-catalog-data: {}
184192
spark-ivy-cache: {}
185193
spark-m2-cache: {}
194+
sample-data-flags: {}
186195

187196
networks:
188197
scalar-network: {}

0 commit comments

Comments
 (0)