Co-authored-by: Hamza Ali <sunturtle@hamza.sh> Co-committed-by: Hamza Ali <sunturtle@hamza.sh>
64 lines
1.5 KiB
YAML
64 lines
1.5 KiB
YAML
services:
|
|
# Infrastructure
|
|
db:
|
|
image: postgres:17.4
|
|
command: >
|
|
bash -c '
|
|
create_db() {
|
|
local db_name=$$1
|
|
local full_name=$$db_name
|
|
|
|
if ! psql -U postgres -lqt | cut -d "|" -f 1 | grep -qw $$full_name; then
|
|
psql -U postgres -c "CREATE DATABASE $$full_name"
|
|
fi
|
|
}
|
|
|
|
/usr/local/bin/docker-entrypoint.sh postgres &
|
|
|
|
echo "Creating databases..." &&
|
|
sleep 1 &&
|
|
for db in ligmotes worker; do create_db $$db; done &&
|
|
wait
|
|
'
|
|
environment:
|
|
- POSTGRES_USER=postgres
|
|
- POSTGRES_PASSWORD=postgres
|
|
healthcheck:
|
|
interval: 3s
|
|
retries: 5
|
|
test: ["CMD-SHELL", "pg_isready -U postgres"]
|
|
timeout: 5s
|
|
ports:
|
|
- 5432:5432
|
|
profiles:
|
|
- infra
|
|
restart: on-failure
|
|
|
|
db-ui:
|
|
image: sosedoff/pgweb:0.16.2
|
|
environment:
|
|
- DATABASE_URL=postgres://postgres:postgres@db:5432/ligmotes?sslmode=disable&search_path=public
|
|
ports:
|
|
- 8081:8081
|
|
profiles:
|
|
- infra
|
|
restart: on-failure
|
|
|
|
storage:
|
|
image: minio/minio:RELEASE.2024-11-07T00-52-20Z
|
|
command: minio server /data --console-address "0.0.0.0:9001"
|
|
environment:
|
|
- MINIO_ROOT_USER=minioadmin
|
|
- MINIO_ROOT_PASSWORD=minioadmin
|
|
healthcheck:
|
|
interval: 3s
|
|
retries: 5
|
|
test: timeout 5s bash -c ':> /dev/tcp/0.0.0.0/9000' || exit 1
|
|
timeout: 5s
|
|
ports:
|
|
- 9000:9000
|
|
- 9001:9001
|
|
profiles:
|
|
- infra
|
|
restart: on-failure
|