(*) Add single-node barebones configuration

This adds a single-node barebones configuration to the install script.  It also moves the log4j configuration into system.properties, and sets assertions to disabled by default.
This commit is contained in:
Viktor Lofgren 2024-01-25 16:40:28 +01:00
parent cae1bad274
commit 6aee896657
6 changed files with 203 additions and 8 deletions

2
run/env/service.env vendored
View File

@ -1,5 +1,5 @@
WMSA_HOME=run/
JAVA_OPTS="--enable-preview -ea -Dlog4j2.configurationFile=log4j2-test.xml -Dservice-host=0.0.0.0 -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=4000 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false"
JAVA_OPTS="--enable-preview -da -Dservice-host=0.0.0.0 -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=4000 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false"
JAVA_TOOL_OPTIONS="--enable-preview -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:5000"
EXECUTOR_SERVICE_OPTS="-DdistPath=/dist"
CONVERTER_PROCESS_OPTS="-Dservice-name=converter -Dservice-host=0.0.0.0"

View File

@ -38,14 +38,15 @@ INSTALL_DIR=$(realpath ${1})
echo "Would you like to set up a:"
echo
echo "1) barebones instance"
echo "2) full Marginalia Search instance?"
read -p "Enter 1 or 2: " INSTANCE_TYPE
echo "1) barebones instance (1 node)"
echo "2) barebones instance (2 nodes)"
echo "3) full Marginalia Search instance?"
read -p "Enter 1, 2 or 2: " INSTANCE_TYPE
## Validate
if [ "${INSTANCE_TYPE}" != "1" ] && [ "${INSTANCE_TYPE}" != "2" ]; then
if [ "${INSTANCE_TYPE}" != "1" ] && [ "${INSTANCE_TYPE}" != "2" ] && [ "${INSTANCE_TYPE}" != "3" ]; then
echo
echo "ERROR: Invalid instance type, choose 1 or 2"
echo "ERROR: Invalid instance type, choose 1, 2 or 3"
exit 1
fi
@ -91,6 +92,8 @@ done
# for barebones, tell the control service to hide the marginalia app specific stuff
if [ "${INSTANCE_TYPE}" == "1" ]; then
echo "control.hideMarginaliaApp=true" > ${INSTALL_DIR}/conf/properties/control-service.properties
elif [ "${INSTANCE_TYPE}" == "2" ]; then
echo "control.hideMarginaliaApp=true" > ${INSTALL_DIR}/conf/properties/control-service.properties
fi
echo "** Copying settings files"
@ -100,7 +103,9 @@ echo "** Creating directories"
mkdir -p ${INSTALL_DIR}/logs
mkdir -p ${INSTALL_DIR}/db
mkdir -p ${INSTALL_DIR}/index-1/{work,index,backup,storage,uploads}
mkdir -p ${INSTALL_DIR}/index-2/{work,index,backup,storage,uploads}
if [ "${INSTANCE_TYPE}" == "2" ] || [ "${INSTANCE_TYPE}" == "3" ]; then
mkdir -p ${INSTALL_DIR}/index-2/{work,index,backup,storage,uploads}
fi
echo "** Updating settings files"
@ -116,7 +121,9 @@ export pval="\$\$MARIADB_PASSWORD"
export INSTALL_DIR
if [ "${INSTANCE_TYPE}" == "1" ]; then
envsubst < install/docker-compose-barebones.yml.template >${INSTALL_DIR}/docker-compose.yml
envsubst < install/docker-compose-barebones-1.yml.template >${INSTALL_DIR}/docker-compose.yml
elif [ "${INSTANCE_TYPE}" == "2" ]; then
envsubst < install/docker-compose-barebones-2.yml.template >${INSTALL_DIR}/docker-compose.yml
else
envsubst < install/docker-compose-marginalia.yml.template >${INSTALL_DIR}/docker-compose.yml
fi

View File

@ -0,0 +1,186 @@
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
healthcheck:
test: curl -f http://localhost:80/internal/ping || exit 1
start_period: 1s
interval: 5s
timeout: 5s
retries: 60
x-p1: &partition-1
env_file:
- "${INSTALL_DIR}/env/service.env"
healthcheck:
test: curl -f http://localhost:80/internal/ping || exit 1
start_period: 1s
interval: 5s
timeout: 5s
retries: 60
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
environment:
- "WMSA_SERVICE_NODE=1"
services:
index-service-1:
<<: *partition-1
image: "marginalia/index-service"
container_name: "index-service-1"
depends_on:
control-service:
condition: service_healthy
executor-service-1:
<<: *partition-1
image: "marginalia/executor-service"
container_name: "executor-service-1"
depends_on:
control-service:
condition: service_healthy
query-service:
<<: *service
image: "marginalia/query-service"
container_name: "query-service"
depends_on:
control-service:
condition: service_healthy
expose:
- 80
labels:
- "traefik.enable=true"
- "traefik.http.routers.search-service.rule=PathPrefix(`/`)"
- "traefik.http.routers.search-service.entrypoints=search"
- "traefik.http.routers.search-service.middlewares=add-xpublic"
- "traefik.http.routers.search-service.middlewares=add-public"
- "traefik.http.middlewares.add-xpublic.headers.customrequestheaders.X-Public=1"
- "traefik.http.middlewares.add-public.addprefix.prefix=/public"
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"
- "traefik.http.routers.control-service.middlewares=add-xpublic"
- "traefik.http.routers.control-service.middlewares=add-public"
- "traefik.http.middlewares.add-xpublic.headers.customrequestheaders.X-Public=1"
- "traefik.http.middlewares.add-public.addprefix.prefix=/public"
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
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"
ports:
- "127.0.0.1:8080:80"
- "127.0.0.1:8081:81"
- "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

View File

@ -2,6 +2,8 @@ crawler.userAgentString = Mozilla/5.0 (compatible)
crawler.userAgentIdentifier = GoogleBot
crawler.poolSize = 256
log4j2.configurationFile=log4j2-test.xml
search.websiteUrl = http://localhost:8080/
executor.uploadDir = /uploads