From 00ecaa4f468624b0f8a48f0a52f116836a14546a Mon Sep 17 00:00:00 2001 From: David Ball Date: Sat, 25 May 2024 21:35:07 -0400 Subject: [PATCH] Updated default environment. --- .env.example | 6 ++-- docker/.env.nm3clol | 40 +++++++++++++++++++++++++ docker/fullstack/docker-compose.yml | 13 ++++---- docker/nm3clol-caddy/docker-compose.yml | 14 ++++----- docker/nm3clol.Caddyfile | 11 ++----- docker/nm3clol.Dockerfile | 16 ++++++++-- docker/nm3clol/docker-compose.yml | 15 ++++++---- docker/solr-tika/docker-compose.yml | 6 ++-- docker/solr/docker-compose.yml | 3 +- docker/tika/docker-compose.yml | 26 ++++++++-------- 10 files changed, 100 insertions(+), 50 deletions(-) create mode 100644 docker/.env.nm3clol diff --git a/.env.example b/.env.example index 2a8303b1..67555753 100644 --- a/.env.example +++ b/.env.example @@ -1,9 +1,11 @@ # 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="No Moss 3 Landfill Online Library" +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://localhost" +SITE_URL="https://$SITE_HOST" # 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" diff --git a/docker/.env.nm3clol b/docker/.env.nm3clol new file mode 100644 index 00000000..67555753 --- /dev/null +++ b/docker/.env.nm3clol @@ -0,0 +1,40 @@ +# 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" + +# 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:$TIKA_PORT" diff --git a/docker/fullstack/docker-compose.yml b/docker/fullstack/docker-compose.yml index d6199c6d..ad7a6693 100644 --- a/docker/fullstack/docker-compose.yml +++ b/docker/fullstack/docker-compose.yml @@ -1,12 +1,11 @@ -version: "3.8" - +name: nm3clol services: solr: image: solr:latest container_name: solr restart: unless-stopped ports: - - "8983:8983" + - "${SOLR_DOCS_PORT-8983}:8983" volumes: - ../solr-data:/var/solr # environment: @@ -20,25 +19,25 @@ services: image: apache/tika:latest-full container_name: tika restart: unless-stopped - 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 $$@"] 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: - - "9998:9998" + - "${TIKA_PORT-9998}:9998" nm3clol: build: ../nm3clol.Dockerfile container_name: nm3clol environment: - - PORT=$APP_HTTP_LISTEN_PORT + - PORT=${APP_HTTP_LISTEN_PORT-3000} ports: - - "3000:3000" + - "$PORT:$PORT" caddy: image: caddy:latest diff --git a/docker/nm3clol-caddy/docker-compose.yml b/docker/nm3clol-caddy/docker-compose.yml index d9cba0d7..9a121807 100644 --- a/docker/nm3clol-caddy/docker-compose.yml +++ b/docker/nm3clol-caddy/docker-compose.yml @@ -1,14 +1,15 @@ -version: "3.8" - +name: nm3clol services: nm3clol: - build: ../nm3clol.Dockerfile + image: nm3clol/server-app + build: + context: ../../ + dockerfile: docker/nm3clol.Dockerfile container_name: nm3clol environment: - - PORT=$APP_HTTP_LISTEN_PORT + - PORT=${APP_HTTP_LISTEN_PORT-3000} ports: - - "3000:3000" - + - "${APP_HTTP_LISTEN_PORT-3000}:${APP_HTTP_LISTEN_PORT-3000}" caddy: image: caddy:latest restart: unless-stopped @@ -23,7 +24,6 @@ services: - $PWD/..:/srv - caddy_data:/data - caddy_config:/config - volumes: caddy_data: external: true diff --git a/docker/nm3clol.Caddyfile b/docker/nm3clol.Caddyfile index 40a1d542..89a85d82 100644 --- a/docker/nm3clol.Caddyfile +++ b/docker/nm3clol.Caddyfile @@ -1,9 +1,4 @@ -www.no-moss-3-carbo-landfill-library.online { +{$SITE_HOST} { encode gzip - redir * https://no-moss-3-carbo-landfill-library.online{uri} permanent -} - -no-moss-3-carbo-landfill-library.online { - encode gzip - reverse_proxy localhost:3000 -} + reverse_proxy {$APP_HTTP_HOST}:{$APP_HTTP_LISTEN_PORT} +} \ No newline at end of file diff --git a/docker/nm3clol.Dockerfile b/docker/nm3clol.Dockerfile index 6f8fe87a..d3923435 100644 --- a/docker/nm3clol.Dockerfile +++ b/docker/nm3clol.Dockerfile @@ -1,6 +1,16 @@ FROM node:20.12.2-bookworm -WORKDIR .. +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 3000 -CMD ["npm", "run-script", "server"] \ No newline at end of file +EXPOSE $PORT +CMD ["npm", "run-script", "server"] diff --git a/docker/nm3clol/docker-compose.yml b/docker/nm3clol/docker-compose.yml index ac2b396c..d31414b6 100644 --- a/docker/nm3clol/docker-compose.yml +++ b/docker/nm3clol/docker-compose.yml @@ -1,10 +1,15 @@ -version: "3.8" - +name: nm3clol services: nm3clol: - build: ../nm3clol.Dockerfile + 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 + - PORT=${APP_HTTP_LISTEN_PORT-3000} ports: - - "3000:3000" + - "${APP_HTTP_LISTEN_PORT-3000}:${APP_HTTP_LISTEN_PORT-3000}" diff --git a/docker/solr-tika/docker-compose.yml b/docker/solr-tika/docker-compose.yml index 8decc97b..cf138870 100644 --- a/docker/solr-tika/docker-compose.yml +++ b/docker/solr-tika/docker-compose.yml @@ -6,7 +6,7 @@ services: container_name: solr restart: unless-stopped ports: - - "8983:8983" + - "${SOLR_DOCS_PORT-8983}:8983" volumes: - ../solr-data:/var/solr # environment: @@ -20,17 +20,17 @@ services: image: apache/tika:latest-full container_name: tika restart: unless-stopped - 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 $$@"] 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: - - "9998:9998" + - "${TIKA_PORT-9998}:9998" #volumes: # data: diff --git a/docker/solr/docker-compose.yml b/docker/solr/docker-compose.yml index cef920d1..4d08e5d7 100644 --- a/docker/solr/docker-compose.yml +++ b/docker/solr/docker-compose.yml @@ -6,7 +6,7 @@ services: container_name: solr restart: unless-stopped ports: - - "8983:8983" + - "${SOLR_DOCS_PORT-8983}:8983" volumes: - ../solr-data:/var/solr # environment: @@ -15,4 +15,3 @@ services: - solr-precreate # - gettingstarted user: "1000:995" - diff --git a/docker/tika/docker-compose.yml b/docker/tika/docker-compose.yml index cef920d1..31927b55 100644 --- a/docker/tika/docker-compose.yml +++ b/docker/tika/docker-compose.yml @@ -1,18 +1,18 @@ version: '3' services: - solr: - image: solr:latest - container_name: solr + tika: + image: apache/tika:latest-full + container_name: tika restart: unless-stopped - ports: - - "8983:8983" + 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: - - ../solr-data:/var/solr -# environment: -# - SOLR_CORE=my_core - command: - - solr-precreate -# - gettingstarted - user: "1000:995" - + - ../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"