mirror of
https://github.com/tencentmusic/supersonic.git
synced 2025-12-10 11:07:06 +00:00
92 lines
3.4 KiB
YAML
92 lines
3.4 KiB
YAML
services:
|
|
postgres:
|
|
image: pgvector/pgvector:pg17
|
|
privileged: true
|
|
container_name: supersonic_postgres
|
|
environment:
|
|
LANG: 'C.UTF-8' # 设置环境变量
|
|
POSTGRES_ROOT_PASSWORD: root_password
|
|
POSTGRES_DATABASE: postgres
|
|
POSTGRES_USER: supersonic_user
|
|
POSTGRES_PASSWORD: supersonic_password
|
|
ports:
|
|
- "15432:5432"
|
|
# volumes:
|
|
# - postgres_data:/var/lib/postgresql
|
|
networks:
|
|
- supersonic_network
|
|
dns:
|
|
- 114.114.114.114
|
|
- 8.8.8.8
|
|
- 8.8.4.4
|
|
healthcheck:
|
|
test: ["CMD-SHELL", "sh -c 'pg_isready -U supersonic_user -d postgres'"]
|
|
interval: 30s
|
|
timeout: 10s
|
|
retries: 5
|
|
|
|
db_init:
|
|
image: supersonicbi/supersonic:${SUPERSONIC_VERSION:-latest}
|
|
privileged: true
|
|
container_name: supersonic_db_init
|
|
depends_on:
|
|
postgres:
|
|
condition: service_healthy
|
|
networks:
|
|
- supersonic_network
|
|
command: >
|
|
sh -c "
|
|
if ! PGPASSWORD=supersonic_password psql -h supersonic_postgres -U supersonic_user -d postgres -c 'select * from s2_database limit 1' > /dev/null;
|
|
then
|
|
PGPASSWORD=supersonic_password psql -hsupersonic_postgres -U supersonic_user -d postgres < /usr/src/app/supersonic-standalone-${SUPERSONIC_VERSION:-latest}/conf/db/schema-postgres.sql
|
|
PGPASSWORD=supersonic_password psql -hsupersonic_postgres -U supersonic_user -d postgres < /usr/src/app/supersonic-standalone-${SUPERSONIC_VERSION:-latest}/conf/db/schema-postgres-demo.sql
|
|
PGPASSWORD=supersonic_password psql -hsupersonic_postgres -U supersonic_user -d postgres < /usr/src/app/supersonic-standalone-${SUPERSONIC_VERSION:-latest}/conf/db/data-postgres.sql
|
|
PGPASSWORD=supersonic_password psql -hsupersonic_postgres -U supersonic_user -d postgres < /usr/src/app/supersonic-standalone-${SUPERSONIC_VERSION:-latest}/conf/db/data-postgres-demo.sql
|
|
else
|
|
echo 'Database already initialized.'
|
|
fi"
|
|
dns:
|
|
- 114.114.114.114
|
|
- 8.8.8.8
|
|
- 8.8.4.4
|
|
|
|
supersonic_standalone:
|
|
image: supersonicbi/supersonic:${SUPERSONIC_VERSION:-latest}
|
|
privileged: true
|
|
container_name: supersonic_standalone
|
|
environment:
|
|
DB_HOST: supersonic_postgres
|
|
DB_NAME: postgres
|
|
DB_USERNAME: supersonic_user
|
|
DB_PASSWORD: supersonic_password
|
|
ports:
|
|
- "9080:9080"
|
|
depends_on:
|
|
postgres:
|
|
condition: service_healthy
|
|
db_init:
|
|
condition: service_completed_successfully
|
|
networks:
|
|
- supersonic_network
|
|
dns:
|
|
- 114.114.114.114
|
|
- 8.8.8.8
|
|
- 8.8.4.4
|
|
#volumes:
|
|
#1.Named Volumes are best for persistent data managed by Docker.
|
|
#- supersonic_data:/usr/src/app/supersonic-standalone-${SUPERSONIC_VERSION:-latest}
|
|
#2.Bind Mounts are suitable for frequent modifications and debugging.
|
|
# - ./conf/application-prd.yaml:/usr/src/app/supersonic-standalone-${SUPERSONIC_VERSION:-latest}/conf/application-prd.yaml
|
|
#3.Detailed Bind Mounts offer more control over the mount behavior.
|
|
# - type: bind
|
|
# source: ./supersonic-standalone-${SUPERSONIC_VERSION:-latest}/logs
|
|
# target: /usr/src/app/supersonic-standalone-${SUPERSONIC_VERSION:-latest}/logs
|
|
# bind:
|
|
# propagation: rprivate
|
|
# create_host_path: true
|
|
#volumes:
|
|
# postgres_data:
|
|
# supersonic_data:
|
|
|
|
networks:
|
|
supersonic_network: |