Imported docker configuration from main source repository.

This commit is contained in:
David Ball 2024-05-26 01:23:51 -04:00
parent af417a6170
commit d00e69cda6
13 changed files with 341 additions and 2 deletions

42
.env.nm3clol Normal file
View File

@ -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}"

6
.gitignore vendored Normal file
View File

@ -0,0 +1,6 @@
# Production .env
.env
# Docker container data
docker/solr-data
docker/tika-data

View File

@ -1,3 +1,27 @@
# nm3clol-docker
# Docker Compose configurations
Docker container examples for No Moss 3 Carbo Landfill Online Library.
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.

View File

@ -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

View File

@ -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:

View File

@ -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:

4
nm3clol.Caddyfile Normal file
View File

@ -0,0 +1,4 @@
{$SITE_HOST} {
encode gzip
reverse_proxy {$APP_HTTP_HOST}:{$APP_HTTP_LISTEN_PORT}
}

16
nm3clol.Dockerfile Normal file
View File

@ -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"]

View File

@ -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}"

View File

@ -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:

17
solr/docker-compose.yml Normal file
View File

@ -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"

45
tika-config.xml Normal file
View File

@ -0,0 +1,45 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!--
~ 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.
-->
<properties>
<parsers>
<!-- Load TesseractOCRParser (could use DefaultParser if you want others too) -->
<parser class="org.apache.tika.parser.ocr.TesseractOCRParser"/>
<!-- OCR on Rendered Pages -->
<parser class="org.apache.tika.parser.pdf.PDFParser">
<params>
<!-- no_ocr - extract text only
ocr_only - don't extract text and just attempt OCR
ocr_and_text - extract text and attempt OCR (from Tika 1.24)
auto - extract text but if < 10 characters try OCR
-->
<param name="ocrStrategy" type="string">ocr_and_text</param>
<param name="ocrImageType" type="string">rgb</param>
<param name="ocrDPI" type="int">100</param>
</params>
</parser>
</parsers>
<server>
<params>
<logLevel>debug</logLevel>
<!-- maximum time to allow per parse before shutting down and restarting
the forked parser. Not allowed if nofork=true. -->
<taskTimeoutMillis>40000000</taskTimeoutMillis>
</params>
</server>
</properties>

18
tika/docker-compose.yml Normal file
View File

@ -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"