mirror of
https://github.com/MarginaliaSearch/MarginaliaSearch.git
synced 2025-02-23 21:18:58 +00:00

This corrects an annoying bug that had the system crash and burn on first start-up due to a race condition in service initialization, where the services were attempting to access the database before it was properly migrated. A fix was in principle already in place, but it was running too late and did not prevent attempts to access the as-yet uninitialized database. Move the first boot check into the MainClass instead of the Service constructor. The change also adds more appropriate docker dependencies to the services to fix rare errors resolving the hostname of the database.
263 lines
6.2 KiB
Plaintext
263 lines
6.2 KiB
Plaintext
x-svc: &service
|
|
env_file:
|
|
- "${INSTALL_DIR}/env/service.env"
|
|
volumes:
|
|
- conf:/wmsa/conf:ro
|
|
- model:/wmsa/model
|
|
- data:/wmsa/data
|
|
- logs:/var/log/wmsa
|
|
networks:
|
|
- wmsa
|
|
depends_on:
|
|
mariadb:
|
|
condition: service_healthy
|
|
zookeeper:
|
|
condition: service_started
|
|
x-p1: &partition-1
|
|
env_file:
|
|
- "${INSTALL_DIR}/env/service.env"
|
|
volumes:
|
|
- conf:/wmsa/conf:ro
|
|
- model:/wmsa/model
|
|
- data:/wmsa/data
|
|
- logs:/var/log/wmsa
|
|
- index-1:/idx
|
|
- work-1:/work
|
|
- backup-1:/backup
|
|
- storage-1:/storage
|
|
- uploads-1:/uploads
|
|
networks:
|
|
- wmsa
|
|
depends_on:
|
|
mariadb:
|
|
condition: service_healthy
|
|
zookeeper:
|
|
condition: service_started
|
|
environment:
|
|
- "WMSA_SERVICE_NODE=1"
|
|
x-p2: &partition-2
|
|
env_file:
|
|
- "${INSTALL_DIR}/env/service.env"
|
|
volumes:
|
|
- conf:/wmsa/conf:ro
|
|
- model:/wmsa/model
|
|
- data:/wmsa/data
|
|
- logs:/var/log/wmsa
|
|
- index-2:/idx
|
|
- work-2:/work
|
|
- backup-2:/backup
|
|
- storage-2:/storage
|
|
- uploads-2:/uploads
|
|
networks:
|
|
- wmsa
|
|
depends_on:
|
|
mariadb:
|
|
condition: service_healthy
|
|
zookeeper:
|
|
condition: service_started
|
|
environment:
|
|
- "WMSA_SERVICE_NODE=2"
|
|
services:
|
|
index-service-1:
|
|
<<: *partition-1
|
|
image: "marginalia/index-service"
|
|
container_name: "index-service-1"
|
|
executor-service-1:
|
|
<<: *partition-1
|
|
image: "marginalia/executor-service"
|
|
container_name: "executor-service-1"
|
|
index-service-2:
|
|
<<: *partition-2
|
|
image: "marginalia/index-service"
|
|
container_name: "index-service-2"
|
|
executor-service-2:
|
|
<<: *partition-2
|
|
image: "marginalia/executor-service"
|
|
container_name: "executor-service-2"
|
|
query-service:
|
|
<<: *service
|
|
image: "marginalia/query-service"
|
|
container_name: "query-service"
|
|
search-service:
|
|
<<: *service
|
|
image: "marginalia/search-service"
|
|
container_name: "search-service"
|
|
expose:
|
|
- 80
|
|
labels:
|
|
- "traefik.enable=true"
|
|
- "traefik.http.routers.search-service.rule=PathPrefix(`/`)"
|
|
- "traefik.http.routers.search-service.entrypoints=search"
|
|
assistant-service:
|
|
<<: *service
|
|
image: "marginalia/assistant-service"
|
|
container_name: "assistant-service"
|
|
expose:
|
|
- 80
|
|
labels:
|
|
- "traefik.enable=true"
|
|
- "traefik.http.routers.assistant-service-screenshot.rule=PathPrefix(`/screenshot`)"
|
|
- "traefik.http.routers.assistant-service-screenshot.entrypoints=search"
|
|
- "traefik.http.routers.assistant-service-suggest.rule=PathPrefix(`/suggest`)"
|
|
- "traefik.http.routers.assistant-service-suggest.entrypoints=search"
|
|
api-service:
|
|
<<: *service
|
|
image: "marginalia/api-service"
|
|
container_name: "api-service"
|
|
expose:
|
|
- "80"
|
|
labels:
|
|
- "traefik.enable=true"
|
|
- "traefik.http.routers.api-service.rule=PathPrefix(`/`)"
|
|
- "traefik.http.routers.api-service.entrypoints=api"
|
|
control-service:
|
|
<<: *service
|
|
image: "marginalia/control-service"
|
|
container_name: "control-service"
|
|
depends_on:
|
|
mariadb:
|
|
condition: service_healthy
|
|
expose:
|
|
- 80
|
|
labels:
|
|
- "traefik.enable=true"
|
|
- "traefik.http.routers.control-service.rule=PathPrefix(`/`)"
|
|
- "traefik.http.routers.control-service.entrypoints=control"
|
|
mariadb:
|
|
image: "mariadb:lts"
|
|
container_name: "mariadb"
|
|
env_file: "${INSTALL_DIR}/env/mariadb.env"
|
|
command: ['mysqld', '--character-set-server=utf8mb4', '--collation-server=utf8mb4_unicode_ci']
|
|
ports:
|
|
- "127.0.0.1:3306:3306/tcp"
|
|
healthcheck:
|
|
test: mysqladmin ping -h 127.0.0.1 -u ${uval} --password=${pval}
|
|
start_period: 5s
|
|
interval: 5s
|
|
timeout: 5s
|
|
retries: 60
|
|
volumes:
|
|
- db:/var/lib/mysql
|
|
networks:
|
|
- wmsa
|
|
zookeeper:
|
|
image: zookeeper
|
|
container_name: "zookeeper"
|
|
restart: always
|
|
ports:
|
|
- "127.0.0.1:2181:2181"
|
|
networks:
|
|
- wmsa
|
|
traefik:
|
|
image: "traefik:v2.10"
|
|
container_name: "traefik"
|
|
command:
|
|
#- "--log.level=DEBUG"
|
|
- "--api.insecure=true"
|
|
- "--providers.docker=true"
|
|
- "--providers.docker.exposedbydefault=false"
|
|
- "--entrypoints.search.address=:80"
|
|
- "--entrypoints.control.address=:81"
|
|
- "--entrypoints.api.address=:82"
|
|
ports:
|
|
- "127.0.0.1:8080:80"
|
|
- "127.0.0.1:8081:81"
|
|
- "127.0.0.1:8082:82"
|
|
- "127.0.0.1:8090:8080"
|
|
volumes:
|
|
- "/var/run/docker.sock:/var/run/docker.sock:ro"
|
|
networks:
|
|
- wmsa
|
|
networks:
|
|
wmsa:
|
|
volumes:
|
|
db:
|
|
driver: local
|
|
driver_opts:
|
|
type: none
|
|
o: bind
|
|
device: ${INSTALL_DIR}/db
|
|
logs:
|
|
driver: local
|
|
driver_opts:
|
|
type: none
|
|
o: bind
|
|
device: ${INSTALL_DIR}/logs
|
|
model:
|
|
driver: local
|
|
driver_opts:
|
|
type: none
|
|
o: bind
|
|
device: ${INSTALL_DIR}/model
|
|
conf:
|
|
driver: local
|
|
driver_opts:
|
|
type: none
|
|
o: bind
|
|
device: ${INSTALL_DIR}/conf
|
|
data:
|
|
driver: local
|
|
driver_opts:
|
|
type: none
|
|
o: bind
|
|
device: ${INSTALL_DIR}/data
|
|
storage-1:
|
|
driver: local
|
|
driver_opts:
|
|
type: none
|
|
o: bind
|
|
device: ${INSTALL_DIR}/index-1/storage
|
|
uploads-1:
|
|
driver: local
|
|
driver_opts:
|
|
type: none
|
|
o: bind
|
|
device: ${INSTALL_DIR}/index-1/uploads
|
|
index-1:
|
|
driver: local
|
|
driver_opts:
|
|
type: none
|
|
o: bind
|
|
device: ${INSTALL_DIR}/index-1/index
|
|
work-1:
|
|
driver: local
|
|
driver_opts:
|
|
type: none
|
|
o: bind
|
|
device: ${INSTALL_DIR}/index-1/work
|
|
backup-1:
|
|
driver: local
|
|
driver_opts:
|
|
type: none
|
|
o: bind
|
|
device: ${INSTALL_DIR}/index-1/backup
|
|
storage-2:
|
|
driver: local
|
|
driver_opts:
|
|
type: none
|
|
o: bind
|
|
device: ${INSTALL_DIR}/index-2/storage
|
|
uploads-2:
|
|
driver: local
|
|
driver_opts:
|
|
type: none
|
|
o: bind
|
|
device: ${INSTALL_DIR}/index-2/uploads
|
|
index-2:
|
|
driver: local
|
|
driver_opts:
|
|
type: none
|
|
o: bind
|
|
device: ${INSTALL_DIR}/index-2/index
|
|
work-2:
|
|
driver: local
|
|
driver_opts:
|
|
type: none
|
|
o: bind
|
|
device: ${INSTALL_DIR}/index-2/work
|
|
backup-2:
|
|
driver: local
|
|
driver_opts:
|
|
type: none
|
|
o: bind
|
|
device: ${INSTALL_DIR}/index-2/backup |