Removing old docker setup

This commit is contained in:
eikek 2021-06-16 00:31:21 +02:00
parent 11bd15e845
commit 6984df42de
16 changed files with 0 additions and 626 deletions

View File

@ -1,11 +0,0 @@
TZ=Europe/Berlin
DOCSPELL_HEADER_VALUE=none
DB_TYPE=postgresql
DB_HOST=db
DB_PORT=5432
DB_NAME=dbname
DB_USER=dbuser
DB_PASS=dbpass
CONSUMEDIR_VERBOSE=y
CONSUMEDIR_INTEGRATION=y
CONSUMEDIR_POLLING=n

View File

@ -1,46 +0,0 @@
FROM alpine:latest
LABEL maintainer="eikek0 <eike@docspell.org>"
ARG ELM_VERSION=0.19.1
ARG SBT_VERSION=
RUN apk add --virtual .build-dependencies --no-cache git curl bash openjdk11 npm
# ELM
RUN curl -L -o elm.gz https://github.com/elm/compiler/releases/download/${ELM_VERSION}/binary-for-linux-64-bit.gz
RUN gunzip elm.gz
RUN chmod +x elm
RUN mv elm /usr/local/bin/
# SBT (Scala)
ENV PATH /sbt/bin:$PATH
RUN wget https://github.com/sbt/sbt/releases/download/v${SBT_VERSION}/sbt-${SBT_VERSION}.tgz
RUN tar -xzvf sbt-$SBT_VERSION.tgz
RUN rm sbt-$SBT_VERSION.tgz
# DOCSPELL
RUN mkdir -p /src/docspell
COPY . /src/docspell/
# for a build without cloned project the following line would replace the one above
# RUN git -C /src clone https://github.com/eikek/docspell
WORKDIR /src/docspell
RUN sbt -J-XX:+UseG1GC -J-XX:+PrintCommandLineFlags -mem 2048 make make-zip make-tools
RUN mkdir -p /opt
RUN find "/src/docspell/modules/joex/target/universal/" -name "docspell-joex*.zip" -exec unzip {} -d "/opt/" \;
RUN mv /opt/docspell-joex-* /opt/docspell-joex
RUN find "/src/docspell/modules/restserver/target/universal/" -name "docspell-restserver*.zip" -exec unzip {} -d "/opt/" \;
RUN mv /opt/docspell-restserver-* /opt/docspell-restserver
RUN find "/src/docspell/tools/target/" -name "docspell-tools-*.zip" -exec unzip {} -d "/opt/" \;
RUN mv /opt/docspell-tools-* /opt/docspell-tools
RUN chmod 755 /opt/docspell-tools/**/*.sh
COPY ./docker/docspell.conf /opt/docspell.conf
# CLEANUP
WORKDIR /
RUN rm -r /src
RUN apk del .build-dependencies
RUN rm -r /root/.cache

View File

@ -1,11 +0,0 @@
FROM alpine:latest
LABEL maintainer="eikek0 <eike@docspell.org>"
ENV DB_TYPE=postgresql \
DB_HOST=db \
DB_PORT=5432 \
DB_NAME=dbname \
DB_USER=dbuser \
DB_PASS=dbpass
RUN apk add --no-cache tzdata

View File

@ -1,88 +0,0 @@
#!/usr/bin/env bash
# This script watches a directory for new files and uploads them to
# docspell. Or it uploads all files currently in the directory.
#
# It requires inotifywait, curl and sha256sum if the `-m' option is
# used.
# saner programming env: these switches turn some bugs into errors
set -o errexit -o pipefail -o noclobber -o nounset
showUsage() {
echo "Options:"
echo " CONSUMEDIR_VERBOSE=y Print more to stdout."
echo " CONSUMEDIR_DELETE=y Delete the file if successfully uploaded. (value: $delete)"
echo " CONSUMEDIR_UNIQUE=y Optional. Upload only if the file doesn't already exist. (value: $distinct)"
echo " CONSUMEDIR_ONCE=y Instead of watching, upload all files in that dir."
echo " CONSUMEDIR_PATH=/opt/docs The directories to watch."
echo " CONSUMEDIR_POLLING=y Enables the polling mode instead of using inotifywait"
echo " CONSUMEDIR_POLLING_INTERVAL=60 Sets the interval for polling mode"
echo " CONSUMEDIR_ENDPOINT= Sets the endpoint URL"
echo " CONSUMEDIR_INTEGRATION=y Upload to the integration endpoint. It implies -r. This puts the script in"
echo " a different mode, where the first subdirectory of any given starting point"
echo " is read as the collective name. The url(s) are completed with this name in"
echo " order to upload files to the respective collective. So each directory"
echo " given is expected to contain one subdirectory per collective and the urls"
echo " are expected to identify the integration endpoint, which is"
echo " /api/v1/open/integration/item/<collective-name>. (value: $integration)"
echo " DOCSPELL_HEADER_VALUE= The header name and value to use with the integration endpoint. This must be"
echo " in form 'headername:value'. Only used if '-i' is supplied."
echo " CONSUMEDIR_ARGS= Allows to specify a custom command line that is passed to the consumedir script"
echo " CONSUMEDIR_SCRIPT= Allows to override the location of the consumedir script"
}
CONSUMEDIR_SCRIPT=${CONSUMEDIR_SCRIPT-${0/-entrypoint/}}
CONSUMEDIR_PATH="${CONSUMEDIR_PATH-/opt/docs}"
CONSUMEDIR_POLLING_INTERVAL=${CONSUMEDIR_POLLING_INTERVAL-60}
DOCSPELL_HEADER_VALUE=${DOCSPELL_HEADER_VALUE-none}
CONSUMEDIR_ARGS=${CONSUMEDIR_ARGS-}
if [ -z "${CONSUMEDIR_ARGS}" ]; then
CONSUMEDIR_ARGS="--path $CONSUMEDIR_PATH --iheader Docspell-Integration:$DOCSPELL_HEADER_VALUE"
if [ "${CONSUMEDIR_INTEGRATION-n}" = "y" ]; then
CONSUMEDIR_ARGS="$CONSUMEDIR_ARGS -i"
fi
if [ -z "${CONSUMEDIR_ENDPOINT-}" ]; then
if [ "${CONSUMEDIR_INTEGRATION-n}" = "y" ]; then
CONSUMEDIR_ENDPOINT="http://docspell-restserver:7880/api/v1/open/integration/item"
echo "Using default CONSUMEDIR_ENDPOINT=$CONSUMEDIR_ENDPOINT"
else
echo "Please specify CONSUMEDIR_ENDPOINT"
exit 1
fi
fi
if [ "${CONSUMEDIR_VERBOSE-n}" = "y" ]; then
CONSUMEDIR_ARGS="$CONSUMEDIR_ARGS -v"
fi
if [ "${CONSUMEDIR_DELETE-n}" = "y" ]; then
CONSUMEDIR_ARGS="$CONSUMEDIR_ARGS -d"
fi
if [ "${CONSUMEDIR_UNIQUE-n}" = "y" ]; then
CONSUMEDIR_ARGS="$CONSUMEDIR_ARGS -m"
fi
if [ "${CONSUMEDIR_POLLING-n}" = "y" ] || [ "${CONSUMEDIR_ONCE-n}" = "y" ]; then
CONSUMEDIR_ARGS="$CONSUMEDIR_ARGS --once"
fi
CONSUMEDIR_ARGS="$CONSUMEDIR_ARGS $CONSUMEDIR_ENDPOINT"
fi
echo "Command: $CONSUMEDIR_SCRIPT $CONSUMEDIR_ARGS"
if [ "${CONSUMEDIR_POLLING-n}" = "y" ]; then
echo "Running in polling mode"
while [ : ]
do
$CONSUMEDIR_SCRIPT $CONSUMEDIR_ARGS
sleep $CONSUMEDIR_POLLING_INTERVAL
done
else
echo "Running in inotifywait mode"
$CONSUMEDIR_SCRIPT $CONSUMEDIR_ARGS
fi

View File

@ -1,21 +0,0 @@
## CONSUMEDIR
ARG VERSION=
ARG REPO=
# hack to use args in from
FROM ${REPO}:base-binaries-${VERSION} as docspell-base-binaries
FROM ${REPO}:base-${VERSION}
RUN apk add --no-cache curl bash inotify-tools
COPY --from=docspell-base-binaries /opt/docspell-tools /opt/docspell-tools
COPY consumedir-entrypoint.sh /opt/docspell-tools/consumedir/
RUN chmod 755 /opt/docspell-tools/**/*.sh
ENTRYPOINT ["bash", "/opt/docspell-tools/consumedir/consumedir-entrypoint.sh"]
HEALTHCHECK --interval=1m --timeout=10s --retries=2 --start-period=10s \
CMD pgrep bash

View File

@ -1,86 +0,0 @@
#!/usr/bin/env bash
REPO="eikek0/docspell"
if [ $# -eq 1 ]; then
REPO=$1
fi
SBT_VERSION=$(grep sbt.version ../project/build.properties|cut -d'=' -f2|xargs)
VERSION=$(cat ../version.sbt | cut -d'=' -f2 | tr -d '"'|xargs)
if [[ $VERSION == *"SNAPSHOT" ]]; then
VERSION=SNAPSHOT
else
VERSION=v$VERSION
fi
# if automated build by docker, don't spool log to file
if [[ $LOG_TO_FILE -eq 1 ]]; then
logfile=./dev-log/build_$(date +%Y%m%d_%H%M).log
echo logging to logfile: $logfile
echo In order to log to console set 'LOG_TO_CONSOLE' to 1
mkdir -p ./dev-log
exec 1>>"$logfile" 2>&1
else
echo "logging to console..." && echo
fi
echo "########################################################"
date
echo && echo building docker images for version: $VERSION && echo
echo "(Repo: $REPO, SBT-Version: $SBT_VERSION)"
echo "########################################################" && echo && echo && echo
echo building base-binaries
time docker build -f ./base-binaries.dockerfile --build-arg SBT_VERSION=${SBT_VERSION} --tag ${REPO}:base-binaries-$VERSION ..
status=$?
if [[ $status -eq 0 ]]; then
echo && echo && echo && echo && echo "########################################################"
echo building base
time docker build -f ./base.dockerfile --tag ${REPO}:base-$VERSION .
status=$?
fi
if [[ $status -eq 0 ]]; then
echo && echo && echo && echo && echo "########################################################"
echo building restserver
time docker build -f ./restserver.dockerfile --tag ${REPO}:restserver-$VERSION --build-arg REPO=$REPO --build-arg VERSION=$VERSION .
status=$?
if [[ $status -eq 0 ]] && [[ "$VERSION" != "SNAPSHOT" ]]; then
docker tag ${REPO}:restserver-$VERSION ${REPO}:restserver-LATEST
fi
fi
if [[ $status -eq 0 ]]; then
echo && echo && echo && echo && echo "########################################################"
echo building joex base
time docker build -f ./joex-base.dockerfile --tag ${REPO}:joex-base-$VERSION --build-arg REPO=$REPO --build-arg VERSION=$VERSION .
status=$?
fi
if [[ $status -eq 0 ]]; then
echo && echo && echo && echo && echo "########################################################"
echo building joex
time docker build -f ./joex.dockerfile --tag ${REPO}:joex-$VERSION --build-arg REPO=$REPO --build-arg VERSION=$VERSION .
status=$?
if [[ $status -eq 0 ]] && [[ "$VERSION" != "SNAPSHOT" ]]; then
docker tag ${REPO}:joex-$VERSION ${REPO}:joex-LATEST
fi
fi
if [[ $status -eq 0 ]]; then
echo && echo && echo && echo && echo "########################################################"
echo building consumedir
time docker build -f ./consumedir.dockerfile --tag ${REPO}:consumedir-$VERSION --build-arg REPO=$REPO --build-arg VERSION=$VERSION .
status=$?
if [[ $status -eq 0 ]] && [[ "$VERSION" != "SNAPSHOT" ]]; then
docker tag ${REPO}:consumedir-$VERSION ${REPO}:consumedir-LATEST
fi
fi
echo && echo && echo
echo "######################## done ########################"
date

View File

@ -1,46 +0,0 @@
#!/usr/bin/env bash
REPO="eikek0/docspell"
if [ $# -eq 1 ]; then
REPO=$1
fi
VERSION=$(cat ../version.sbt | cut -d'=' -f2 | tr -d '"'|xargs)
if [[ $VERSION == *"SNAPSHOT" ]]; then
VERSION=SNAPSHOT
else
VERSION=v$VERSION
fi
echo && echo pushing docker images for version: $VERSION && echo && echo
# disabled as this doesn't to be on Docker Hub
# echo pushing base
# docker ${REPO}-base:$VERSION .
echo pushing restserver
docker push ${REPO}
exit 0
## still needs to be tested for a tagged version - that's why old version below is kept!
if [[ $? -eq 0 ]]; then
echo pushing restserver
docker push ${REPO}:restserver-$VERSION
fi
if [[ $? -eq 0 ]]; then
echo pushing joex base
docker push ${REPO}:joex-base-$VERSION
fi
if [[ $? -eq 0 ]]; then
echo pushing joex
docker push ${REPO}:joex-$VERSION
fi
if [[ $? -eq 0 ]]; then
echo pushing consumedir
docker push ${REPO}:consumedir-$VERSION
fi

View File

@ -1,69 +0,0 @@
version: '3.7'
services:
restserver:
image: eikek0/docspell:restserver-LATEST
container_name: docspell-restserver
restart: unless-stopped
ports:
- "7880:7880"
volumes:
- ./docspell.conf:/opt/docspell.conf
env_file: ./.env
depends_on:
- solr
joex:
image: eikek0/docspell:joex-LATEST
container_name: docspell-joex
restart: unless-stopped
env_file: ./.env
ports:
- "7878:7878"
volumes:
- ./docspell.conf:/opt/docspell.conf
depends_on:
- solr
consumedir:
image: eikek0/docspell:consumedir-LATEST
container_name: docspell-consumedir
restart: unless-stopped
env_file: ./.env
volumes:
- ./docs:/opt/docs
depends_on:
- restserver
db:
image: postgres:13.3
container_name: postgres_db
restart: unless-stopped
volumes:
- docspell-postgres_data:/var/lib/postgresql/data/
environment:
- POSTGRES_USER=$DB_USER
- POSTGRES_PASSWORD=$DB_PASS
- POSTGRES_DB=$DB_NAME
solr:
image: solr:8
container_name: docspell-solr
restart: unless-stopped
volumes:
- docspell-solr_data:/var/solr
command:
- solr-precreate
- docspell
healthcheck:
test: ["CMD", "curl", "f", "http://localhost:8983/solr/docspell/admin/ping"]
interval: 1m
timeout: 10s
retries: 2
start_period: 30s
volumes:
docspell-postgres_data:
docspell-solr_data:

View File

@ -1,72 +0,0 @@
# This is the configuration file for docspell. It contains two main
# namespaces: docspell.server and docspell.joex. Each provide the
# config for the respective component.
#
# They can be moved to different files, if necessary. For this example
# though, both components are configured in this single file.
#
# Below are only some settings that differ from the default. Please
# see https://docspell.org/docs/configure/#default-config for all
# options and their documentation. This page provides deeper
# information about the important config options.
#
# Note: this docker-compose setup is an example to get started. It
# sets up one rest-server, one joex, a postgres database and a solr
# all on the same machine.
docspell.server {
base-url = "http://localhost:7880"
bind {
address = "0.0.0.0"
}
integration-endpoint {
enabled = true
http-header {
enabled = true
header-value = ${?DOCSPELL_HEADER_VALUE}
}
}
# Configuration of the full-text search engine.
full-text-search {
enabled = true
solr = {
url = "http://solr:8983/solr/docspell"
}
}
backend {
jdbc {
url = "jdbc:"${DB_TYPE}"://"${DB_HOST}":"${DB_PORT}"/"${DB_NAME}
user = ${DB_USER}
password = ${DB_PASS}
}
}
}
# Note to joex: It is currently setup for one instance. Should you
# want to scale joex instance up (maybe to help processing a batch of
# files), there are two options:
#
# - look at https://github.com/eikek/docspell/pull/552 to elastically
# start and stop joex instances via docker-compose
# - set pool-size to some higher number; this requires to restart joex
#
docspell.joex {
base-url = "http://"${HOSTNAME}":7878"
bind {
address = "0.0.0.0"
}
jdbc {
url = "jdbc:"${DB_TYPE}"://"${DB_HOST}":"${DB_PORT}"/"${DB_NAME}
user = ${DB_USER}
password = ${DB_PASS}
}
full-text-search {
enabled = true
solr = {
url = "http://solr:8983/solr/docspell"
}
}
scheduler {
pool-size = 1
}
}

View File

@ -1,48 +0,0 @@
#!/bin/bash
# remove trailing slash if exists
DOCKER_REPO=${DOCKER_REPO%/}
echo "||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||"
date
echo building image \"$IMAGE_NAME\" in repository \"$DOCKER_REPO\" using dockerfile \"$DOCKERFILE_PATH\"
echo image was triggered by automated build for tag \"$DOCKER_TAG\"
echo " based on branch \"$SOURCE_BRANCH\" and commit \"$SOURCE_COMMIT\""
echo " commit message was \"$COMMIT_MSG\""
echo && echo && echo
echo "||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||"
# verify that version.sbt and tag match for non-snapshot (ENV variable DOCKER_VERIFY_TAG must be set to 1)
if [ $DOCKER_VERIFY_TAG -eq 1 ] && [[ "$DOCKER_TAG" != *"-SNAPSHOT" ]]; then
echo validating version number...
VERSION=$(cat ../version.sbt | cut -d'=' -f2 | tr -d '"'|xargs)
if [ "$DOCKER_TAG" != "base-v$VERSION" ]; then
echo "version number mismatch (Docker/Tag: $DOCKER_TAG, Project: $VERSION), aborting!"
exit 1
fi
fi
./dev-build-images.sh "$DOCKER_REPO"
status=$?
if [[ $status -eq 0 ]]; then
echo "#### pushing images ####"
./dev-push-images.sh "$DOCKER_REPO"
fi
echo && echo && date
echo "||||||||||||||||||||||||||||||||||||||||||||| done |||||||||||||||||||||||||||||||||||||||||||||"
###################################
# available variables
## SOURCE_BRANCH: the name of the branch or the tag that is currently being tested.
## SOURCE_COMMIT: the SHA1 hash of the commit being tested.
## COMMIT_MSG: the message from the commit being tested and built.
## DOCKER_REPO: the name of the Docker repository being built.
## DOCKERFILE_PATH: the dockerfile currently being built.
## DOCKER_TAG: the Docker repository tag being built.
## IMAGE_NAME: the name and tag of the Docker repository being built. (This variable is a combination of DOCKER_REPO:DOCKER_TAG.)
###################################

View File

@ -1,55 +0,0 @@
## JOEX-BASE
ARG VERSION=
ARG REPO=
FROM ${REPO}:base-${VERSION}
ARG UNO_URL=https://raw.githubusercontent.com/unoconv/unoconv/0.9.0/unoconv
ENV JAVA_OPTS="-Xmx1536M"
RUN apk add --no-cache openjdk11-jre \
bash \
curl \
ghostscript \
tesseract-ocr \
tesseract-ocr-data-deu \
tesseract-ocr-data-fra \
tesseract-ocr-data-ita \
tesseract-ocr-data-spa \
tesseract-ocr-data-por \
tesseract-ocr-data-ces \
tesseract-ocr-data-nld \
tesseract-ocr-data-dan \
tesseract-ocr-data-fin \
tesseract-ocr-data-nor \
tesseract-ocr-data-swe \
tesseract-ocr-data-rus \
tesseract-ocr-data-ron \
tesseract-ocr-data-lav \
unpaper \
wkhtmltopdf \
libreoffice \
ttf-droid-nonlatin \
ttf-droid \
ttf-dejavu \
ttf-freefont \
ttf-liberation \
libxml2-dev \
libxslt-dev \
pngquant \
zlib-dev \
g++ \
qpdf \
py3-pip \
python3-dev \
libffi-dev\
qpdf-dev \
openssl-dev \
ocrmypdf \
&& pip3 install --upgrade pip \
&& pip3 install ocrmypdf \
&& curl -Ls $UNO_URL -o /usr/local/bin/unoconv \
&& chmod +x /usr/local/bin/unoconv \
&& apk del curl libxml2-dev libxslt-dev zlib-dev g++ python3-dev py3-pip libffi-dev qpdf-dev openssl-dev \
&& ln -s /usr/bin/python3 /usr/bin/python

View File

@ -1,20 +0,0 @@
#!/bin/sh
echo "Starting unoconv listener"
unoconv -l &
# replace own ocrmypdf with official dockerfile, i.e. newer version
if [ -S "/var/run/docker.sock" ]; then
if [ ! -f "/usr/local/bin/ocrmypdf.sh" ]; then
echo "Found 'docker.sock': Installing Docker and redirecting 'ocrmypdf' command to official dockerfile by jbarlow83"
apk --no-cache add docker
mv /usr/local/bin/joex-ocrmypdf.sh /usr/local/bin/ocrmypdf
chmod ug+x /usr/local/bin/ocrmypdf
fi
docker pull -q jbarlow83/ocrmypdf:$OCRMYPDF_VERSION
echo "Using OCRmyPDF@Docker v$(ocrmypdf --version)" && echo
fi
/opt/docspell-joex/bin/docspell-joex "$@"

View File

@ -1,6 +0,0 @@
#!/bin/sh
if [ ! "$1" == "--version" ]; then
echo "Using docker image for ocrmypdf (Version: $OCRMYPDF_VERSION)"
fi
docker run --rm -v '/tmp/docspell-convert:/tmp/docspell-convert' -e "TZ=$TZ" jbarlow83/ocrmypdf:$OCRMYPDF_VERSION $@

View File

@ -1,23 +0,0 @@
## JOEX
ARG VERSION=
ARG REPO=
# hack to use args in from
FROM ${REPO}:base-binaries-${VERSION} as docspell-base-binaries
FROM ${REPO}:joex-base-${VERSION}
ENV OCRMYPDF_VERSION=v11.2.1
COPY --from=docspell-base-binaries /opt/docspell-joex /opt/docspell-joex
COPY joex-entrypoint.sh /opt/joex-entrypoint.sh
COPY joex-ocrmypdf.sh /usr/local/bin/joex-ocrmypdf.sh
ENTRYPOINT ["/opt/joex-entrypoint.sh"]
CMD ["/opt/docspell.conf"]
EXPOSE 7878
HEALTHCHECK --interval=1m --timeout=10s --retries=2 --start-period=10s \
CMD pgrep -f joex/lib

View File

@ -1,3 +0,0 @@
#!/bin/sh
/opt/docspell-restserver/bin/docspell-restserver $@

View File

@ -1,21 +0,0 @@
## RESTSERVER
ARG VERSION=
ARG REPO=
# hack to use args in from
FROM ${REPO}:base-binaries-${VERSION} as docspell-base-binaries
FROM ${REPO}:base-${VERSION}
RUN apk add --no-cache --virtual .restserver-dependencies openjdk11-jre bash
COPY --from=docspell-base-binaries /opt/docspell-restserver /opt/docspell-restserver
COPY restserver-entrypoint.sh /opt/restserver-entrypoint.sh
ENTRYPOINT ["/opt/restserver-entrypoint.sh"]
CMD ["/opt/docspell.conf"]
EXPOSE 7880
HEALTHCHECK --interval=1m --timeout=10s --retries=2 --start-period=30s \
CMD wget --spider http://localhost:7880