Initial commit
This commit is contained in:
commit
118b948bd4
59 changed files with 1236 additions and 0 deletions
60
files/docker/templates/SIPconfig.xml
Normal file
60
files/docker/templates/SIPconfig.xml
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
<acsconfig xmlns="http://openncip.org/acs-config/1.0/">
|
||||
<!-- above address gets nothing, it's just a namespace -->
|
||||
<error-detect enabled="true" />
|
||||
|
||||
<!--
|
||||
Set Net::Server::PreFork runtime parameters
|
||||
syslog_ident will identify SIP2 Koha server entries in syslog
|
||||
For OpenSolaris, add: syslog_logsock=stream
|
||||
-->
|
||||
<server-params
|
||||
min_servers='1'
|
||||
min_spare_servers='0'
|
||||
log_file='Sys::Syslog'
|
||||
syslog_ident='koha_sip'
|
||||
syslog_facility='local6'
|
||||
/>
|
||||
|
||||
<listeners>
|
||||
<!-- vestigial HTTP, never implemented: just use the OPAC!
|
||||
<service
|
||||
port="0:8080/tcp"
|
||||
transport="http"
|
||||
protocol="NCIP/1.0" />
|
||||
-->
|
||||
<service
|
||||
port="8023/tcp"
|
||||
transport="telnet"
|
||||
protocol="SIP/2.00"
|
||||
timeout="60" />
|
||||
|
||||
<service
|
||||
port="127.0.0.1:6001/tcp"
|
||||
transport="RAW"
|
||||
protocol="SIP/2.00"
|
||||
client_timeout="600"
|
||||
timeout="60" />
|
||||
<!--- client_timeout times out active connections which have not received
|
||||
input from the client. Many persistent connections will send a status request
|
||||
every 5-7 mins so setting this to less than that will add instability to the connection
|
||||
if explicitly set to zero, no timeout is applied to the connection.
|
||||
NB the parameter timeout applies to the login process only and should be set to a lower value
|
||||
to time out failed connections
|
||||
-->
|
||||
</listeners>
|
||||
|
||||
<accounts>
|
||||
${SIP_CONF_ACCOUNTS}
|
||||
</accounts>
|
||||
|
||||
<!--
|
||||
Institution tags are for enabled branches. There needs to be one
|
||||
institution stanza for each institution named in the accounts above.
|
||||
The implementation attribute is actually used to find the code to run,
|
||||
in our case "ILS".
|
||||
-->
|
||||
|
||||
<institutions>
|
||||
${SIP_CONF_LIBS}
|
||||
</institutions>
|
||||
</acsconfig>
|
||||
61
files/docker/templates/koha-sites.conf
Normal file
61
files/docker/templates/koha-sites.conf
Normal file
|
|
@ -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://<OPACPREFIX><INSTANCE NAME><OPACSUFFIX><DOMAIN>:<OPACPORT>
|
||||
# STAFF: http://<INTRAPREFIX><INSTANCE NAME><INTRASUFFIX><DOMAIN>:<INTRAPORT>
|
||||
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_"
|
||||
0
files/etc/s6-overlay/s6-rc.d/apache2/dependencies.d/base
Normal file
0
files/etc/s6-overlay/s6-rc.d/apache2/dependencies.d/base
Normal file
3
files/etc/s6-overlay/s6-rc.d/apache2/run
Executable file
3
files/etc/s6-overlay/s6-rc.d/apache2/run
Executable file
|
|
@ -0,0 +1,3 @@
|
|||
#!/command/execlineb -P
|
||||
fdmove -c 2 1
|
||||
apache2ctl -DFOREGROUND
|
||||
1
files/etc/s6-overlay/s6-rc.d/apache2/type
Normal file
1
files/etc/s6-overlay/s6-rc.d/apache2/type
Normal file
|
|
@ -0,0 +1 @@
|
|||
longrun
|
||||
1
files/etc/s6-overlay/s6-rc.d/cron-log-prepare/type
Normal file
1
files/etc/s6-overlay/s6-rc.d/cron-log-prepare/type
Normal file
|
|
@ -0,0 +1 @@
|
|||
oneshot
|
||||
4
files/etc/s6-overlay/s6-rc.d/cron-log-prepare/up
Normal file
4
files/etc/s6-overlay/s6-rc.d/cron-log-prepare/up
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
#!/bin/sh
|
||||
if { mkdir -p /var/log/cron }
|
||||
if { chown nobody:nogroup /var/log/cron }
|
||||
chmod 02755 /var/log/cron
|
||||
1
files/etc/s6-overlay/s6-rc.d/cron-log/consumer-for
Normal file
1
files/etc/s6-overlay/s6-rc.d/cron-log/consumer-for
Normal file
|
|
@ -0,0 +1 @@
|
|||
cron
|
||||
1
files/etc/s6-overlay/s6-rc.d/cron-log/pipeline-name
Normal file
1
files/etc/s6-overlay/s6-rc.d/cron-log/pipeline-name
Normal file
|
|
@ -0,0 +1 @@
|
|||
cron-pipeline
|
||||
2
files/etc/s6-overlay/s6-rc.d/cron-log/run
Executable file
2
files/etc/s6-overlay/s6-rc.d/cron-log/run
Executable file
|
|
@ -0,0 +1,2 @@
|
|||
#!/bin/sh
|
||||
exec logutil-service /var/log/cron
|
||||
1
files/etc/s6-overlay/s6-rc.d/cron-log/type
Normal file
1
files/etc/s6-overlay/s6-rc.d/cron-log/type
Normal file
|
|
@ -0,0 +1 @@
|
|||
longrun
|
||||
0
files/etc/s6-overlay/s6-rc.d/cron/dependencies.d/base
Normal file
0
files/etc/s6-overlay/s6-rc.d/cron/dependencies.d/base
Normal file
0
files/etc/s6-overlay/s6-rc.d/cron/dependencies.d/prepare
Normal file
0
files/etc/s6-overlay/s6-rc.d/cron/dependencies.d/prepare
Normal file
1
files/etc/s6-overlay/s6-rc.d/cron/producer-for
Normal file
1
files/etc/s6-overlay/s6-rc.d/cron/producer-for
Normal file
|
|
@ -0,0 +1 @@
|
|||
cron-log
|
||||
3
files/etc/s6-overlay/s6-rc.d/cron/run
Executable file
3
files/etc/s6-overlay/s6-rc.d/cron/run
Executable file
|
|
@ -0,0 +1,3 @@
|
|||
#!/command/execlineb -P
|
||||
fdmove -c 2 1
|
||||
/usr/sbin/cron -f -L 5
|
||||
1
files/etc/s6-overlay/s6-rc.d/cron/type
Normal file
1
files/etc/s6-overlay/s6-rc.d/cron/type
Normal file
|
|
@ -0,0 +1 @@
|
|||
longrun
|
||||
0
files/etc/s6-overlay/s6-rc.d/plack/dependencies.d/base
Normal file
0
files/etc/s6-overlay/s6-rc.d/plack/dependencies.d/base
Normal file
8
files/etc/s6-overlay/s6-rc.d/plack/run
Executable file
8
files/etc/s6-overlay/s6-rc.d/plack/run
Executable file
|
|
@ -0,0 +1,8 @@
|
|||
#!/command/execlineb -P
|
||||
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"
|
||||
1
files/etc/s6-overlay/s6-rc.d/plack/type
Normal file
1
files/etc/s6-overlay/s6-rc.d/plack/type
Normal file
|
|
@ -0,0 +1 @@
|
|||
longrun
|
||||
1
files/etc/s6-overlay/s6-rc.d/prepare-koha-envvars/type
Normal file
1
files/etc/s6-overlay/s6-rc.d/prepare-koha-envvars/type
Normal file
|
|
@ -0,0 +1 @@
|
|||
oneshot
|
||||
1
files/etc/s6-overlay/s6-rc.d/prepare-koha-envvars/up
Executable file
1
files/etc/s6-overlay/s6-rc.d/prepare-koha-envvars/up
Executable file
|
|
@ -0,0 +1 @@
|
|||
/etc/s6-overlay/scripts/01-setup-koha-envvars.sh
|
||||
1
files/etc/s6-overlay/s6-rc.d/prepare-koha/type
Normal file
1
files/etc/s6-overlay/s6-rc.d/prepare-koha/type
Normal file
|
|
@ -0,0 +1 @@
|
|||
oneshot
|
||||
1
files/etc/s6-overlay/s6-rc.d/prepare-koha/up
Executable file
1
files/etc/s6-overlay/s6-rc.d/prepare-koha/up
Executable file
|
|
@ -0,0 +1 @@
|
|||
/etc/s6-overlay/scripts/02-setup-koha.sh
|
||||
1
files/etc/s6-overlay/s6-rc.d/prepare/type
Normal file
1
files/etc/s6-overlay/s6-rc.d/prepare/type
Normal file
|
|
@ -0,0 +1 @@
|
|||
bundle
|
||||
0
files/etc/s6-overlay/s6-rc.d/user/contents.d/apache2
Normal file
0
files/etc/s6-overlay/s6-rc.d/user/contents.d/apache2
Normal file
0
files/etc/s6-overlay/s6-rc.d/user/contents.d/cron
Normal file
0
files/etc/s6-overlay/s6-rc.d/user/contents.d/cron
Normal file
0
files/etc/s6-overlay/s6-rc.d/user/contents.d/cron-log
Normal file
0
files/etc/s6-overlay/s6-rc.d/user/contents.d/cron-log
Normal file
0
files/etc/s6-overlay/s6-rc.d/user/contents.d/plack
Normal file
0
files/etc/s6-overlay/s6-rc.d/user/contents.d/plack
Normal file
0
files/etc/s6-overlay/s6-rc.d/user/contents.d/worker
Normal file
0
files/etc/s6-overlay/s6-rc.d/user/contents.d/worker
Normal file
0
files/etc/s6-overlay/s6-rc.d/worker/dependencies.d/base
Normal file
0
files/etc/s6-overlay/s6-rc.d/worker/dependencies.d/base
Normal file
12
files/etc/s6-overlay/s6-rc.d/worker/run
Executable file
12
files/etc/s6-overlay/s6-rc.d/worker/run
Executable file
|
|
@ -0,0 +1,12 @@
|
|||
#!/command/execlineb -P
|
||||
with-contenv
|
||||
|
||||
fdmove -c 2 1
|
||||
|
||||
s6-envdir /etc/koha-envvars
|
||||
|
||||
importas instancename INSTANCE_NAME
|
||||
|
||||
s6-setuidgid ${instancename}-koha
|
||||
|
||||
/usr/bin/perl /usr/share/koha/bin/background_jobs_worker.pl
|
||||
1
files/etc/s6-overlay/s6-rc.d/worker/type
Normal file
1
files/etc/s6-overlay/s6-rc.d/worker/type
Normal file
|
|
@ -0,0 +1 @@
|
|||
longrun
|
||||
10
files/etc/s6-overlay/s6-rc.d/zebra-indexer/run
Executable file
10
files/etc/s6-overlay/s6-rc.d/zebra-indexer/run
Executable file
|
|
@ -0,0 +1,10 @@
|
|||
#!/command/execlineb -P
|
||||
fdmove -c 2 1
|
||||
|
||||
s6-envdir /etc/koha-envvars
|
||||
|
||||
importas instancename INSTANCE_NAME
|
||||
|
||||
s6-setuidgid ${instancename}-koha
|
||||
|
||||
/usr/bin/perl /usr/share/koha/bin/migration_tools/rebuild_zebra.pl -daemon -sleep 5
|
||||
1
files/etc/s6-overlay/s6-rc.d/zebra-indexer/type
Normal file
1
files/etc/s6-overlay/s6-rc.d/zebra-indexer/type
Normal file
|
|
@ -0,0 +1 @@
|
|||
longrun
|
||||
10
files/etc/s6-overlay/s6-rc.d/zebra-server/run
Executable file
10
files/etc/s6-overlay/s6-rc.d/zebra-server/run
Executable file
|
|
@ -0,0 +1,10 @@
|
|||
#!/command/execlineb -P
|
||||
s6-envdir /etc/koha-envvars
|
||||
|
||||
fdmove -c 2 1
|
||||
|
||||
importas instancename INSTANCE_NAME
|
||||
|
||||
s6-setuidgid ${instancename}-koha
|
||||
|
||||
/usr/bin/zebrasrv -v 1 -f /etc/koha/sites/${instancename}/koha-conf.xml
|
||||
1
files/etc/s6-overlay/s6-rc.d/zebra-server/type
Normal file
1
files/etc/s6-overlay/s6-rc.d/zebra-server/type
Normal file
|
|
@ -0,0 +1 @@
|
|||
longrun
|
||||
6
files/etc/s6-overlay/scripts/01-setup-koha-envvars.sh
Executable file
6
files/etc/s6-overlay/scripts/01-setup-koha-envvars.sh
Executable file
|
|
@ -0,0 +1,6 @@
|
|||
#!/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
|
||||
96
files/etc/s6-overlay/scripts/02-setup-koha.sh
Executable file
96
files/etc/s6-overlay/scripts/02-setup-koha.sh
Executable file
|
|
@ -0,0 +1,96 @@
|
|||
#!/command/with-contenv bash
|
||||
|
||||
#if no koha instance name was provided, then set it as "default"
|
||||
export KOHA_INSTANCE=${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 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
|
||||
|
||||
# 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
|
||||
|
||||
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 [[ "${ELASTICSEARCH_HOST}" != "" ]]
|
||||
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
|
||||
# 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
|
||||
|
||||
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}
|
||||
Loading…
Add table
Add a link
Reference in a new issue