From d00e69cda63a30cdfe6869dee3cc7d36401c3809 Mon Sep 17 00:00:00 2001 From: David Ball Date: Sun, 26 May 2024 01:23:51 -0400 Subject: [PATCH] Imported docker configuration from main source repository. --- .env.nm3clol | 42 ++++++++++++++++++++++ .gitignore | 6 ++++ README.md | 28 +++++++++++++-- TesseractOCRConfig.properties | 26 ++++++++++++++ fullstack/docker-compose.yml | 60 ++++++++++++++++++++++++++++++++ nm3clol-caddy/docker-compose.yml | 30 ++++++++++++++++ nm3clol.Caddyfile | 4 +++ nm3clol.Dockerfile | 16 +++++++++ nm3clol/docker-compose.yml | 15 ++++++++ solr-tika/docker-compose.yml | 36 +++++++++++++++++++ solr/docker-compose.yml | 17 +++++++++ tika-config.xml | 45 ++++++++++++++++++++++++ tika/docker-compose.yml | 18 ++++++++++ 13 files changed, 341 insertions(+), 2 deletions(-) create mode 100644 .env.nm3clol create mode 100644 .gitignore create mode 100644 TesseractOCRConfig.properties create mode 100644 fullstack/docker-compose.yml create mode 100644 nm3clol-caddy/docker-compose.yml create mode 100644 nm3clol.Caddyfile create mode 100644 nm3clol.Dockerfile create mode 100644 nm3clol/docker-compose.yml create mode 100644 solr-tika/docker-compose.yml create mode 100644 solr/docker-compose.yml create mode 100644 tika-config.xml create mode 100644 tika/docker-compose.yml diff --git a/.env.nm3clol b/.env.nm3clol new file mode 100644 index 0000000..c874a06 --- /dev/null +++ b/.env.nm3clol @@ -0,0 +1,42 @@ +# You will need a .env file to use with the Docker containers. This is set up for localhost use with the Docker Compose fullstack. + +# SITE_NAME is used for page generation. +SITE_NAME="(dev) No Moss 3 Carbo Landfill Online Localhost" +# SITE_HOST is used for generating links for the search index. (If you leave this blank it should work using relative paths.) +SITE_HOST="localhost" +# SITE_URL is used for generating links for the search index. (If you leave this blank it should work using relative paths.) +SITE_URL="https://${SITE_HOST}" +# WELCOME_MSG is used for the homepage instead of "Welcome to ${SITE_NAME}!" +WELCOME_MSG="Devel' It Up, Developer!" + +# APP_HTTP_LISTEN_PORT is the TCP port used to access the Node application's HTTP interface (usually by a reverse proxy). +APP_HTTP_HOST="nm3clol" +# APP_HTTP_LISTEN_PORT is the TCP port used to access the Node application's HTTP interface (usually by a reverse proxy). +APP_HTTP_LISTEN_PORT=3000 +# APP_URL is the URL used to access the Node application (usually by a reverse proxy). +APP_HTTP_URL="http://${APP_HTTP_HOST}:${APP_HTTP_LISTEN_PORT}" + +# SOLR_DOCS_HOST is the host for Apache Solr's core for indexed documents. +SOLR_DOCS_HOST="solr" +# SOLR_DOCS_PORT is the port for Apache Solr's core for indexed documents. +SOLR_DOCS_PORT=8983 +# SOLR_DOCS_CORE_NAME is the core name for Apache Solr's core for indexed documents. +SOLR_DOCS_CORE_NAME="nm3clol_core" +# SOLR_DOCS_URL is the URL to access Apache Solr's core for indexed documents. It is used by Gulp and the Search feature. +SOLR_DOCS_URL="http://${SOLR_DOCS_HOST}:${SOLR_DOCS_PORT}/solr/${SOLR_DOCS_CORE_NAME}" + +# SOLR_LAW_HOST is the host for Apache Solr's core for indexed laws. +SOLR_LAW_HOST="$SOLR_DOCS_HOST" +# SOLR_LAW_PORT is the host for Apache Solr's core for indexed laws. +SOLR_LAW_PORT=$SOLR_DOCS_PORT +# SOLR_LAW_CORE_NAME is the core name for Apache Solr's core for indexed laws. +SOLR_LAW_CORE_NAME="vacode_core" +# SOLR_LAW_URL is the URL to access Apache Solr's core for indexed laws. It is used by Gulp (and eventually the Search feature.) +SOLR_LAW_URL="http://${SOLR_LAW_HOST}:${SOLR_LAW_PORT}/solr/${SOLR_LAW_CORE_NAME}" + +# TIKA_HOST is the URL to access the host running Apache Tika. +TIKA_HOST="tika" +# TIKA_PORT is the URL to access the host running Apache Tika. +TIKA_PORT=9998 +# TIKA_URL is the URL to access the host running Apache Tika. +TIKA_URL="http://${TIKA_HOST}:${TIKA_PORT}" diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..fa3b7f0 --- /dev/null +++ b/.gitignore @@ -0,0 +1,6 @@ +# Production .env +.env + +# Docker container data +docker/solr-data +docker/tika-data diff --git a/README.md b/README.md index 74ba134..85445d7 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,27 @@ -# nm3clol-docker +# Docker Compose configurations -Docker container examples for No Moss 3 Carbo Landfill Online Library. \ No newline at end of file +Here are some Docker Compose configuration examples. + +## fullstack + +Example fullstack Solr, Tika with Tesseract, Web App, and Reverse Proxy instance. + +## nm3clol + +Minimal Web App only, no reverse proxy. + +## nm3clol-caddy + +Web App only with Caddy reverse proxy. + +## solr + +Minimal Solr instance. + +## solr-tika + +Solr and Tika with Tesseract together. + +## tika + +Minimal Tika with Tesseract instance. diff --git a/TesseractOCRConfig.properties b/TesseractOCRConfig.properties new file mode 100644 index 0000000..1d9c3ff --- /dev/null +++ b/TesseractOCRConfig.properties @@ -0,0 +1,26 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# You customise or add the settings you want here +language=eng +#language=eng+spa+fra+deu+ita +timeout=240 +minFileSizeToOcr=1 +enableImageProcessing=0 +density=200 +depth=8 +filter=box +resize=300 +applyRotation=true diff --git a/fullstack/docker-compose.yml b/fullstack/docker-compose.yml new file mode 100644 index 0000000..ad7a669 --- /dev/null +++ b/fullstack/docker-compose.yml @@ -0,0 +1,60 @@ +name: nm3clol +services: + solr: + image: solr:latest + container_name: solr + restart: unless-stopped + ports: + - "${SOLR_DOCS_PORT-8983}:8983" + volumes: + - ../solr-data:/var/solr +# environment: +# - SOLR_CORE=my_core + command: + - solr-precreate +# - gettingstarted + user: "1000:995" + + tika: + image: apache/tika:latest-full + container_name: tika + restart: unless-stopped + environment: + - TIKA_LOG_PATH=/tika-logs + command: -c /tika-config.xml + entrypoint: [ "/bin/sh", "-c", "exec java -cp \"/customocr:/tika-server-standard-2.9.2.jar:/tika-extras/*\" org.apache.tika.server.core.TikaServerCli -h 0.0.0.0 $$0 $$@"] + volumes: + - ../tika-config.xml:/tika-config.xml + - ../tika-data/logs:/tika-logs + - ../tika-data/log4j2.xml:/log4j2.xml + - ../TesseractOCRConfig.properties:/TesseractOCRConfig.properties + ports: + - "${TIKA_PORT-9998}:9998" + + nm3clol: + build: ../nm3clol.Dockerfile + container_name: nm3clol + environment: + - PORT=${APP_HTTP_LISTEN_PORT-3000} + ports: + - "$PORT:$PORT" + + caddy: + image: caddy:latest + restart: unless-stopped + cap_add: + - NET_ADMIN + ports: + - "80:80" + - "443:443" + - "443:443/udp" + volumes: + - $PWD/../nm3clol.Caddyfile:/etc/caddy/Caddyfile + - $PWD/..:/srv + - caddy_data:/data + - caddy_config:/config + +volumes: + caddy_data: + external: true + caddy_config: \ No newline at end of file diff --git a/nm3clol-caddy/docker-compose.yml b/nm3clol-caddy/docker-compose.yml new file mode 100644 index 0000000..9a12180 --- /dev/null +++ b/nm3clol-caddy/docker-compose.yml @@ -0,0 +1,30 @@ +name: nm3clol +services: + nm3clol: + image: nm3clol/server-app + build: + context: ../../ + dockerfile: docker/nm3clol.Dockerfile + container_name: nm3clol + environment: + - PORT=${APP_HTTP_LISTEN_PORT-3000} + ports: + - "${APP_HTTP_LISTEN_PORT-3000}:${APP_HTTP_LISTEN_PORT-3000}" + caddy: + image: caddy:latest + restart: unless-stopped + cap_add: + - NET_ADMIN + ports: + - "80:80" + - "443:443" + - "443:443/udp" + volumes: + - $PWD/../nm3clol.Caddyfile:/etc/caddy/Caddyfile + - $PWD/..:/srv + - caddy_data:/data + - caddy_config:/config +volumes: + caddy_data: + external: true + caddy_config: \ No newline at end of file diff --git a/nm3clol.Caddyfile b/nm3clol.Caddyfile new file mode 100644 index 0000000..89a85d8 --- /dev/null +++ b/nm3clol.Caddyfile @@ -0,0 +1,4 @@ +{$SITE_HOST} { + encode gzip + reverse_proxy {$APP_HTTP_HOST}:{$APP_HTTP_LISTEN_PORT} +} \ No newline at end of file diff --git a/nm3clol.Dockerfile b/nm3clol.Dockerfile new file mode 100644 index 0000000..d392343 --- /dev/null +++ b/nm3clol.Dockerfile @@ -0,0 +1,16 @@ +FROM node:20.12.2-bookworm +ENV CHECKOUT=main +VOLUME /usr/src/app +RUN apt update && apt upgrade -y && apt install git +RUN mkdir -p /usr/src/app/.git +RUN chown -R node:node /usr/src/app +RUN chmod -R 770 /usr/src/app +USER node +RUN git lfs install +ADD --keep-git-dir ../../.git /usr/src/app/.git +WORKDIR /usr/src/app +RUN git checkout +RUN npm install +RUN npm run-script transpile:ts +EXPOSE $PORT +CMD ["npm", "run-script", "server"] diff --git a/nm3clol/docker-compose.yml b/nm3clol/docker-compose.yml new file mode 100644 index 0000000..d31414b --- /dev/null +++ b/nm3clol/docker-compose.yml @@ -0,0 +1,15 @@ +name: nm3clol +services: + nm3clol: + image: nm3clol/server-app + build: + # context: ../../ + dockerfile: ../nm3clol.Dockerfile + container_name: nm3clol + volumes: + - ../../:/usr/src/app:rw + - ../nm3clol-node_modules:/usr/src/app/node_modules:rw + environment: + - PORT=${APP_HTTP_LISTEN_PORT-3000} + ports: + - "${APP_HTTP_LISTEN_PORT-3000}:${APP_HTTP_LISTEN_PORT-3000}" diff --git a/solr-tika/docker-compose.yml b/solr-tika/docker-compose.yml new file mode 100644 index 0000000..cf13887 --- /dev/null +++ b/solr-tika/docker-compose.yml @@ -0,0 +1,36 @@ +version: '3' + +services: + solr: + image: solr:latest + container_name: solr + restart: unless-stopped + ports: + - "${SOLR_DOCS_PORT-8983}:8983" + volumes: + - ../solr-data:/var/solr +# environment: +# - SOLR_CORE=my_core + command: + - solr-precreate +# - gettingstarted + user: "1000:995" + + tika: + image: apache/tika:latest-full + container_name: tika + restart: unless-stopped + environment: + - TIKA_LOG_PATH=/tika-logs + command: -c /tika-config.xml + entrypoint: [ "/bin/sh", "-c", "exec java -cp \"/customocr:/tika-server-standard-2.9.2.jar:/tika-extras/*\" org.apache.tika.server.core.TikaServerCli -h 0.0.0.0 $$0 $$@"] + volumes: + - ../tika-config.xml:/tika-config.xml + - ../tika-data/logs:/tika-logs + - ../tika-data/log4j2.xml:/log4j2.xml + - ../TesseractOCRConfig.properties:/TesseractOCRConfig.properties + ports: + - "${TIKA_PORT-9998}:9998" + +#volumes: +# data: diff --git a/solr/docker-compose.yml b/solr/docker-compose.yml new file mode 100644 index 0000000..4d08e5d --- /dev/null +++ b/solr/docker-compose.yml @@ -0,0 +1,17 @@ +version: '3' + +services: + solr: + image: solr:latest + container_name: solr + restart: unless-stopped + ports: + - "${SOLR_DOCS_PORT-8983}:8983" + volumes: + - ../solr-data:/var/solr +# environment: +# - SOLR_CORE=my_core + command: + - solr-precreate +# - gettingstarted + user: "1000:995" diff --git a/tika-config.xml b/tika-config.xml new file mode 100644 index 0000000..ea99358 --- /dev/null +++ b/tika-config.xml @@ -0,0 +1,45 @@ + + + + + + + + + + + + ocr_and_text + rgb + 100 + + + + + + debug + + 40000000 + + + \ No newline at end of file diff --git a/tika/docker-compose.yml b/tika/docker-compose.yml new file mode 100644 index 0000000..31927b5 --- /dev/null +++ b/tika/docker-compose.yml @@ -0,0 +1,18 @@ +version: '3' + +services: + tika: + image: apache/tika:latest-full + container_name: tika + restart: unless-stopped + environment: + - TIKA_LOG_PATH=/tika-logs + command: -c /tika-config.xml + entrypoint: [ "/bin/sh", "-c", "exec java -cp \"/customocr:/tika-server-standard-2.9.2.jar:/tika-extras/*\" org.apache.tika.server.core.TikaServerCli -h 0.0.0.0 $$0 $$@"] + volumes: + - ../tika-config.xml:/tika-config.xml + - ../tika-data/logs:/tika-logs + - ../tika-data/log4j2.xml:/log4j2.xml + - ../TesseractOCRConfig.properties:/TesseractOCRConfig.properties + ports: + - "${TIKA_PORT-9998}:9998"