first commit

This commit is contained in:
Robert Nasarek 2022-02-28 11:55:26 +01:00
commit de32898f2a
9 changed files with 5213 additions and 0 deletions

220
Dockerfile Executable file
View file

@ -0,0 +1,220 @@
#
# NOTE: THIS DOCKERFILE IS GENERATED VIA "apply-templates.sh"
#
# PLEASE DO NOT EDIT IT DIRECTLY.
#
# from https://www.drupal.org/docs/system-requirements/php-requirements
FROM php:8.0-apache-bullseye
# Install all the stuff we need
# Enable rewrite
RUN set -eux; \
if command -v a2enmod; then \
a2enmod rewrite; \
fi
# Install packages
RUN apt-get update; \
apt-get install -y --no-install-recommends \
apt-utils \
autoconf \
automake \
openjdk-11-jdk \
git \
iipimage-server \
iipimage-doc \
libapache2-mod-fcgid \
libfreetype6-dev \
libjpeg-dev \
libjpeg62-turbo \
libpng-dev \
libpng16-16 \
libpq-dev \
libtiff-dev \
libtiff5 \
libtool \
libvips-dev \
libvips-tools \
libzip-dev \
imagemagick \
unzip \
vim \
wget
# Add php extensions
RUN docker-php-ext-configure gd \
--with-freetype \
--with-jpeg=/usr \
--with-webp; \
docker-php-ext-install -j "$(nproc)" \
gd \
opcache \
pdo_mysql \
pdo_pgsql \
zip
# Upload progress
RUN set -eux; \
git clone https://github.com/php/pecl-php-uploadprogress/ /usr/src/php/ext/uploadprogress/; \
docker-php-ext-configure uploadprogress; \
docker-php-ext-install uploadprogress; \
rm -rf /usr/src/php/ext/uploadprogress;
# Install apcu
RUN set -eux; \
pecl install apcu;
# Add php configs
RUN { \
echo 'extension=apcu.so'; \
echo "apc.enable_cli=1"; \
echo "apc.enable=1"; \
} >> /usr/local/etc/php/php.ini;
# Install iipsrv
RUN set -eux; \
git clone https://github.com/ruven/iipsrv.git; \
cd iipsrv; \
./autogen.sh; \
./configure; \
make; \
mkdir /fcgi-bin; \
cp src/iipsrv.fcgi /fcgi-bin/iipsrv.fcgi
# set recommended PHP.ini settings
# see https://secure.php.net/manual/en/opcache.installation.php
RUN { \
echo 'opcache.memory_consumption=128'; \
echo 'opcache.interned_strings_buffer=8'; \
echo 'opcache.max_accelerated_files=4000'; \
echo 'opcache.revalidate_freq=60'; \
echo 'opcache.fast_shutdown=1'; \
} > /usr/local/etc/php/conf.d/opcache-recommended.ini;
# set memory settings for WissKi
RUN { \
echo 'max_execution_time = 1200'; \
echo 'max_input_time = 600'; \
echo 'max_input_nesting_level = 640'; \
echo 'max_input_vars = 10000'; \
echo 'memory_limit = 512M'; \
echo 'upload_max_filesize = 512M'; \
echo 'max_file_uploads = 50'; \
echo 'post_max_size = 512M'; \
} > /usr/local/etc/php/conf.d/wisski-settings.ini;
# Solr
ENV SOLR_VERSION 8.11.1
WORKDIR /opt/
RUN set -eux; \
wget https://www.apache.org/dyn/closer.lua/lucene/solr/8.11.1/solr-${SOLR_VERSION}.tgz?action=download -O solr-${SOLR_VERSION}.tgz; \
tar xzf solr-${SOLR_VERSION}.tgz solr-${SOLR_VERSION}/bin/install_solr_service.sh --strip-components=2; \
./install_solr_service.sh solr-${SOLR_VERSION}.tgz; \
rm -r solr-${SOLR_VERSION}.tgz install_solr_service.sh
# reset apt
# apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false; \
# rm -rf /var/lib/apt/lists/*
COPY --from=composer:2 /usr/bin/composer /usr/local/bin/
# https://www.drupal.org/node/3060/release
ENV DRUPAL_VERSION 9.3.6
# Installed Drupal modules, please check and update versions if necessary
# List Requirements
ENV REQUIREMENTS="drupal/colorbox \
drupal/devel \
drupal/facets \
drupal/field_permissions \
drupal/geofield \
drupal/geofield_map \
drupal/image_effects \
drupal/imagemagick \
drupal/imce \
drupal/inline_entity_form:1.x-dev@dev \
kint-php/kint \
drupal/leaflet \
drupal/search_api \
drupal/search_api_solr \
drupal/viewfield:3.x-dev@dev \
drupal/wisski:3.x-dev@dev"
# Install Drupal, WissKI and dependencies
WORKDIR /opt/drupal
RUN set -eux; \
export COMPOSER_HOME="$(mktemp -d)"; \
composer create-project --no-interaction "drupal/recommended-project:$DRUPAL_VERSION" ./; \
composer require ${REQUIREMENTS}; \
composer require --dev drush/drush --with-all-dependencies; \
cd web/modules/contrib/wisski && composer update && cd /opt/drupal
# Copy example site
COPY sites.tar.gz /opt/sites.tar.gz
RUN rm -r /opt/drupal/web/sites; \
tar xfz /opt/sites.tar.gz --directory web/
# Copy necessary themes
COPY themes.tar.gz /opt/themes.tar.gz
RUN rm -r /opt/drupal/web/themes; \
tar xfz /opt/themes.tar.gz --directory web/
# Adjust permissions and links
RUN chown -R www-data:www-data web/sites web/modules web/themes; \
rm -r /var/www/html; \
ln -sf /opt/drupal/web /var/www/html; \
# delete composer cache
rm -rf "$COMPOSER_HOME"
# install libraries
RUN set -eux; \
mkdir -p web/libraries; \
wget https://github.com/jackmoore/colorbox/archive/refs/heads/master.zip -P web/libraries/; \
unzip web/libraries/master.zip -d web/libraries/; \
rm -r web/libraries/master.zip;\
mv web/libraries/colorbox-master web/libraries/colorbox
# Add IIPServer config
COPY iipsrv.conf /etc/apache2/mods-available/iipsrv.conf
# IIPMooViewer
RUN wget https://github.com/ruven/iipmooviewer/archive/refs/heads/master.zip -P web/libraries/; \
unzip web/libraries/master.zip -d web/libraries/; \
rm -r web/libraries/master.zip;\
mv web/libraries/iipmooviewer-master web/libraries/iipmooviewer
# Mirador
RUN wget https://github.com/rnsrk/wisski-mirador-integration/archive/refs/heads/main.zip -P web/libraries/; \
unzip web/libraries/main.zip -d web/libraries/; \
mv web/libraries/wisski-mirador-integration-main web/libraries/wisski-mirador-integration
# Add private files directory
RUN mkdir /var/www/private_files && chown -R www-data /var/www/private_files
# Add path
ENV PATH=${PATH}:/opt/drupal/vendor/bin
# Install mariadb
RUN apt install mariadb-server -y
# Copy example Database
COPY wisski.sql /opt/wisski.sql
# Install Blazegraph
ENV BLAZEGRAPH_VERSION 2_1_6
RUN mkdir -p /opt/blazegraph
WORKDIR /opt/blazegraph
RUN set -eux; \
wget https://github.com/blazegraph/database/releases/download/BLAZEGRAPH_${BLAZEGRAPH_VERSION}_RC/blazegraph.jar
COPY blazegraph /etc/init.d/
COPY blazegraph.tar.gz /opt/blazegraph/blazegraph.tar.gz
RUN update-rc.d blazegraph defaults
# Copy example data
RUN tar xfz blazegraph.tar.gz --directory /usr/lib/jvm/java-11-openjdk-amd64/bin/
WORKDIR /opt/drupal
# Startscripts
COPY start.sh /
RUN chmod +x /start.sh
CMD ["/start.sh"]
# vim:set ft=dockerfile:

38
README.md Normal file
View file

@ -0,0 +1,38 @@
# Example WissKI base Image
The base image contains all necessary dependencies, modules, themes, config files, example semantics, and libraries to install WissKI for a working WissKI instance.
## Stack
* PHP:8.0
* Drupal:9.3.6
* WissKI:3.x-dev
* IIPServer:1.2
* Mirador:3
* Mariadb:10.5.12
* Blazegraph:2.1.5
* Solr: 8.11.1.
## Build
'''bash
docker build -t <image-name:tag> .
'''
## Run
'''bash
docker run --name <container-name> -p 80:80 -p 3306 -p 9999:9999 -p 8983:8983 <image-name:tag>
'''
## Preconfigured example WissKI in image rnsrk/wisski_example, i.e. with
'''bash
docker run --name wisskiExample -p 80:80 -p 3306:3306 -p 9999:9999 -p 8983:8983 rnsrk/wisski_example
'''
If you facing trouble with the ports, you may want to use 3000 and above for testing, like
'''bash
docker run --name wisskiExample -p 3000:80 -p 3001:3306 -p 3002:9999 -p 3003:8983 rnsrk/wisski_example
'''
## Usage
Open your browser at `localhost` (respectively `localhost:3000` or the port you choosed for your apache).
## Ports inside docker
For performance and security reasons, you may do not want to expose databases etc. To connect to services inside docker networt, use 0.0.0.0 as network adress, i.e. 0.0.0.0:3306 would be the MariaDB inside the docker container.

76
blazegraph Executable file
View file

@ -0,0 +1,76 @@
#!/bin/sh
### BEGIN INIT INFO
# Provides: blazegraph daemon
# Required-Start: $local_fs $network $syslog
# Required-Stop: $local_fs $network $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Blazegraph
# Description: Blazegraph start-stop-daemon - Debian
### END INIT INFO
NAME="blazegraph"
PATH="/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin"
APPDIR="/usr/lib/jvm/java-11-openjdk-amd64/bin/"
APPBIN="java"
APPARGS="-jar -Xmx4g /opt/blazegraph/blazegraph.jar"
USER="root"
GROUP="root"
# Include functions
set -e
. /lib/lsb/init-functions
start() {
printf "Starting '$NAME'... "
start-stop-daemon --start --chuid "$USER:$GROUP" --background --make-pidfile --pidfile /var/run/$NAME.pid --chdir "$APPDIR" --exec "$APPBIN" -- $APPARGS || true
printf "done\n"
}
#We need this function to ensure the whole process tree will be killed
killtree() {
local _pid=$1
local _sig=${2-TERM}
for _child in $(ps -o pid --no-headers --ppid ${_pid}); do
killtree ${_child} ${_sig}
done
kill -${_sig} ${_pid}
}
stop() {
printf "Stopping '$NAME'... "
[ -z `cat /var/run/$NAME.pid 2>/dev/null` ] || \
while test -d /proc/$(cat /var/run/$NAME.pid); do
killtree $(cat /var/run/$NAME.pid) 15
sleep 0.5
done
[ -z `cat /var/run/$NAME.pid 2>/dev/null` ] || rm /var/run/$NAME.pid
printf "done\n"
}
status() {
status_of_proc -p /var/run/$NAME.pid "" $NAME && exit 0 || exit $?
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
start
;;
status)
status
;;
*)
echo "Usage: $NAME {start|stop|restart|status}" >&2
exit 1
;;
esac
exit 0

BIN
blazegraph.tar.gz Normal file

Binary file not shown.

23
iipsrv.conf Normal file
View file

@ -0,0 +1,23 @@
<IfModule mod_fcgid.c>
ScriptAlias /fcgi-bin/ "/fcgi-bin/"
<Location "/fcgi-bin/">
Options None
Require all granted
<IfModule mod_mime.c>
AddHandler fcgid-script .fcgi
</IfModule>
</Location>
# Set our environment variables for the IIP server
FcgidInitialEnv VERBOSITY "1"
FcgidInitialEnv LOGFILE "/var/log/iipsrv.log"
FcgidInitialEnv MAX_IMAGE_CACHE_SIZE "10"
FcgidInitialEnv JPEG_QUALITY "90"
FcgidInitialEnv MAX_CVT "5000"
FcgidInitialEnv MEMCACHED_SERVERS "localhost"
# Define the idle timeout as unlimited and the number of
# processes we want
FcgidConnectTimeout 20
FcgidIdleTimeout 0
FcgidMaxProcessesPerClass 1
</IfModule>

BIN
sites.tar.gz Normal file

Binary file not shown.

22
start.sh Normal file
View file

@ -0,0 +1,22 @@
#!/bin/bash
# Start services
/etc/init.d/blazegraph start
/etc/init.d/solr start
/etc/init.d/mariadb start
# Import DB if necessary
if [[ -z "`mysql -qfsBe "SELECT SCHEMA_NAME FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME='wisski'" 2>&1`" ]]
then
mysql -e "CREATE USER 'wisski'@'%' IDENTIFIED BY 'wisski';"
mysql -e "CREATE DATABASE wisski;"
mysql -e "GRANT ALL PRIVILEGES ON wisski.* TO 'wisski'@'%';"
mysql -e "FLUSH PRIVILEGES;"
mysql wisski < /opt/wisski.sql
fi
# Clear cache
/opt/drupal/vendor/drush/drush/drush cr
# log apache
/usr/sbin/apache2ctl -D FOREGROUND

BIN
themes.tar.gz Normal file

Binary file not shown.

4834
wisski.sql Normal file

File diff suppressed because one or more lines are too long