Repository navigation
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
96 lines (93 loc) · 4.12 KB
/
Copy pathdocker-compose.yml
File metadata and controls
96 lines (93 loc) · 4.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
services:
app:
# The published image by default, so the first run is a pull rather than a
# multi-minute apt/pip build on a laptop that has no reason to compile
# anything. To build from your working tree instead, copy
# docker-compose.override.yml.example — Compose merges it and its `build:`
# wins. Pin a version with CLI2UI_IMAGE (e.g. jiniie/cli2ui:1.3.0).
image: ${CLI2UI_IMAGE:-jiniie/cli2ui:latest}
ports:
- "8000:8000"
environment:
# Saved connections and auto-backups live in one SQLite file. Without the
# source tree mounted it would sit inside the container and disappear the
# next time the container is recreated, so put it on a named volume.
CLI2UI_DB_PATH: /data/db.sqlite3
# Timezone the app shows its own timestamps in (backups, snapshots). The
# container is UTC unless told otherwise, so pass the host's if you want
# local time: TZ=Asia/Tokyo docker compose up, or set TZ in .env.
# Values read out of your database are never converted — they are shown
# exactly as the database returned them, offset included.
TZ: ${TZ:-UTC}
volumes:
- cli2ui-data:/data
# Lets you reach a database running elsewhere on the host (another container
# that publishes a port, or a native install) by connecting cli2ui to
# host.docker.internal. Docker Desktop (Mac/Windows) provides this name
# automatically; host-gateway adds it on Linux too, so the connect steps in
# the README are the same on every platform.
extra_hosts:
- "host.docker.internal:host-gateway"
depends_on:
sampledb:
condition: service_healthy
# Bundled sample database so the app has something to show on first run.
# Connect to it with host=sampledb, db=shop, user=demo, password=demo
# (these are the pre-filled defaults on the connection form).
sampledb:
image: postgres:16
environment:
POSTGRES_USER: demo
POSTGRES_PASSWORD: demo
POSTGRES_DB: shop
volumes:
- ./seed/init.sql:/docker-entrypoint-initdb.d/init.sql:ro
ports:
- "5433:5432" # exposed on 5433 to avoid clashing with a local Postgres
healthcheck:
test: ["CMD-SHELL", "pg_isready -U demo -d shop"]
interval: 3s
timeout: 3s
retries: 10
# Optional, bigger demo database: the Postgres Pro "Airlines" dataset
# (bookings/flights, ~250MB restored, jsonb columns and real data volume —
# good for exercising features the tiny shop db can't, like the jsonb shape
# viewer). Opt-in because the dump must be downloaded first:
#
# seed/demo/fetch.sh # ~60MB download
# docker compose --profile demo up -d airlines # first boot loads for a few minutes
#
# Connect with host=airlines (or localhost:5434 from the host), db=demo,
# user=demo, password=demo. The loaded data lives in a named volume, so the
# multi-minute load happens once, not on every `up`.
airlines:
image: postgres:16
profiles: ["demo"]
# Multi-minute reload on every restart otherwise: unless-stopped means a
# Docker Desktop restart (or the host coming back from sleep) brings it
# straight back up instead of leaving it exited until someone notices and
# re-runs the --profile demo command by hand.
restart: unless-stopped
environment:
POSTGRES_USER: demo
POSTGRES_PASSWORD: demo
volumes:
- ./seed/demo/load-demo.sh:/docker-entrypoint-initdb.d/10-load-demo.sh:ro
- ./seed/demo:/seed:ro
- airlines-data:/var/lib/postgresql/data
ports:
- "5434:5432" # 5433 is taken by sampledb
healthcheck:
# -h localhost forces TCP: the temporary server that runs while the init
# scripts load the dump listens on the unix socket only, so a socket
# check would report healthy minutes before the data is actually there.
test: ["CMD-SHELL", "pg_isready -h localhost -U demo -d demo"]
interval: 5s
timeout: 5s
retries: 20
# Generous grace period: the first boot restores the whole dump before
# the server starts accepting TCP connections.
start_period: 600s
volumes:
airlines-data:
cli2ui-data: