Lots of improvements and simplifications.
* Collect all logs under the /var/log/koha directory. * Setup logrotate * Use a static instance name, leading to simpler configuration.
This commit is contained in:
parent
737f738dc7
commit
c16804a913
11
Dockerfile
11
Dockerfile
|
|
@ -2,6 +2,7 @@ FROM debian:bullseye
|
|||
|
||||
ENV DEBIAN_FRONTEND noninteractive
|
||||
ARG S6_OVERLAY_VERSION=3.1.3.0
|
||||
ARG S6_OVERLAY_ARCH="x86_64"
|
||||
ARG KOHA_VERSION=22.11
|
||||
|
||||
LABEL org.opencontainers.image.source=https://github.com/teorgamm/koha-docker
|
||||
|
|
@ -18,7 +19,7 @@ RUN apt-get update \
|
|||
|
||||
ADD https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-noarch.tar.xz /tmp
|
||||
RUN tar -C / -Jxpf /tmp/s6-overlay-noarch.tar.xz
|
||||
ADD https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-x86_64.tar.xz /tmp
|
||||
ADD https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-${S6_OVERLAY_ARCH}.tar.xz /tmp
|
||||
RUN tar -C / -Jxpf /tmp/s6-overlay-x86_64.tar.xz
|
||||
|
||||
RUN mkdir /etc/apt/keyrings/ && \
|
||||
|
|
@ -30,6 +31,7 @@ RUN apt-get update \
|
|||
&& apt-get install -y koha-core \
|
||||
idzebra-2.0 \
|
||||
apache2 libapache2-mpm-itk\
|
||||
logrotate \
|
||||
&& rm -rf /var/cache/apt/archives/* \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
|
|
@ -38,9 +40,12 @@ RUN a2enmod rewrite \
|
|||
&& a2enmod proxy_http \
|
||||
&& a2enmod cgi \
|
||||
&& a2dissite 000-default \
|
||||
&& echo "Listen 8081\nListen 8080" > /etc/apache2/ports.conf
|
||||
&& echo "Listen 8081\nListen 8080" > /etc/apache2/ports.conf \
|
||||
&& sed -E -i "s#^(export APACHE_LOG_DIR=).*#\1/var/log/koha/apache#g" /etc/apache2/envvars \
|
||||
&& mkdir -p /var/log/koha/apache \
|
||||
&& chown -R www-data:www-data /var/log/koha/apache
|
||||
|
||||
COPY files/ /
|
||||
COPY --chown 0:0 files/ /
|
||||
WORKDIR /docker
|
||||
|
||||
EXPOSE 2100 6001 8080 8081
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ RUN apt-get update \
|
|||
ADD https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-noarch.tar.xz /tmp
|
||||
RUN tar -C / -Jxpf /tmp/s6-overlay-noarch.tar.xz
|
||||
ADD https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-${S6_OVERLAY_ARCH}.tar.xz /tmp
|
||||
RUN tar -C / -Jxpf /tmp/s6-overlay-${S6_OVERLAY_ARCH}.tar.xz
|
||||
RUN tar -C / -Jxpf /tmp/s6-overlay-x86_64.tar.xz
|
||||
|
||||
RUN mkdir /etc/apt/keyrings/ && \
|
||||
wget -qO - https://debian.koha-community.org/koha/gpg.asc | gpg --dearmor -o /etc/apt/keyrings/koha.gpg && \
|
||||
|
|
@ -31,6 +31,7 @@ RUN apt-get update \
|
|||
&& apt-get install -y koha-core \
|
||||
idzebra-2.0 \
|
||||
apache2 libapache2-mpm-itk\
|
||||
logrotate \
|
||||
&& rm -rf /var/cache/apt/archives/* \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
|
|
@ -39,9 +40,12 @@ RUN a2enmod rewrite \
|
|||
&& a2enmod proxy_http \
|
||||
&& a2enmod cgi \
|
||||
&& a2dissite 000-default \
|
||||
&& echo "Listen 8081\nListen 8080" > /etc/apache2/ports.conf
|
||||
&& echo "Listen 8081\nListen 8080" > /etc/apache2/ports.conf \
|
||||
&& sed -E -i "s#^(export APACHE_LOG_DIR=).*#\1/var/log/koha/apache#g" /etc/apache2/envvars \
|
||||
&& mkdir -p /var/log/koha/apache \
|
||||
&& chown -R www-data:www-data /var/log/koha/apache
|
||||
|
||||
COPY files/ /
|
||||
COPY --chown 0:0 files/ /
|
||||
WORKDIR /docker
|
||||
|
||||
EXPOSE 2100 6001 8080 8081
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ RUN apt-get update \
|
|||
ADD https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-noarch.tar.xz /tmp
|
||||
RUN tar -C / -Jxpf /tmp/s6-overlay-noarch.tar.xz
|
||||
ADD https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-${S6_OVERLAY_ARCH}.tar.xz /tmp
|
||||
RUN tar -C / -Jxpf /tmp/s6-overlay-${S6_OVERLAY_ARCH}.tar.xz
|
||||
RUN tar -C / -Jxpf /tmp/s6-overlay-x86_64.tar.xz
|
||||
|
||||
RUN mkdir /etc/apt/keyrings/ && \
|
||||
wget -qO - https://debian.koha-community.org/koha/gpg.asc | gpg --dearmor -o /etc/apt/keyrings/koha.gpg && \
|
||||
|
|
@ -31,6 +31,7 @@ RUN apt-get update \
|
|||
&& apt-get install -y koha-core \
|
||||
idzebra-2.0 \
|
||||
apache2 libapache2-mpm-itk\
|
||||
logrotate \
|
||||
&& rm -rf /var/cache/apt/archives/* \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
|
|
@ -39,9 +40,12 @@ RUN a2enmod rewrite \
|
|||
&& a2enmod proxy_http \
|
||||
&& a2enmod cgi \
|
||||
&& a2dissite 000-default \
|
||||
&& echo "Listen 8081\nListen 8080" > /etc/apache2/ports.conf
|
||||
&& echo "Listen 8081\nListen 8080" > /etc/apache2/ports.conf \
|
||||
&& sed -E -i "s#^(export APACHE_LOG_DIR=).*#\1/var/log/koha/apache#g" /etc/apache2/envvars \
|
||||
&& mkdir -p /var/log/koha/apache \
|
||||
&& chown -R www-data:www-data /var/log/koha/apache
|
||||
|
||||
COPY files/ /
|
||||
COPY --chown 0:0 files/ /
|
||||
WORKDIR /docker
|
||||
|
||||
EXPOSE 2100 6001 8080 8081
|
||||
|
|
|
|||
|
|
@ -28,6 +28,8 @@ The main configuration environment variables are documented in
|
|||
|
||||
For a quick start check out the included [docker-compose](examples/docker-compose.yaml) file.
|
||||
|
||||
Logs for stored under the `/var/log/koha` directory.
|
||||
|
||||
## Credits
|
||||
|
||||
Some scripts have been taken from https://gitlab.com/koha-community/docker/koha-docker and modified.
|
||||
|
|
|
|||
|
|
@ -1,32 +1,29 @@
|
|||
# Your domain, with a dot prepended.
|
||||
# Example: .mydomain.com
|
||||
# Default: None (Optional)
|
||||
KOHA_DOMAIN=
|
||||
# Please note that the URLs are built like this:
|
||||
# OPAC: http://<OPACPREFIX><INSTANCE NAME><OPACSUFFIX><DOMAIN>:<OPACPORT>
|
||||
# STAFF: http://<INTRAPREFIX><INSTANCE NAME><INTRASUFFIX><DOMAIN>:<INTRAPORT>
|
||||
# Default: None (Optional)
|
||||
KOHA_INTRANET_PREFIX=
|
||||
KOHA_INTRANET_SUFFIX=
|
||||
KOHA_OPAC_PREFIX=
|
||||
KOHA_OPAC_SUFFIX=
|
||||
# Name of the Koha instance
|
||||
# Default:default
|
||||
KOHA_INSTANCE=
|
||||
# Hostname of your database server
|
||||
# Default: db
|
||||
MYSQL_SERVER=
|
||||
# Database name
|
||||
# Default: koha_default
|
||||
DB_NAME=
|
||||
# Databse user
|
||||
# Default: koha_default
|
||||
MYSQL_USER=
|
||||
# Password of the database user and the default user used during onboarding
|
||||
# Default: None (Required)
|
||||
MYSQL_PASSWORD=
|
||||
|
||||
# Space separated list of language codes to install. To list the available languages
|
||||
# run 'koha-translate -l' inside the container.
|
||||
# Default: None (Only English is installed)
|
||||
KOHA_LANGS=
|
||||
# Hostname of your database server
|
||||
# Default: mariadb
|
||||
MYSQL_SERVER=
|
||||
# Username of database user is koha_${INSTANCE_NAME}
|
||||
# Password of the database user and the default user used during onboarding
|
||||
# Default: None (Required)
|
||||
MYSQL_PASSWORD=
|
||||
|
||||
|
||||
ZEBRA_MARC_FORMAT=marc21
|
||||
|
||||
# Elasticsearch options
|
||||
# If the ELASTICSEARCH_HOST variable is set the
|
||||
# container is set yp to use Elasticsearch. A
|
||||
# Zebra server is spawned inside the container,
|
||||
# otherwise.
|
||||
#ELASTICSEARCH_HOST=
|
||||
#OVERRIDE_SYSPREF_SearchEngine=Elasticsearch
|
||||
|
||||
|
|
|
|||
|
|
@ -11,9 +11,10 @@ services:
|
|||
- DAC_READ_SEARCH
|
||||
- SYS_NICE
|
||||
environment:
|
||||
KOHA_INSTANCE: teolib
|
||||
MYSQL_SERVER: db
|
||||
MYSQL_USER: koha_teolib
|
||||
MYSQL_PASSWORD: example
|
||||
DB_NAME: koha_teolib
|
||||
MEMCACHED_SERVERS: memcached:11211
|
||||
MB_HOST: rabbitmq
|
||||
depends_on:
|
||||
|
|
|
|||
1
files/etc/koha-envvars/INSTANCE_NAME
Normal file
1
files/etc/koha-envvars/INSTANCE_NAME
Normal file
|
|
@ -0,0 +1 @@
|
|||
default
|
||||
1
files/etc/koha-envvars/KOHA_CONF
Normal file
1
files/etc/koha-envvars/KOHA_CONF
Normal file
|
|
@ -0,0 +1 @@
|
|||
/etc/koha/sites/default/koha-conf.xml
|
||||
1
files/etc/koha-envvars/KOHA_HOME
Normal file
1
files/etc/koha-envvars/KOHA_HOME
Normal file
|
|
@ -0,0 +1 @@
|
|||
/usr/share/koha
|
||||
1
files/etc/koha-envvars/PERL5LIB
Normal file
1
files/etc/koha-envvars/PERL5LIB
Normal file
|
|
@ -0,0 +1 @@
|
|||
/usr/share/koha/lib
|
||||
14
files/etc/logrotate.d/koha-core
Normal file
14
files/etc/logrotate.d/koha-core
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
/var/log/koha/*/*.log {
|
||||
rotate 5
|
||||
weekly
|
||||
missingok
|
||||
copytruncate
|
||||
compress
|
||||
delaycompress
|
||||
notifempty
|
||||
sharedscripts
|
||||
postrotate
|
||||
/command/s6-svc -h /run/service/apache2
|
||||
/command/s6-svc -r /run/service/plack
|
||||
endscript
|
||||
}
|
||||
|
|
@ -1,3 +1,7 @@
|
|||
#!/command/execlineb -P
|
||||
fdmove -c 2 1
|
||||
apache2ctl -DFOREGROUND
|
||||
|
||||
trap { SIGTERM { apache2ctl stop }
|
||||
SIGHUP { apache2ctl graceful } }
|
||||
|
||||
apache2ctl -D "FOREGROUND"
|
||||
|
|
|
|||
|
|
@ -1 +0,0 @@
|
|||
oneshot
|
||||
|
|
@ -1,4 +0,0 @@
|
|||
#!/bin/sh
|
||||
if { mkdir -p /var/log/cron }
|
||||
if { chown nobody:nogroup /var/log/cron }
|
||||
chmod 02755 /var/log/cron
|
||||
|
|
@ -1 +0,0 @@
|
|||
cron
|
||||
|
|
@ -1 +0,0 @@
|
|||
cron-pipeline
|
||||
|
|
@ -1,2 +0,0 @@
|
|||
#!/bin/sh
|
||||
exec logutil-service /var/log/cron
|
||||
|
|
@ -1 +0,0 @@
|
|||
longrun
|
||||
|
|
@ -1 +0,0 @@
|
|||
cron-log
|
||||
|
|
@ -3,6 +3,4 @@ fdmove -c 2 1
|
|||
|
||||
s6-envdir /etc/koha-envvars
|
||||
|
||||
importas instancename INSTANCE_NAME
|
||||
|
||||
/usr/bin/starman -M FindBin --socket /var/run/koha/${instancename}/plack.sock --max-requests 50 --workers 2 -E deployment --user=${instancename}-koha --group=${instancename}-koha --access-log /dev/stdout --error-log /dev/stdout "/etc/koha/plack.psgi"
|
||||
/usr/bin/starman -M FindBin --socket /var/run/koha/default/plack.sock --max-requests 50 --workers 2 -E deployment --user=default-koha --group=default-koha --access-log /var/log/koha/default/plack.log --error-log /var/log/koha/default/plack-error.log "/etc/koha/plack.psgi"
|
||||
|
|
|
|||
|
|
@ -1 +0,0 @@
|
|||
oneshot
|
||||
|
|
@ -1 +0,0 @@
|
|||
/etc/s6-overlay/scripts/01-setup-koha-envvars.sh
|
||||
|
|
@ -5,8 +5,6 @@ fdmove -c 2 1
|
|||
|
||||
s6-envdir /etc/koha-envvars
|
||||
|
||||
importas instancename INSTANCE_NAME
|
||||
|
||||
s6-setuidgid ${instancename}-koha
|
||||
s6-setuidgid default-koha
|
||||
|
||||
/usr/bin/perl /usr/share/koha/bin/background_jobs_worker.pl
|
||||
|
|
|
|||
|
|
@ -3,8 +3,6 @@ fdmove -c 2 1
|
|||
|
||||
s6-envdir /etc/koha-envvars
|
||||
|
||||
importas instancename INSTANCE_NAME
|
||||
|
||||
s6-setuidgid ${instancename}-koha
|
||||
s6-setuidgid default-koha
|
||||
|
||||
/usr/bin/perl /usr/share/koha/bin/migration_tools/rebuild_zebra.pl -daemon -sleep 5
|
||||
|
|
|
|||
|
|
@ -1,10 +1,7 @@
|
|||
#!/command/execlineb -P
|
||||
s6-envdir /etc/koha-envvars
|
||||
|
||||
fdmove -c 2 1
|
||||
|
||||
importas instancename INSTANCE_NAME
|
||||
s6-setuidgid default-koha
|
||||
|
||||
s6-setuidgid ${instancename}-koha
|
||||
/usr/bin/zebrasrv -v 1 -f /etc/koha/sites/default/koha-conf.xml
|
||||
|
||||
/usr/bin/zebrasrv -v 1 -f /etc/koha/sites/${instancename}/koha-conf.xml
|
||||
|
|
|
|||
|
|
@ -1,6 +0,0 @@
|
|||
#!/command/with-contenv sh
|
||||
mkdir -p /etc/koha-envvars
|
||||
echo -n "/usr/share/koha/lib" > /etc/koha-envvars/PERL5LIB
|
||||
echo -n "/etc/koha/sites/${KOHA_INSTANCE}/koha-conf.xml" > /etc/koha-envvars/KOHA_CONF
|
||||
echo -n "/usr/share/koha" > /etc/koha-envvars/KOHA_HOME
|
||||
echo -n "${KOHA_INSTANCE}" > /etc/koha-envvars/INSTANCE_NAME
|
||||
|
|
@ -1,12 +1,13 @@
|
|||
#!/command/with-contenv bash
|
||||
|
||||
#if no koha instance name was provided, then set it as "default"
|
||||
export KOHA_INSTANCE=${KOHA_INSTANCE:-default}
|
||||
export KOHA_INSTANCE=default
|
||||
|
||||
export KOHA_INTRANET_PORT=8081
|
||||
export KOHA_OPAC_PORT=8080
|
||||
export MEMCACHED_SERVERS=${MEMCACHED_SERVERS:-memcached}
|
||||
export MYSQL_SERVER=${MYSQL_SERVER:-db}
|
||||
export DB_NAME=${DB_NAME:-koha_default}
|
||||
export MYSQL_USER=${DB_NAME:-koha_default}
|
||||
export MYSQL_PASSWORD=${MYSQL_PASSWORD:-$(pwgen -s 15 1)}
|
||||
export ZEBRA_MARC_FORMAT=${ZEBRA_MARC_FORMAT:-marc21}
|
||||
export KOHA_PLACK_NAME=${KOHA_PLACK_NAME:-koha}
|
||||
|
|
@ -21,7 +22,7 @@ export MB_PASS=${MB_PASS:-guest}
|
|||
envsubst < /docker/templates/koha-sites.conf > /etc/koha/koha-sites.conf
|
||||
|
||||
# Create entry with admin username, password and myqsl server for this instance
|
||||
echo -n "${KOHA_INSTANCE}:koha_${KOHA_INSTANCE}:${MYSQL_PASSWORD}:koha_${KOHA_INSTANCE}:${MYSQL_SERVER}" > /etc/koha/passwd
|
||||
echo -n "default:${MYSQL_USER}:${MYSQL_PASSWORD}:${DB_NAME}:${MYSQL_SERVER}" > /etc/koha/passwd
|
||||
|
||||
source /usr/share/koha/bin/koha-functions.sh
|
||||
|
||||
|
|
@ -49,7 +50,6 @@ then
|
|||
# Start zebra services with s6
|
||||
touch /etc/s6-overlay/s6-rc.d/user/contents.d/zebra-indexer
|
||||
touch /etc/s6-overlay/s6-rc.d/user/contents.d/zebra-server
|
||||
s6-rc-update
|
||||
else
|
||||
koha-elasticsearch --rebuild -p $(grep -c ^processor /proc/cpuinfo) ${KOHA_INSTANCE} &
|
||||
fi
|
||||
|
|
|
|||
Loading…
Reference in a new issue