diff --git a/.env b/.env
deleted file mode 100644
index 3f202c0..0000000
--- a/.env
+++ /dev/null
@@ -1,13 +0,0 @@
-# Versiones
-KOHA_VERSION=24.11
-MARIADB_VERSION=11
-
-# Puertos
-KOHA_INTRANET_PORT=8080
-KOHA_OPAC_PORT=8081
-
-# Base de datos
-MARIADB_DATABASE=koha_teolib
-MARIADB_USER=koha_teolib
-MARIADB_PASSWORD=cambia_esta_contraseƱa
-MARIADB_ROOT_PASSWORD=cambia_esta_contraseƱa_root
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..4c49bd7
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
+.env
diff --git a/docker-compose.yml b/docker-compose.yml
index c434c29..2c6c28e 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -1,6 +1,7 @@
services:
koha:
- image: teogramm/koha:${KOHA_VERSION:-24.11}
+ build:
+ context: ./koha
ports:
- "${KOHA_INTRANET_PORT:-8080}:8080"
- "${KOHA_OPAC_PORT:-8081}:8081"
diff --git a/koha/Dockerfile b/koha/Dockerfile
new file mode 100644
index 0000000..5501e3e
--- /dev/null
+++ b/koha/Dockerfile
@@ -0,0 +1,59 @@
+FROM debian:bookworm
+
+ENV DEBIAN_FRONTEND=noninteractive
+ARG S6_OVERLAY_VERSION=3.2.0.2
+ARG KOHA_VERSION=26.05
+ARG TARGETARCH
+
+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
+
+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 && \
+ 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" ]
diff --git a/koha/files/docker/templates/SIPconfig.xml b/koha/files/docker/templates/SIPconfig.xml
new file mode 100644
index 0000000..13061f7
--- /dev/null
+++ b/koha/files/docker/templates/SIPconfig.xml
@@ -0,0 +1,60 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ${SIP_CONF_ACCOUNTS}
+
+
+
+
+
+ ${SIP_CONF_LIBS}
+
+
diff --git a/koha/files/docker/templates/koha-common.cnf b/koha/files/docker/templates/koha-common.cnf
new file mode 100644
index 0000000..701bc2f
--- /dev/null
+++ b/koha/files/docker/templates/koha-common.cnf
@@ -0,0 +1,4 @@
+[client]
+host = ${MYSQL_SERVER}
+user = root
+password = ${MYSQL_PASSWORD}
diff --git a/koha/files/docker/templates/koha-sites.conf b/koha/files/docker/templates/koha-sites.conf
new file mode 100644
index 0000000..3a481fe
--- /dev/null
+++ b/koha/files/docker/templates/koha-sites.conf
@@ -0,0 +1,61 @@
+# NOTE: for a complete list of valid options please read koha-create(8)
+
+## Apache virtual hosts creation variables
+#
+# Please note that the URLs are built like this:
+# OPAC: http://:
+# STAFF: http://:
+DOMAIN="${KOHA_DOMAIN}"
+INTRAPORT="${KOHA_INTRANET_PORT}"
+INTRAPREFIX="${KOHA_INTRANET_PREFIX}"
+INTRASUFFIX="${KOHA_INTRANET_SUFFIX}"
+OPACPORT="${KOHA_OPAC_PORT}"
+OPACPREFIX="${KOHA_OPAC_PREFIX}"
+OPACSUFFIX="${KOHA_OPAC_SUFFIX}"
+
+## Default data to be loaded
+#
+# DEFAULTSQL: filename
+# Specify an SQL file with default data to load during instance creation
+# default: (empty)
+DEFAULTSQL=""
+
+## Zebra global configuration variables
+#
+# ZEBRA_MARC_FORMAT: 'marc21' | 'normarc' | 'unimarc'
+# Specifies the MARC records format for indexing
+# default: 'marc21'
+ZEBRA_MARC_FORMAT="${ZEBRA_MARC_FORMAT}"
+
+# ZEBRA_LANGUAGE: 'cs' | 'en' | 'es' | 'fr' | 'nb' | 'ru' | 'uk'
+# Primary language for Zebra indexing
+# default: 'en'
+ZEBRA_LANGUAGE="${ZEBRA_LANGUAGE}"
+
+# BIBLIOS_INDEXING_MODE: 'dom' | 'grs1'
+# Indexing mode for bibliographic records
+# default: 'dom'
+BIBLIOS_INDEXING_MODE="${BIBLIOS_INDEXING_MODE}"
+
+# AUTHORITIES_INDEXING_MODE: 'dom' | 'grs1'
+# Indexing mode for authority records
+# default: 'dom'
+AUTHORITIES_INDEXING_MODE="${AUTHORITIES_INDEXING_MODE}"
+
+## Memcached global configuration variables
+#
+# USE_MEMCACHED: 'yes' | 'no'
+# Make the created instance use memcached. Can be altered later.
+# default: 'no'
+USE_MEMCACHED="${USE_MEMCACHED}"
+
+# MEMCACHED_SERVERS: comma separated list of memcached servers (ip:port)
+# Specify a list of memcached servers for the Koha instance
+# default: '127.0.0.1:11211'
+MEMCACHED_SERVERS="${MEMCACHED_SERVERS}"
+
+# MEMCACHED_PREFIX:
+# Specify a string to be used as prefix for defining the memcached namespace
+# for the created instance.
+# default: 'koha_'
+MEMCACHED_PREFIX="koha_"
diff --git a/koha/files/etc/cron.d/koha b/koha/files/etc/cron.d/koha
new file mode 100644
index 0000000..c87207c
--- /dev/null
+++ b/koha/files/etc/cron.d/koha
@@ -0,0 +1,12 @@
+# /etc/cron.d/koha-common
+#
+# Call koha-rebuild-zebra for each enabled Koha instance, to make sure the
+# Zebra indexes are up to date.
+
+SHELL=/bin/sh
+PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
+
+# Uncomment the following line if you do not want to use the koha-index-daemon integration
+# */5 * * * * root test -x /usr/sbin/koha-rebuild-zebra && koha-rebuild-zebra -q $(koha-list --enabled)
+
+*/15 * * * * root koha-foreach --chdir --enabled --email /usr/share/koha/bin/cronjobs/process_message_queue.pl
diff --git a/koha/files/etc/cron.daily/koha b/koha/files/etc/cron.daily/koha
new file mode 100755
index 0000000..0d960ef
--- /dev/null
+++ b/koha/files/etc/cron.daily/koha
@@ -0,0 +1,33 @@
+#!/bin/sh
+# /etc/cron.daily/koha-common -- Daily housekeeping tasks for all Kohas.
+# Copyright 2010 Catalyst IT, Ltd
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see .
+
+koha-foreach --chdir --enabled /usr/share/koha/bin/cronjobs/automatic_renewals.pl -c
+koha-foreach --chdir --enabled /usr/share/koha/bin/cronjobs/automatic_checkin.pl
+koha-foreach --chdir --enabled /usr/share/koha/bin/cronjobs/recalls/expire_recalls.pl
+koha-foreach --chdir --enabled /usr/share/koha/bin/cronjobs/recalls/overdue_recalls.pl
+koha-foreach --chdir --enabled /usr/share/koha/bin/cronjobs/fines.pl
+koha-foreach --chdir --enabled --email /usr/share/koha/bin/cronjobs/overdue_notices.pl -t
+koha-foreach --chdir --enabled --email /usr/share/koha/bin/cronjobs/advance_notices.pl -c
+koha-foreach --chdir --enabled /usr/share/koha/bin/cronjobs/serialsUpdate.pl -c
+koha-foreach --chdir --enabled /usr/share/koha/bin/cronjobs/membership_expiry.pl -c
+koha-foreach --chdir --enabled /usr/share/koha/bin/cronjobs/holds/cancel_expired_holds.pl >/dev/null 2>&1
+koha-foreach --chdir --enabled /usr/share/koha/bin/cronjobs/cleanup_database.pl --confirm --sessions --zebraqueue 10 --list-invites --temp-uploads --del-unv-selfreg 14
+koha-foreach --chdir --enabled --noemail /usr/share/koha/bin/cronjobs/cleanup_database.pl --confirm --mail
+koha-foreach --chdir --enabled /usr/share/koha/bin/cronjobs/holds/auto_unsuspend_holds.pl > /dev/null 2>&1
+koha-foreach --chdir --enabled /usr/share/koha/bin/cronjobs/merge_authorities.pl -b
+koha-foreach --chdir --enabled /usr/share/koha/bin/cronjobs/plugins_nightly.pl
+koha-run-backups --days 2 --output /var/spool/koha
diff --git a/koha/files/etc/cron.hourly/koha b/koha/files/etc/cron.hourly/koha
new file mode 100755
index 0000000..0b8c2c8
--- /dev/null
+++ b/koha/files/etc/cron.hourly/koha
@@ -0,0 +1,20 @@
+#!/bin/sh
+# /etc/cron.hourly/koha-common -- Hourly housekeeping tasks for all Kohas.
+# Copyright 2010 Catalyst IT, Ltd
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see .
+
+
+koha-foreach --chdir --enabled /usr/share/koha/bin/cronjobs/holds/build_holds_queue.pl
+koha-foreach --chdir --enabled /usr/share/koha/bin/cronjobs/automatic_checkin.pl
diff --git a/koha/files/etc/cron.monthly/koha b/koha/files/etc/cron.monthly/koha
new file mode 100755
index 0000000..000854b
--- /dev/null
+++ b/koha/files/etc/cron.monthly/koha
@@ -0,0 +1,19 @@
+#!/bin/sh
+# /etc/cron.monthly/koha-common -- Monthly housekeeping tasks for all Kohas.
+# Copyright 2015 Biblibre
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see .
+
+
+koha-foreach --chdir --enabled /usr/share/koha/bin/cronjobs/share_usage_with_koha_community.pl
diff --git a/koha/files/etc/koha-envvars/INSTANCE_NAME b/koha/files/etc/koha-envvars/INSTANCE_NAME
new file mode 100644
index 0000000..331d858
--- /dev/null
+++ b/koha/files/etc/koha-envvars/INSTANCE_NAME
@@ -0,0 +1 @@
+default
\ No newline at end of file
diff --git a/koha/files/etc/koha-envvars/KOHA_CONF b/koha/files/etc/koha-envvars/KOHA_CONF
new file mode 100644
index 0000000..9139d50
--- /dev/null
+++ b/koha/files/etc/koha-envvars/KOHA_CONF
@@ -0,0 +1 @@
+/etc/koha/sites/default/koha-conf.xml
\ No newline at end of file
diff --git a/koha/files/etc/koha-envvars/KOHA_HOME b/koha/files/etc/koha-envvars/KOHA_HOME
new file mode 100644
index 0000000..2cdc823
--- /dev/null
+++ b/koha/files/etc/koha-envvars/KOHA_HOME
@@ -0,0 +1 @@
+/usr/share/koha
\ No newline at end of file
diff --git a/koha/files/etc/koha-envvars/PERL5LIB b/koha/files/etc/koha-envvars/PERL5LIB
new file mode 100644
index 0000000..b43aa0a
--- /dev/null
+++ b/koha/files/etc/koha-envvars/PERL5LIB
@@ -0,0 +1 @@
+/usr/share/koha/lib
\ No newline at end of file
diff --git a/koha/files/etc/logrotate.d/koha-core b/koha/files/etc/logrotate.d/koha-core
new file mode 100644
index 0000000..39abfef
--- /dev/null
+++ b/koha/files/etc/logrotate.d/koha-core
@@ -0,0 +1,15 @@
+/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
+ /command/s6-svc -r /run/service/zebra-indexer
+ endscript
+}
diff --git a/koha/files/etc/s6-overlay/s6-rc.d/apache2/dependencies.d/base b/koha/files/etc/s6-overlay/s6-rc.d/apache2/dependencies.d/base
new file mode 100644
index 0000000..e69de29
diff --git a/koha/files/etc/s6-overlay/s6-rc.d/apache2/dependencies.d/prepare b/koha/files/etc/s6-overlay/s6-rc.d/apache2/dependencies.d/prepare
new file mode 100644
index 0000000..e69de29
diff --git a/koha/files/etc/s6-overlay/s6-rc.d/apache2/run b/koha/files/etc/s6-overlay/s6-rc.d/apache2/run
new file mode 100755
index 0000000..87526cb
--- /dev/null
+++ b/koha/files/etc/s6-overlay/s6-rc.d/apache2/run
@@ -0,0 +1,7 @@
+#!/command/execlineb -P
+fdmove -c 2 1
+
+trap { SIGTERM { apache2ctl stop }
+ SIGHUP { apache2ctl graceful } }
+
+apache2ctl -D "FOREGROUND"
diff --git a/koha/files/etc/s6-overlay/s6-rc.d/apache2/type b/koha/files/etc/s6-overlay/s6-rc.d/apache2/type
new file mode 100644
index 0000000..5883cff
--- /dev/null
+++ b/koha/files/etc/s6-overlay/s6-rc.d/apache2/type
@@ -0,0 +1 @@
+longrun
diff --git a/koha/files/etc/s6-overlay/s6-rc.d/cron/dependencies.d/base b/koha/files/etc/s6-overlay/s6-rc.d/cron/dependencies.d/base
new file mode 100644
index 0000000..e69de29
diff --git a/koha/files/etc/s6-overlay/s6-rc.d/cron/dependencies.d/prepare b/koha/files/etc/s6-overlay/s6-rc.d/cron/dependencies.d/prepare
new file mode 100644
index 0000000..e69de29
diff --git a/koha/files/etc/s6-overlay/s6-rc.d/cron/run b/koha/files/etc/s6-overlay/s6-rc.d/cron/run
new file mode 100755
index 0000000..360ca36
--- /dev/null
+++ b/koha/files/etc/s6-overlay/s6-rc.d/cron/run
@@ -0,0 +1,3 @@
+#!/command/execlineb -P
+fdmove -c 2 1
+/usr/sbin/cron -f -L 5
diff --git a/koha/files/etc/s6-overlay/s6-rc.d/cron/type b/koha/files/etc/s6-overlay/s6-rc.d/cron/type
new file mode 100644
index 0000000..5883cff
--- /dev/null
+++ b/koha/files/etc/s6-overlay/s6-rc.d/cron/type
@@ -0,0 +1 @@
+longrun
diff --git a/koha/files/etc/s6-overlay/s6-rc.d/plack/dependencies.d/base b/koha/files/etc/s6-overlay/s6-rc.d/plack/dependencies.d/base
new file mode 100644
index 0000000..e69de29
diff --git a/koha/files/etc/s6-overlay/s6-rc.d/plack/dependencies.d/prepare b/koha/files/etc/s6-overlay/s6-rc.d/plack/dependencies.d/prepare
new file mode 100644
index 0000000..e69de29
diff --git a/koha/files/etc/s6-overlay/s6-rc.d/plack/run b/koha/files/etc/s6-overlay/s6-rc.d/plack/run
new file mode 100755
index 0000000..2bba432
--- /dev/null
+++ b/koha/files/etc/s6-overlay/s6-rc.d/plack/run
@@ -0,0 +1,6 @@
+#!/command/execlineb -P
+fdmove -c 2 1
+
+s6-envdir /etc/koha-envvars
+
+/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"
diff --git a/koha/files/etc/s6-overlay/s6-rc.d/plack/type b/koha/files/etc/s6-overlay/s6-rc.d/plack/type
new file mode 100644
index 0000000..5883cff
--- /dev/null
+++ b/koha/files/etc/s6-overlay/s6-rc.d/plack/type
@@ -0,0 +1 @@
+longrun
diff --git a/koha/files/etc/s6-overlay/s6-rc.d/prepare-koha/dependencies.d/base b/koha/files/etc/s6-overlay/s6-rc.d/prepare-koha/dependencies.d/base
new file mode 100644
index 0000000..e69de29
diff --git a/koha/files/etc/s6-overlay/s6-rc.d/prepare-koha/type b/koha/files/etc/s6-overlay/s6-rc.d/prepare-koha/type
new file mode 100644
index 0000000..bdd22a1
--- /dev/null
+++ b/koha/files/etc/s6-overlay/s6-rc.d/prepare-koha/type
@@ -0,0 +1 @@
+oneshot
diff --git a/koha/files/etc/s6-overlay/s6-rc.d/prepare-koha/up b/koha/files/etc/s6-overlay/s6-rc.d/prepare-koha/up
new file mode 100755
index 0000000..56a3a00
--- /dev/null
+++ b/koha/files/etc/s6-overlay/s6-rc.d/prepare-koha/up
@@ -0,0 +1 @@
+/etc/s6-overlay/scripts/02-setup-koha.sh
diff --git a/koha/files/etc/s6-overlay/s6-rc.d/prepare/contents.d/prepare-koha b/koha/files/etc/s6-overlay/s6-rc.d/prepare/contents.d/prepare-koha
new file mode 100644
index 0000000..e69de29
diff --git a/koha/files/etc/s6-overlay/s6-rc.d/prepare/type b/koha/files/etc/s6-overlay/s6-rc.d/prepare/type
new file mode 100644
index 0000000..757b422
--- /dev/null
+++ b/koha/files/etc/s6-overlay/s6-rc.d/prepare/type
@@ -0,0 +1 @@
+bundle
diff --git a/koha/files/etc/s6-overlay/s6-rc.d/user/contents.d/apache2 b/koha/files/etc/s6-overlay/s6-rc.d/user/contents.d/apache2
new file mode 100644
index 0000000..e69de29
diff --git a/koha/files/etc/s6-overlay/s6-rc.d/user/contents.d/cron b/koha/files/etc/s6-overlay/s6-rc.d/user/contents.d/cron
new file mode 100644
index 0000000..e69de29
diff --git a/koha/files/etc/s6-overlay/s6-rc.d/user/contents.d/plack b/koha/files/etc/s6-overlay/s6-rc.d/user/contents.d/plack
new file mode 100644
index 0000000..e69de29
diff --git a/koha/files/etc/s6-overlay/s6-rc.d/user/contents.d/worker b/koha/files/etc/s6-overlay/s6-rc.d/user/contents.d/worker
new file mode 100644
index 0000000..e69de29
diff --git a/koha/files/etc/s6-overlay/s6-rc.d/user/contents.d/worker-long-tasks b/koha/files/etc/s6-overlay/s6-rc.d/user/contents.d/worker-long-tasks
new file mode 100644
index 0000000..e69de29
diff --git a/koha/files/etc/s6-overlay/s6-rc.d/user/contents.d/zebra-indexer b/koha/files/etc/s6-overlay/s6-rc.d/user/contents.d/zebra-indexer
new file mode 100644
index 0000000..e69de29
diff --git a/koha/files/etc/s6-overlay/s6-rc.d/user/contents.d/zebra-server b/koha/files/etc/s6-overlay/s6-rc.d/user/contents.d/zebra-server
new file mode 100644
index 0000000..e69de29
diff --git a/koha/files/etc/s6-overlay/s6-rc.d/worker-long-tasks/dependencies.d/base b/koha/files/etc/s6-overlay/s6-rc.d/worker-long-tasks/dependencies.d/base
new file mode 100644
index 0000000..e69de29
diff --git a/koha/files/etc/s6-overlay/s6-rc.d/worker-long-tasks/dependencies.d/prepare b/koha/files/etc/s6-overlay/s6-rc.d/worker-long-tasks/dependencies.d/prepare
new file mode 100644
index 0000000..e69de29
diff --git a/koha/files/etc/s6-overlay/s6-rc.d/worker-long-tasks/run b/koha/files/etc/s6-overlay/s6-rc.d/worker-long-tasks/run
new file mode 100755
index 0000000..3824054
--- /dev/null
+++ b/koha/files/etc/s6-overlay/s6-rc.d/worker-long-tasks/run
@@ -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
diff --git a/koha/files/etc/s6-overlay/s6-rc.d/worker-long-tasks/type b/koha/files/etc/s6-overlay/s6-rc.d/worker-long-tasks/type
new file mode 100644
index 0000000..5883cff
--- /dev/null
+++ b/koha/files/etc/s6-overlay/s6-rc.d/worker-long-tasks/type
@@ -0,0 +1 @@
+longrun
diff --git a/koha/files/etc/s6-overlay/s6-rc.d/worker/dependencies.d/base b/koha/files/etc/s6-overlay/s6-rc.d/worker/dependencies.d/base
new file mode 100644
index 0000000..e69de29
diff --git a/koha/files/etc/s6-overlay/s6-rc.d/worker/dependencies.d/prepare b/koha/files/etc/s6-overlay/s6-rc.d/worker/dependencies.d/prepare
new file mode 100644
index 0000000..e69de29
diff --git a/koha/files/etc/s6-overlay/s6-rc.d/worker/run b/koha/files/etc/s6-overlay/s6-rc.d/worker/run
new file mode 100755
index 0000000..844a57c
--- /dev/null
+++ b/koha/files/etc/s6-overlay/s6-rc.d/worker/run
@@ -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
diff --git a/koha/files/etc/s6-overlay/s6-rc.d/worker/type b/koha/files/etc/s6-overlay/s6-rc.d/worker/type
new file mode 100644
index 0000000..5883cff
--- /dev/null
+++ b/koha/files/etc/s6-overlay/s6-rc.d/worker/type
@@ -0,0 +1 @@
+longrun
diff --git a/koha/files/etc/s6-overlay/s6-rc.d/zebra-indexer/dependencies.d/prepare b/koha/files/etc/s6-overlay/s6-rc.d/zebra-indexer/dependencies.d/prepare
new file mode 100644
index 0000000..e69de29
diff --git a/koha/files/etc/s6-overlay/s6-rc.d/zebra-indexer/dependencies.d/zebra-server b/koha/files/etc/s6-overlay/s6-rc.d/zebra-indexer/dependencies.d/zebra-server
new file mode 100644
index 0000000..e69de29
diff --git a/koha/files/etc/s6-overlay/s6-rc.d/zebra-indexer/run b/koha/files/etc/s6-overlay/s6-rc.d/zebra-indexer/run
new file mode 100755
index 0000000..110cc50
--- /dev/null
+++ b/koha/files/etc/s6-overlay/s6-rc.d/zebra-indexer/run
@@ -0,0 +1,16 @@
+#!/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
+
+s6-envdir /etc/koha-envvars
+
+s6-setuidgid default-koha
+
+/usr/bin/perl /usr/share/koha/bin/migration_tools/rebuild_zebra.pl -daemon -sleep 5
diff --git a/koha/files/etc/s6-overlay/s6-rc.d/zebra-indexer/type b/koha/files/etc/s6-overlay/s6-rc.d/zebra-indexer/type
new file mode 100644
index 0000000..5883cff
--- /dev/null
+++ b/koha/files/etc/s6-overlay/s6-rc.d/zebra-indexer/type
@@ -0,0 +1 @@
+longrun
diff --git a/koha/files/etc/s6-overlay/s6-rc.d/zebra-server/dependencies.d/base b/koha/files/etc/s6-overlay/s6-rc.d/zebra-server/dependencies.d/base
new file mode 100644
index 0000000..e69de29
diff --git a/koha/files/etc/s6-overlay/s6-rc.d/zebra-server/dependencies.d/prepare b/koha/files/etc/s6-overlay/s6-rc.d/zebra-server/dependencies.d/prepare
new file mode 100644
index 0000000..e69de29
diff --git a/koha/files/etc/s6-overlay/s6-rc.d/zebra-server/run b/koha/files/etc/s6-overlay/s6-rc.d/zebra-server/run
new file mode 100755
index 0000000..2798235
--- /dev/null
+++ b/koha/files/etc/s6-overlay/s6-rc.d/zebra-server/run
@@ -0,0 +1,15 @@
+#!/command/execlineb -P
+with-contenv
+
+importas -D "" elastic USE_ELASTICSEARCH
+
+if -n { test "${elastic}" = "true" }
+
+fdmove -c 2 1
+
+s6-envdir /etc/koha-envvars
+
+s6-setuidgid default-koha
+
+/usr/bin/zebrasrv -v 1 -f /etc/koha/sites/default/koha-conf.xml
+
diff --git a/koha/files/etc/s6-overlay/s6-rc.d/zebra-server/type b/koha/files/etc/s6-overlay/s6-rc.d/zebra-server/type
new file mode 100644
index 0000000..5883cff
--- /dev/null
+++ b/koha/files/etc/s6-overlay/s6-rc.d/zebra-server/type
@@ -0,0 +1 @@
+longrun
diff --git a/koha/files/etc/s6-overlay/scripts/02-setup-koha.sh b/koha/files/etc/s6-overlay/scripts/02-setup-koha.sh
new file mode 100755
index 0000000..ea98707
--- /dev/null
+++ b/koha/files/etc/s6-overlay/scripts/02-setup-koha.sh
@@ -0,0 +1,97 @@
+#!/command/with-contenv bash
+
+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=${MYSQL_USER:-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}
+export KOHA_ES_NAME=${KOHA_ES_NAME:-es}
+
+# RabbitMQ settings
+export MB_HOST=${MB_HOST:-rabbitmq}
+export MB_PORT=${MB_PORT:-61613}
+export MB_USER=${MB_USER:-guest}
+export MB_PASS=${MB_PASS:-guest}
+
+envsubst < /docker/templates/koha-sites.conf > /etc/koha/koha-sites.conf
+
+
+# /etc/mysql/koha-common.cnf is used by a few koha scripts
+rm /etc/mysql/koha-common.cnf && envsubst < /docker/templates/koha-common.cnf > /etc/mysql/koha-common.cnf
+chmod 660 /etc/mysql/koha-common.cnf
+
+# Create entry with admin username, password and myqsl server for this instance
+echo -n "default:${MYSQL_USER}:${MYSQL_PASSWORD}:${DB_NAME}:${MYSQL_SERVER}" > /etc/koha/passwd
+
+source /usr/share/koha/bin/koha-functions.sh
+
+MB_PARAMS="--mb-host ${MB_HOST} --mb-port ${MB_PORT} --mb-user ${MB_USER} --mb-pass ${MB_PASS}"
+
+# Configure the elasticsearch server
+ES_PARAMS=""
+if [[ "${USE_ELASTICSEARCH}" = "true" ]]
+then
+ ES_PARAMS="--elasticsearch-server ${ELASTICSEARCH_HOST}"
+fi
+
+if ! is_instance ${KOHA_INSTANCE} || [ ! -f "/etc/koha/sites/${KOHA_INSTANCE}/koha_conf.xml" ]
+then
+ echo "Executing koha-create for instance ${KOHA_INSTANCE}"
+ koha-create ${ES_PARAMS} ${MB_PARAMS} --use-db ${KOHA_INSTANCE} | true
+else
+ echo "Creating directory structure"
+ koha-create-dirs ${KOHA_INSTANCE}
+fi
+
+# Configure search daemon
+if [ "${USE_ELASTICSEARCH}" = "true" ]
+then
+ koha-elasticsearch --rebuild -p $(grep -c ^processor /proc/cpuinfo) ${KOHA_INSTANCE} &
+fi
+
+for i in $(koha-translate -l)
+do
+ if [ "${KOHA_LANGS}" = "" ] || ! echo "${KOHA_LANGS}"|grep -q -w $i
+ then
+ echo "Removing language $i"
+ koha-translate -r $i
+ else
+ echo "Checking language $i"
+ koha-translate -c $i
+ fi
+done
+
+if [ "${KOHA_LANGS}" != "" ]
+then
+ echo "Installing languages"
+ LANGS=$(koha-translate -l)
+ for i in $KOHA_LANGS
+ do
+ if ! echo "${LANGS}"|grep -q -w $i
+ then
+ echo "Installing language $i"
+ koha-translate -i $i
+ else
+ echo "Language $i already present"
+ fi
+ done
+fi
+
+koha-plack --enable ${KOHA_INSTANCE}
+a2enmod proxy
+
+# Prevent Plack from throwing permission errors
+touch /var/log/koha/${KOHA_INSTANCE}/opac-error.log /var/log/koha/${KOHA_INSTANCE}/intranet-error.log
+chown -R ${KOHA_INSTANCE}-koha:${KOHA_INSTANCE}-koha /var/log/koha/${KOHA_INSTANCE}/
+
+service apache2 stop
+koha-indexer --stop ${KOHA_INSTANCE}
+koha-zebra --stop ${KOHA_INSTANCE}
+koha-worker --stop ${KOHA_INSTANCE}
+koha-email-enable ${KOHA_INSTANCE}