Compare commits

...

10 commits

Author SHA1 Message Date
Theodoros Grammenos cf874c41da
Add information about initial setup 2025-03-19 11:41:02 +01:00
Theodoros Grammenos b3c3594a50
Hardcode rabbitmq version in example compose file 2025-02-09 22:28:48 +01:00
Theodoros Grammenos 7e598d94bd
Add worker for long_tasks queue 2025-02-09 22:28:15 +01:00
Theodoros Grammenos 244f06b264
Update to Koha 24.11 2025-02-06 23:31:57 +01:00
Theodoros Grammenos 8adbdfd447
Add more information to README 2024-01-04 20:41:31 +01:00
Theodoros Grammenos 4529180965
Make rabbitmq_plugins not hidden 2024-01-04 20:33:02 +01:00
Theodoros Grammenos 30b8655b31
[example] Explicitly specify image source 2023-12-26 01:38:24 +02:00
Theodoros Grammenos 8b2d3a6823
Fix zebra-indexer logs 2023-02-18 13:52:14 +02:00
Theodoros Grammenos b388164147
Fix Zebra server not starting 2023-02-18 13:14:43 +02:00
Theodoros Grammenos ba293fbf69
Use single Dockerfile 2023-02-17 23:20:51 +02:00
19 changed files with 58 additions and 130 deletions

View file

@ -1,9 +1,9 @@
FROM debian:bullseye FROM debian:bookworm
ENV DEBIAN_FRONTEND noninteractive ENV DEBIAN_FRONTEND noninteractive
ARG S6_OVERLAY_VERSION=3.1.3.0 ARG S6_OVERLAY_VERSION=3.2.0.2
ARG S6_OVERLAY_ARCH="x86_64" ARG KOHA_VERSION=24.11
ARG KOHA_VERSION=22.11 ARG TARGETARCH
LABEL org.opencontainers.image.source=https://github.com/teorgamm/koha-docker LABEL org.opencontainers.image.source=https://github.com/teorgamm/koha-docker
@ -19,10 +19,16 @@ RUN apt-get update \
ADD https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-noarch.tar.xz /tmp 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 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-x86_64.tar.xz
RUN mkdir /etc/apt/keyrings/ && \ RUN echo ${TARGETARCH} && case ${TARGETARCH} in \
"amd64") S6_ARCH=x86_64 ;; \
"arm64") S6_ARCH=aarch64 ;; \
"arm") S6_ARCH=armhf ;; \
esac \
&& wget -P /tmp/ -q https://github.com/just-containers/s6-overlay/releases/download/v${S6_OVERLAY_VERSION}/s6-overlay-${S6_ARCH}.tar.xz \
&& tar -C / -Jxpf /tmp/s6-overlay-${S6_ARCH}.tar.xz
RUN mkdir -p /etc/apt/keyrings/ && \
wget -qO - https://debian.koha-community.org/koha/gpg.asc | gpg --dearmor -o /etc/apt/keyrings/koha.gpg && \ wget -qO - https://debian.koha-community.org/koha/gpg.asc | gpg --dearmor -o /etc/apt/keyrings/koha.gpg && \
echo "deb [signed-by=/etc/apt/keyrings/koha.gpg] https://debian.koha-community.org/koha ${KOHA_VERSION} main bullseye" | tee /etc/apt/sources.list.d/koha.list echo "deb [signed-by=/etc/apt/keyrings/koha.gpg] https://debian.koha-community.org/koha ${KOHA_VERSION} main bullseye" | tee /etc/apt/sources.list.d/koha.list
@ -45,7 +51,7 @@ RUN a2enmod rewrite \
&& mkdir -p /var/log/koha/apache \ && mkdir -p /var/log/koha/apache \
&& chown -R www-data:www-data /var/log/koha/apache && chown -R www-data:www-data /var/log/koha/apache
COPY --chown 0:0 files/ / COPY --chown=0:0 files/ /
WORKDIR /docker WORKDIR /docker
EXPOSE 2100 6001 8080 8081 EXPOSE 2100 6001 8080 8081

View file

@ -1,53 +0,0 @@
FROM debian:bullseye
ENV DEBIAN_FRONTEND noninteractive
ARG S6_OVERLAY_VERSION=3.1.3.0
ARG S6_OVERLAY_ARCH="aarch64"
ARG KOHA_VERSION=22.11
LABEL org.opencontainers.image.source=https://github.com/teorgamm/koha-docker
RUN apt-get update \
&& apt-get install -y \
wget \
apache2 \
gnupg2 \
apt-transport-https \
xz-utils \
&& rm -rf /var/cache/apt/archives/* \
&& rm -rf /var/lib/apt/lists/*
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-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 && \
echo "deb [signed-by=/etc/apt/keyrings/koha.gpg] https://debian.koha-community.org/koha ${KOHA_VERSION} main bullseye" | tee /etc/apt/sources.list.d/koha.list
# Install Koha
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/*
RUN a2enmod rewrite \
&& a2enmod headers \
&& a2enmod proxy_http \
&& a2enmod cgi \
&& a2dissite 000-default \
&& 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 --chown 0:0 files/ /
WORKDIR /docker
EXPOSE 2100 6001 8080 8081
CMD [ "/init" ]

View file

@ -1,53 +0,0 @@
FROM debian:bullseye
ENV DEBIAN_FRONTEND noninteractive
ARG S6_OVERLAY_VERSION=3.1.3.0
ARG S6_OVERLAY_ARCH="armhf"
ARG KOHA_VERSION=22.11
LABEL org.opencontainers.image.source=https://github.com/teorgamm/koha-docker
RUN apt-get update \
&& apt-get install -y \
wget \
apache2 \
gnupg2 \
apt-transport-https \
xz-utils \
&& rm -rf /var/cache/apt/archives/* \
&& rm -rf /var/lib/apt/lists/*
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-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 && \
echo "deb [signed-by=/etc/apt/keyrings/koha.gpg] https://debian.koha-community.org/koha ${KOHA_VERSION} main bullseye" | tee /etc/apt/sources.list.d/koha.list
# Install Koha
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/*
RUN a2enmod rewrite \
&& a2enmod headers \
&& a2enmod proxy_http \
&& a2enmod cgi \
&& a2dissite 000-default \
&& 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 --chown 0:0 files/ /
WORKDIR /docker
EXPOSE 2100 6001 8080 8081
CMD [ "/init" ]

View file

@ -1,6 +1,6 @@
# koha-docker # koha-docker
![Docker Image Version (tag latest semver)](https://img.shields.io/docker/v/teogramm/koha/22.11) ![Docker Image Version (tag latest semver)](https://img.shields.io/docker/v/teogramm/koha/latest)
A Koha Docker container which includes: A Koha Docker container which includes:
* The Apache webserver serving the OPAC (Port 8080) and * The Apache webserver serving the OPAC (Port 8080) and
@ -26,10 +26,15 @@ The image is available on [Docker Hub](https://hub.docker.com/r/teogramm/koha)
The main configuration environment variables are documented in The main configuration environment variables are documented in
[config-main.env](config-main.env). [config-main.env](config-main.env).
For a quick start check out the included [docker-compose](examples/docker-compose.yaml) file. The username and password for the initial setup are the same as the database username and password.
Logs for stored under the `/var/log/koha` directory. Logs for stored under the `/var/log/koha` directory.
In order to function, Koha requires a MySQL database, a Memcached server and a RabbitMQ server with the stomp plugin.
The provided [docker-compose file](examples/docker-compose.yaml) sets up all of these as containers. It provides an easy way to
get a Koha insstance up and running. For a production environment it is recommened that each container is set up separately.
## Credits ## Credits
Some scripts have been taken from https://gitlab.com/koha-community/docker/koha-docker and modified. Some scripts have been taken from https://gitlab.com/koha-community/docker/koha-docker and modified.

View file

@ -20,10 +20,11 @@ KOHA_LANGS=
ZEBRA_MARC_FORMAT=marc21 ZEBRA_MARC_FORMAT=marc21
# Elasticsearch options # Elasticsearch options
# If the ELASTICSEARCH_HOST variable is set the # If the USE_ELASTICSEARCH variable is set the
# container is set yp to use Elasticsearch. A # container is set yp to use Elasticsearch. A
# Zebra server is spawned inside the container, # Zebra server is spawned inside the container,
# otherwise. # otherwise.
#USE_ELASTICSEARCH=true
#ELASTICSEARCH_HOST= #ELASTICSEARCH_HOST=
#OVERRIDE_SYSPREF_SearchEngine=Elasticsearch #OVERRIDE_SYSPREF_SearchEngine=Elasticsearch

View file

@ -1,7 +1,7 @@
version: "3.9" version: "3.9"
services: services:
koha: koha:
image: teogramm/koha:22.11 image: teogramm/koha:24.11
ports: ports:
- 8080:8080 - 8080:8080
- 8081:8081 - 8081:8081
@ -23,14 +23,14 @@ services:
- memcached - memcached
rabbitmq: rabbitmq:
image: rabbitmq image: docker.io/rabbitmq:3
volumes: volumes:
- ./.rabbitmq_plugins:/etc/rabbitmq/enabled_plugins - ./rabbitmq_plugins:/etc/rabbitmq/enabled_plugins
networks: networks:
- koha - koha
db: db:
image: mariadb image: docker.io/mariadb:11
volumes: volumes:
- mariadb-koha:/var/lib/mysql - mariadb-koha:/var/lib/mysql
environment: environment:
@ -42,7 +42,7 @@ services:
- koha - koha
memcached: memcached:
image: memcached image: docker.io/memcached
networks: networks:
- koha - koha

View file

@ -10,5 +10,6 @@
postrotate postrotate
/command/s6-svc -h /run/service/apache2 /command/s6-svc -h /run/service/apache2
/command/s6-svc -r /run/service/plack /command/s6-svc -r /run/service/plack
/command/s6-svc -r /run/service/zebra-indexer
endscript endscript
} }

View file

@ -0,0 +1,9 @@
#!/command/execlineb -P
fdmove -c 2 1
s6-envdir /etc/koha-envvars
s6-setuidgid default-koha
/usr/bin/perl /usr/share/koha/bin/workers/background_jobs_worker.pl --queue long_tasks

View file

@ -0,0 +1 @@
longrun

View file

@ -1,5 +1,4 @@
#!/command/execlineb -P #!/command/execlineb -P
with-contenv
fdmove -c 2 1 fdmove -c 2 1
@ -7,4 +6,4 @@ s6-envdir /etc/koha-envvars
s6-setuidgid default-koha s6-setuidgid default-koha
/usr/bin/perl /usr/share/koha/bin/background_jobs_worker.pl /usr/bin/perl /usr/share/koha/bin/workers/background_jobs_worker.pl

View file

@ -1,4 +1,12 @@
#!/command/execlineb -P #!/command/execlineb -P
with-contenv
importas -D "" elastic USE_ELASTICSEARCH
if -n { test "${elastic}" = "true" }
redirfd -a 1 /var/log/koha/default/zebra-indexer.log
fdmove -c 2 1 fdmove -c 2 1
s6-envdir /etc/koha-envvars s6-envdir /etc/koha-envvars

View file

@ -1,6 +1,14 @@
#!/command/execlineb -P #!/command/execlineb -P
with-contenv
importas -D "" elastic USE_ELASTICSEARCH
if -n { test "${elastic}" = "true" }
fdmove -c 2 1 fdmove -c 2 1
s6-envdir /etc/koha-envvars
s6-setuidgid default-koha s6-setuidgid default-koha
/usr/bin/zebrasrv -v 1 -f /etc/koha/sites/default/koha-conf.xml /usr/bin/zebrasrv -v 1 -f /etc/koha/sites/default/koha-conf.xml

View file

@ -30,7 +30,7 @@ MB_PARAMS="--mb-host ${MB_HOST} --mb-port ${MB_PORT} --mb-user ${MB_USER} --mb-p
# Configure the elasticsearch server # Configure the elasticsearch server
ES_PARAMS="" ES_PARAMS=""
if [[ "${ELASTICSEARCH_HOST}" != "" ]] if [[ "${USE_ELASTICSEARCH}" = "true" ]]
then then
ES_PARAMS="--elasticsearch-server ${ELASTICSEARCH_HOST}" ES_PARAMS="--elasticsearch-server ${ELASTICSEARCH_HOST}"
fi fi
@ -45,12 +45,8 @@ else
fi fi
# Configure search daemon # Configure search daemon
if [ "${USE_ELASTICSEARCH}" != "true" ] if [ "${USE_ELASTICSEARCH}" = "true" ]
then 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
else
koha-elasticsearch --rebuild -p $(grep -c ^processor /proc/cpuinfo) ${KOHA_INSTANCE} & koha-elasticsearch --rebuild -p $(grep -c ^processor /proc/cpuinfo) ${KOHA_INSTANCE} &
fi fi