mirror of
https://github.com/mykitserver/docker-limesurvey.git
synced 2025-12-06 16:39:11 +01:00
Compare commits
66 Commits
3.14.0+180
...
3.20.0+191
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8f1903aa15 | ||
|
|
a829071849 | ||
|
|
a968c01029 | ||
|
|
325416c959 | ||
|
|
44fac58a28 | ||
|
|
1a63aa37a7 | ||
|
|
e4d7e3550f | ||
|
|
26623a1d2c | ||
|
|
5b37d301ad | ||
|
|
9e5b903b28 | ||
|
|
69194ef8a8 | ||
|
|
4a6fd295f3 | ||
|
|
e75090d0fd | ||
|
|
93514b0fb9 | ||
|
|
2d23179e3e | ||
|
|
051a22eb41 | ||
|
|
2fdc20f862 | ||
|
|
b35d566cda | ||
|
|
2ef998b0d7 | ||
|
|
02e2c9dc3a | ||
|
|
68881a29f1 | ||
|
|
10c98a5eb4 | ||
|
|
a665b512e4 | ||
|
|
0e5571811f | ||
|
|
26a95472a7 | ||
|
|
423f4c6133 | ||
|
|
80bc3f4319 | ||
|
|
c30e0878e2 | ||
|
|
b44b4c2371 | ||
|
|
c655c4cf53 | ||
|
|
6f088023ae | ||
|
|
6531d6131f | ||
|
|
92548e8d6f | ||
|
|
07a9d72c17 | ||
|
|
fcb52d4114 | ||
|
|
9dcf0c94ea | ||
|
|
97a2506d3d | ||
|
|
90c03f7b92 | ||
|
|
27a563868d | ||
|
|
1e66840c63 | ||
|
|
88db810ec2 | ||
|
|
63f4fb4bbb | ||
|
|
5fc47ca735 | ||
|
|
980e145ea4 | ||
|
|
e978fd0717 | ||
|
|
2fa1f94b20 | ||
|
|
cf09eeba7c | ||
|
|
75f9c151a7 | ||
|
|
a5f3d91340 | ||
|
|
55c23248bd | ||
|
|
91ab6439de | ||
|
|
b443ca12a7 | ||
|
|
a05a2528c6 | ||
|
|
610c377680 | ||
|
|
cc34159e53 | ||
|
|
cc6937054e | ||
|
|
8f9f1933eb | ||
|
|
c59df8396e | ||
|
|
54b9c6b533 | ||
|
|
92291c81ae | ||
|
|
af02bb1f8c | ||
|
|
cd8f4b825e | ||
|
|
2683fcee3c | ||
|
|
bef4ac9ae3 | ||
|
|
4279818967 | ||
|
|
481e72194a |
@@ -9,3 +9,5 @@ matrix:
|
||||
script: cd apache; docker build -q -t $TAG . && cd ..; ./tests/run.sh $TAG
|
||||
- env: TAG=martialblog/limesurvey-fpm
|
||||
script: cd fpm; docker build -q -t $TAG . && cd ..; ./tests/run.sh $TAG
|
||||
- env: TAG=martialblog/limesurvey-alpine
|
||||
script: cd fpm; docker build -q -t $TAG . && cd ..; ./tests/run.sh $TAG
|
||||
|
||||
21
README.md
21
README.md
@@ -29,7 +29,9 @@ LimeSurvey requires an external database (MySQL, PostgreSQL) to run. See *docker
|
||||
|
||||
To preserve the uploaded files assign the upload folder into a volume. See *docker-compose.yml* for example.
|
||||
|
||||
Path: */var/www/html/upload/*
|
||||
Path: */var/www/html/upload/surveys*
|
||||
|
||||
**Hint**: The mounted directory must be owned by the webserver user (e.g. www-data)
|
||||
|
||||
# LimeSurvey Configuration
|
||||
|
||||
@@ -45,9 +47,10 @@ To change to LimeSurvey configuration, you can mount a Volume into the Container
|
||||
|
||||
| Parameter | Description |
|
||||
| --------- | ----------- |
|
||||
| DB_TYPE | Database Type to use. mysql or postgresql |
|
||||
| DB_TYPE | Database Type to use. mysql or pgsql |
|
||||
| DB_HOST | Database server hostname |
|
||||
| DB_PORT | Database server port |
|
||||
| DB_SOCK | Database unix socket instead of host/port |
|
||||
| DB_NAME | Database name |
|
||||
| DB_TABLE_PREFIX | Database table prefix |
|
||||
| DB_USERNAME | Database user |
|
||||
@@ -61,6 +64,20 @@ To change to LimeSurvey configuration, you can mount a Volume into the Container
|
||||
|
||||
For further details on the settings see: https://manual.limesurvey.org/Optional_settings#Advanced_Path_Settings
|
||||
|
||||
# Running this image with docker-compose
|
||||
|
||||
The easiest way to get a fully featured and functional setup is using a docker-compose file. Several examples are provided in the repository.
|
||||
|
||||
```
|
||||
docker-compose up
|
||||
|
||||
# Frontend
|
||||
http://localhost:8080/
|
||||
|
||||
# Backend
|
||||
http://localhost:8080/index.php/admin
|
||||
```
|
||||
|
||||
# References
|
||||
|
||||
- https://www.limesurvey.org/
|
||||
|
||||
@@ -1,45 +1,72 @@
|
||||
FROM php:7.2-apache
|
||||
LABEL maintainer="markus@martialblog.de"
|
||||
ARG version='3.14.0+180730'
|
||||
ARG version='3.20.0+191112'
|
||||
ARG sha256_checksum='88befebbaf75ea24299885913cf680a421e55b7cf13242f1fb12d262ccc5ff4f'
|
||||
|
||||
# Install OS dependencies
|
||||
RUN apt-get update && \
|
||||
DEBIAN_FRONTEND=noninteractive \
|
||||
apt-get install --no-install-recommends -y \
|
||||
libldap2-dev \
|
||||
zlib1g-dev \
|
||||
libc-client-dev \
|
||||
libkrb5-dev \
|
||||
libpng-dev \
|
||||
libpq-dev \
|
||||
netcat \
|
||||
&& apt-get autoclean; apt-get autoremove && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
RUN set -ex; \
|
||||
apt-get update && \
|
||||
DEBIAN_FRONTEND=noninteractive \
|
||||
apt-get install --no-install-recommends -y \
|
||||
\
|
||||
libldap2-dev \
|
||||
libfreetype6-dev \
|
||||
libjpeg-dev \
|
||||
zlib1g-dev \
|
||||
libc-client-dev \
|
||||
libkrb5-dev \
|
||||
libpng-dev \
|
||||
libpq-dev \
|
||||
netcat \
|
||||
\
|
||||
&& apt-get -y autoclean; apt-get -y autoremove; \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Link LDAP library for PHP ldap extension
|
||||
RUN ln -fs /usr/lib/x86_64-linux-gnu/libldap.so /usr/lib/
|
||||
# Configure PHP imap plugin
|
||||
RUN docker-php-ext-configure imap --with-kerberos --with-imap-ssl
|
||||
RUN set -ex; \
|
||||
ln -fs /usr/lib/x86_64-linux-gnu/libldap.so /usr/lib/
|
||||
|
||||
# Install PHP Plugins
|
||||
RUN docker-php-ext-install -j5 \
|
||||
gd \
|
||||
imap \
|
||||
ldap \
|
||||
mbstring \
|
||||
pdo \
|
||||
pdo_mysql \
|
||||
pdo_pgsql \
|
||||
pgsql \
|
||||
zip
|
||||
# Install PHP Plugins and Configure PHP imap plugin
|
||||
RUN set -ex; \
|
||||
docker-php-ext-configure gd --with-freetype-dir=/usr --with-png-dir=/usr --with-jpeg-dir=/usr; \
|
||||
docker-php-ext-configure imap --with-kerberos --with-imap-ssl && \
|
||||
docker-php-ext-install -j5 \
|
||||
gd \
|
||||
imap \
|
||||
ldap \
|
||||
mbstring \
|
||||
pdo \
|
||||
pdo_mysql \
|
||||
pdo_pgsql \
|
||||
pgsql \
|
||||
zip
|
||||
|
||||
# Download, unzip and chmod of LimeSurvey
|
||||
ENV LIMESURVEY_VERSION=$version
|
||||
|
||||
# Apache configuration
|
||||
RUN a2enmod headers rewrite remoteip; \
|
||||
{\
|
||||
echo RemoteIPHeader X-Real-IP ;\
|
||||
echo RemoteIPTrustedProxy 10.0.0.0/8 ;\
|
||||
echo RemoteIPTrustedProxy 172.16.0.0/12 ;\
|
||||
echo RemoteIPTrustedProxy 192.168.0.0/16 ;\
|
||||
} > /etc/apache2/conf-available/remoteip.conf;\
|
||||
a2enconf remoteip
|
||||
|
||||
# Use the default production configuration
|
||||
RUN mv "$PHP_INI_DIR/php.ini-production" "$PHP_INI_DIR/php.ini"
|
||||
|
||||
# Download, unzip and chmod LimeSurvey from official GitHub repository
|
||||
ADD "https://github.com/LimeSurvey/LimeSurvey/archive/${version}.tar.gz" /tmp
|
||||
|
||||
RUN tar xzvf "/tmp/${version}.tar.gz" --strip-components=1 -C /var/www/html/ && \
|
||||
rm "/tmp/${version}.tar.gz" && \
|
||||
chown -R www-data:www-data /var/www/html
|
||||
RUN set -ex; \
|
||||
echo "${sha256_checksum} /tmp/${version}.tar.gz" | sha256sum -c - && \
|
||||
\
|
||||
tar xzvf "/tmp/${version}.tar.gz" --strip-components=1 -C /var/www/html/ && \
|
||||
rm -f "/tmp/${version}.tar.gz" && \
|
||||
chown -R www-data:www-data /var/www/html
|
||||
|
||||
COPY entrypoint.sh entrypoint.sh
|
||||
|
||||
ENTRYPOINT ["/var/www/html/entrypoint.sh"]
|
||||
CMD ["apache2-foreground"]
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
#!/bin/bash
|
||||
# Entrypoint for Docker Container
|
||||
|
||||
set -e
|
||||
|
||||
DB_TYPE=${DB_TYPE:-'mysql'}
|
||||
DB_HOST=${DB_HOST:-'mysql'}
|
||||
DB_PORT=${DB_PORT:-'3306'}
|
||||
DB_SOCK=${DB_SOCK:-}
|
||||
DB_NAME=${DB_NAME:-'limesurvey'}
|
||||
DB_TABLE_PREFIX=${DB_TABLE_PREFIX:-'lime_'}
|
||||
DB_USERNAME=${DB_USERNAME:-'limesurvey'}
|
||||
@@ -19,17 +20,15 @@ PUBLIC_URL=${PUBLIC_URL:-}
|
||||
URL_FORMAT=${URL_FORMAT:-'path'}
|
||||
|
||||
|
||||
# Check if DB_PASSWORD is set
|
||||
if [ -z "$DB_PASSWORD" ]; then
|
||||
echo >&2 'Error: Missing DB_PASSWORD'
|
||||
exit 1
|
||||
# Check if database is available
|
||||
if [ -z "$DB_SOCK" ]; then
|
||||
until nc -z -v -w30 $DB_HOST $DB_PORT
|
||||
do
|
||||
echo "Info: Waiting for database connection..."
|
||||
sleep 5
|
||||
done
|
||||
fi
|
||||
|
||||
# Check if DB_PASSWORD is set
|
||||
if [ -z "$ADMIN_PASSWORD" ]; then
|
||||
echo >&2 'Error: Missing ADMIN_PASSWORD'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check if already provisioned
|
||||
if [ -f application/config/config.php ]; then
|
||||
@@ -43,14 +42,21 @@ else
|
||||
cp application/config/config-sample-mysql.php application/config/config.php
|
||||
fi
|
||||
|
||||
if [ "$DB_TYPE" = 'postgresql' ]; then
|
||||
if [ "$DB_TYPE" = 'pgsql' ]; then
|
||||
echo 'Info: Using PostgreSQL configuration'
|
||||
DB_CHARSET=${DB_CHARSET:-'utf8'}
|
||||
cp application/config/config-sample-pgsql.php application/config/config.php
|
||||
fi
|
||||
|
||||
# Set Database config
|
||||
sed -i "s#\('connectionString' => \).*,\$#\\1'${DB_TYPE}:host=${DB_HOST};port=${DB_PORT};dbname=${DB_NAME};',#g" application/config/config.php
|
||||
if [ ! -z "$DB_SOCK" ]; then
|
||||
echo 'Info: Using unix socket'
|
||||
sed -i "s#\('connectionString' => \).*,\$#\\1'${DB_TYPE}:unix_socket=${DB_SOCK};dbname=${DB_NAME};',#g" application/config/config.php
|
||||
else
|
||||
echo 'Info: Using TCP connection'
|
||||
sed -i "s#\('connectionString' => \).*,\$#\\1'${DB_TYPE}:host=${DB_HOST};port=${DB_PORT};dbname=${DB_NAME};',#g" application/config/config.php
|
||||
fi
|
||||
|
||||
sed -i "s#\('username' => \).*,\$#\\1'${DB_USERNAME}',#g" application/config/config.php
|
||||
sed -i "s#\('password' => \).*,\$#\\1'${DB_PASSWORD}',#g" application/config/config.php
|
||||
sed -i "s#\('charset' => \).*,\$#\\1'${DB_CHARSET}',#g" application/config/config.php
|
||||
@@ -66,14 +72,30 @@ else
|
||||
fi
|
||||
fi
|
||||
|
||||
until nc -z -v -w30 $DB_HOST $DB_PORT
|
||||
do
|
||||
echo "Info: Waiting for database connection..."
|
||||
sleep 5
|
||||
done
|
||||
|
||||
echo 'Running console.php install'
|
||||
# Hint: The console.php script seems to always exit with 1, so that is why
|
||||
php application/commands/console.php install $ADMIN_USER $ADMIN_PASSWORD $ADMIN_NAME $ADMIN_EMAIL || true
|
||||
# Check if LimeSurvey database is provisioned
|
||||
echo 'Info: Check if database already provisioned. Nevermind the Stack trace.'
|
||||
php application/commands/console.php updatedb
|
||||
|
||||
|
||||
if [ $? -eq 0 ]; then
|
||||
echo 'Info: Database already provisioned'
|
||||
else
|
||||
# Check if DB_PASSWORD is set
|
||||
if [ -z "$DB_PASSWORD" ]; then
|
||||
echo >&2 'Error: Missing DB_PASSWORD'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check if DB_PASSWORD is set
|
||||
if [ -z "$ADMIN_PASSWORD" ]; then
|
||||
echo >&2 'Error: Missing ADMIN_PASSWORD'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo ''
|
||||
echo 'Running console.php install'
|
||||
php application/commands/console.php install $ADMIN_USER $ADMIN_PASSWORD $ADMIN_NAME $ADMIN_EMAIL
|
||||
fi
|
||||
|
||||
exec "$@"
|
||||
|
||||
35
docker-compose.fpm.alpine.yml
Normal file
35
docker-compose.fpm.alpine.yml
Normal file
@@ -0,0 +1,35 @@
|
||||
version: "3.0"
|
||||
services:
|
||||
limesurvey:
|
||||
build:
|
||||
context: fpm-alpine/
|
||||
dockerfile: Dockerfile
|
||||
volumes:
|
||||
- /tmp/upload/surveys:/var/www/html/upload/surveys
|
||||
- lime:/var/www/html
|
||||
links:
|
||||
- lime-db
|
||||
depends_on:
|
||||
- lime-db
|
||||
environment:
|
||||
- "DB_HOST=docker-limesurvey_lime-db_1"
|
||||
- "DB_PASSWORD=secret"
|
||||
- "ADMIN_PASSWORD=foobar"
|
||||
lime-web:
|
||||
image: nginx:alpine
|
||||
links:
|
||||
- limesurvey
|
||||
ports:
|
||||
- "8080:80"
|
||||
volumes:
|
||||
- ./examples/nginx.conf:/etc/nginx/nginx.conf:ro
|
||||
- lime:/var/www/html
|
||||
lime-db:
|
||||
image: mysql:5.7
|
||||
environment:
|
||||
- "MYSQL_USER=limesurvey"
|
||||
- "MYSQL_DATABASE=limesurvey"
|
||||
- "MYSQL_PASSWORD=secret"
|
||||
- "MYSQL_ROOT_PASSWORD=secret"
|
||||
volumes:
|
||||
lime:
|
||||
@@ -2,10 +2,10 @@ version: "3.0"
|
||||
services:
|
||||
limesurvey:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: fpm/Dockerfile
|
||||
context: fpm/
|
||||
dockerfile: Dockerfile
|
||||
volumes:
|
||||
- /tmp/upload/:/var/www/html/upload/
|
||||
- /tmp/upload/surveys:/var/www/html/upload/surveys
|
||||
- lime:/var/www/html
|
||||
links:
|
||||
- lime-db
|
||||
|
||||
26
docker-compose.pgsql.yml
Normal file
26
docker-compose.pgsql.yml
Normal file
@@ -0,0 +1,26 @@
|
||||
version: "3.0"
|
||||
services:
|
||||
limesurvey:
|
||||
build:
|
||||
context: apache/
|
||||
dockerfile: Dockerfile
|
||||
volumes:
|
||||
- /tmp/upload/surveys:/var/www/html/upload/surveys
|
||||
links:
|
||||
- lime-db
|
||||
depends_on:
|
||||
- lime-db
|
||||
ports:
|
||||
- "8080:80"
|
||||
environment:
|
||||
- "DB_TYPE=pgsql"
|
||||
- "DB_PORT=5432"
|
||||
- "DB_HOST=docker-limesurvey_lime-db_1"
|
||||
- "DB_PASSWORD=secret"
|
||||
- "ADMIN_PASSWORD=foobar"
|
||||
lime-db:
|
||||
image: postgres:10
|
||||
environment:
|
||||
- "POSTGRES_USER=limesurvey"
|
||||
- "POSTGRES_DB=limesurvey"
|
||||
- "POSTGRES_PASSWORD=secret"
|
||||
@@ -2,10 +2,10 @@ version: "3.0"
|
||||
services:
|
||||
limesurvey:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: apache/Dockerfile
|
||||
context: apache/
|
||||
dockerfile: Dockerfile
|
||||
volumes:
|
||||
- /tmp/upload/:/var/www/html/upload/
|
||||
- /tmp/upload/surveys:/var/www/html/upload/surveys
|
||||
links:
|
||||
- lime-db
|
||||
depends_on:
|
||||
|
||||
51
fpm-alpine/Dockerfile
Normal file
51
fpm-alpine/Dockerfile
Normal file
@@ -0,0 +1,51 @@
|
||||
FROM php:7.2-fpm-alpine
|
||||
LABEL maintainer="markus@martialblog.de"
|
||||
ARG version='3.20.0+191112'
|
||||
ARG sha256_checksum='88befebbaf75ea24299885913cf680a421e55b7cf13242f1fb12d262ccc5ff4f'
|
||||
|
||||
# Install OS dependencies
|
||||
RUN set -ex; \
|
||||
apk add --no-cache --virtual .build-deps \
|
||||
freetype-dev \
|
||||
libpng-dev \
|
||||
libjpeg-turbo-dev \
|
||||
openldap-dev \
|
||||
imap-dev \
|
||||
postgresql-dev && \
|
||||
apk add --no-cache netcat-openbsd bash
|
||||
|
||||
# Install PHP Plugins
|
||||
RUN set -ex; \
|
||||
docker-php-ext-configure gd --with-freetype-dir=/usr --with-png-dir=/usr --with-jpeg-dir=/usr ; \
|
||||
docker-php-ext-configure imap --with-imap-ssl && \
|
||||
docker-php-ext-install \
|
||||
gd \
|
||||
imap \
|
||||
ldap \
|
||||
mbstring \
|
||||
pdo \
|
||||
pdo_mysql \
|
||||
pdo_pgsql \
|
||||
pgsql \
|
||||
zip
|
||||
|
||||
# Download, unzip and chmod of LimeSurvey
|
||||
ADD "https://github.com/LimeSurvey/LimeSurvey/archive/${version}.tar.gz" /tmp
|
||||
|
||||
RUN set -ex; \
|
||||
echo "${sha256_checksum} /tmp/${version}.tar.gz" | sha256sum -c - && \
|
||||
\
|
||||
tar xzvf "/tmp/${version}.tar.gz" --strip-components=1 -C /var/www/html/ && \
|
||||
\
|
||||
rm -rf "/tmp/${version}.tar.gz" \
|
||||
/var/www/html/docs \
|
||||
/var/www/html/tests \
|
||||
/var/www/html/*.md && \
|
||||
chown -R www-data:root /var/www/ ; \
|
||||
chmod -R g=u /var/www
|
||||
|
||||
EXPOSE 9000
|
||||
|
||||
COPY entrypoint.sh entrypoint.sh
|
||||
ENTRYPOINT ["/var/www/html/entrypoint.sh"]
|
||||
CMD ["php-fpm"]
|
||||
101
fpm-alpine/entrypoint.sh
Executable file
101
fpm-alpine/entrypoint.sh
Executable file
@@ -0,0 +1,101 @@
|
||||
#!/bin/bash
|
||||
# Entrypoint for Docker Container
|
||||
|
||||
|
||||
DB_TYPE=${DB_TYPE:-'mysql'}
|
||||
DB_HOST=${DB_HOST:-'mysql'}
|
||||
DB_PORT=${DB_PORT:-'3306'}
|
||||
DB_SOCK=${DB_SOCK:-}
|
||||
DB_NAME=${DB_NAME:-'limesurvey'}
|
||||
DB_TABLE_PREFIX=${DB_TABLE_PREFIX:-'lime_'}
|
||||
DB_USERNAME=${DB_USERNAME:-'limesurvey'}
|
||||
DB_PASSWORD=${DB_PASSWORD:-}
|
||||
|
||||
ADMIN_USER=${ADMIN_USER:-'admin'}
|
||||
ADMIN_NAME=${ADMIN_NAME:-'admin'}
|
||||
ADMIN_EMAIL=${ADMIN_EMAIL:-'foobar@example.com'}
|
||||
ADMIN_PASSWORD=${ADMIN_PASSWORD:-'-'}
|
||||
|
||||
PUBLIC_URL=${PUBLIC_URL:-}
|
||||
URL_FORMAT=${URL_FORMAT:-'path'}
|
||||
|
||||
|
||||
# Check if database is available
|
||||
if [ -z "$DB_SOCK" ]; then
|
||||
until nc -z -v -w30 $DB_HOST $DB_PORT
|
||||
do
|
||||
echo "Info: Waiting for database connection..."
|
||||
sleep 5
|
||||
done
|
||||
fi
|
||||
|
||||
|
||||
# Check if already provisioned
|
||||
if [ -f application/config/config.php ]; then
|
||||
echo 'Info: config.php already provisioned'
|
||||
else
|
||||
echo 'Info: Generating config.php'
|
||||
|
||||
if [ "$DB_TYPE" = 'mysql' ]; then
|
||||
echo 'Info: Using MySQL configuration'
|
||||
DB_CHARSET=${DB_CHARSET:-'utf8mb4'}
|
||||
cp application/config/config-sample-mysql.php application/config/config.php
|
||||
fi
|
||||
|
||||
if [ "$DB_TYPE" = 'pgsql' ]; then
|
||||
echo 'Info: Using PostgreSQL configuration'
|
||||
DB_CHARSET=${DB_CHARSET:-'utf8'}
|
||||
cp application/config/config-sample-pgsql.php application/config/config.php
|
||||
fi
|
||||
|
||||
# Set Database config
|
||||
if [ ! -z "$DB_SOCK" ]; then
|
||||
echo 'Info: Using unix socket'
|
||||
sed -i "s#\('connectionString' => \).*,\$#\\1'${DB_TYPE}:unix_socket=${DB_SOCK};dbname=${DB_NAME};',#g" application/config/config.php
|
||||
else
|
||||
echo 'Info: Using TCP connection'
|
||||
sed -i "s#\('connectionString' => \).*,\$#\\1'${DB_TYPE}:host=${DB_HOST};port=${DB_PORT};dbname=${DB_NAME};',#g" application/config/config.php
|
||||
fi
|
||||
|
||||
sed -i "s#\('username' => \).*,\$#\\1'${DB_USERNAME}',#g" application/config/config.php
|
||||
sed -i "s#\('password' => \).*,\$#\\1'${DB_PASSWORD}',#g" application/config/config.php
|
||||
sed -i "s#\('charset' => \).*,\$#\\1'${DB_CHARSET}',#g" application/config/config.php
|
||||
sed -i "s#\('tablePrefix' => \).*,\$#\\1'${DB_TABLE_PREFIX}',#g" application/config/config.php
|
||||
|
||||
# Set URL config
|
||||
sed -i "s#\('urlFormat' => \).*,\$#\\1'${URL_FORMAT}',#g" application/config/config.php
|
||||
|
||||
# Set Public URL
|
||||
if [ -z "$PUBLIC_URL" ]; then
|
||||
echo 'Info: Setting PublicURL'
|
||||
sed -i "s#\('debug'=>0,\)\$#'publicurl'=>'${PUBLIC_URL}',\n\t\t\\1 #g" application/config/config.php
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
# Check if LimeSurvey database is provisioned
|
||||
echo 'Info: Check if database already provisioned. Nevermind the Stack trace.'
|
||||
php application/commands/console.php updatedb
|
||||
|
||||
|
||||
if [ $? -eq 0 ]; then
|
||||
echo 'Info: Database already provisioned'
|
||||
else
|
||||
# Check if DB_PASSWORD is set
|
||||
if [ -z "$DB_PASSWORD" ]; then
|
||||
echo >&2 'Error: Missing DB_PASSWORD'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check if DB_PASSWORD is set
|
||||
if [ -z "$ADMIN_PASSWORD" ]; then
|
||||
echo >&2 'Error: Missing ADMIN_PASSWORD'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo ''
|
||||
echo 'Running console.php install'
|
||||
php application/commands/console.php install $ADMIN_USER $ADMIN_PASSWORD $ADMIN_NAME $ADMIN_EMAIL
|
||||
fi
|
||||
|
||||
exec "$@"
|
||||
@@ -1,44 +1,57 @@
|
||||
FROM php:7.2-fpm
|
||||
LABEL maintainer="markus@martialblog.de"
|
||||
ARG version='3.14.0+180730'
|
||||
ARG version='3.20.0+191112'
|
||||
ARG sha256_checksum='88befebbaf75ea24299885913cf680a421e55b7cf13242f1fb12d262ccc5ff4f'
|
||||
|
||||
# Install OS dependencies
|
||||
RUN apt-get update && \
|
||||
DEBIAN_FRONTEND=noninteractive \
|
||||
apt-get install --no-install-recommends -y \
|
||||
libldap2-dev \
|
||||
zlib1g-dev \
|
||||
libc-client-dev \
|
||||
libkrb5-dev \
|
||||
libpng-dev \
|
||||
libpq-dev \
|
||||
netcat \
|
||||
&& apt-get autoclean; apt-get autoremove && \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
RUN set -ex; \
|
||||
apt-get update && \
|
||||
DEBIAN_FRONTEND=noninteractive \
|
||||
apt-get install --no-install-recommends -y \
|
||||
\
|
||||
libldap2-dev \
|
||||
libfreetype6-dev \
|
||||
libjpeg-dev \
|
||||
zlib1g-dev \
|
||||
libc-client-dev \
|
||||
libkrb5-dev \
|
||||
libpng-dev \
|
||||
libpq-dev \
|
||||
netcat \
|
||||
\
|
||||
&& apt-get -y autoclean; apt-get -y autoremove; \
|
||||
rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Link LDAP library for PHP ldap extension
|
||||
RUN ln -fs /usr/lib/x86_64-linux-gnu/libldap.so /usr/lib/
|
||||
RUN set -ex; \
|
||||
ln -fs /usr/lib/x86_64-linux-gnu/libldap.so /usr/lib/
|
||||
|
||||
RUN docker-php-ext-configure imap --with-kerberos --with-imap-ssl
|
||||
# Install PHP Plugins and Configure PHP imap plugin
|
||||
RUN set -ex; \
|
||||
docker-php-ext-configure gd --with-freetype-dir=/usr --with-png-dir=/usr --with-jpeg-dir=/usr; \
|
||||
docker-php-ext-configure imap --with-kerberos --with-imap-ssl && \
|
||||
docker-php-ext-install -j5 \
|
||||
gd \
|
||||
imap \
|
||||
ldap \
|
||||
mbstring \
|
||||
pdo \
|
||||
pdo_mysql \
|
||||
pdo_pgsql \
|
||||
pgsql \
|
||||
zip
|
||||
|
||||
# Install PHP Plugins
|
||||
RUN docker-php-ext-install -j5 \
|
||||
gd \
|
||||
imap \
|
||||
ldap \
|
||||
mbstring \
|
||||
pdo \
|
||||
pdo_mysql \
|
||||
pdo_pgsql \
|
||||
pgsql \
|
||||
zip
|
||||
ENV LIMESURVEY_VERSION=$version
|
||||
|
||||
# Download, unzip and chmod of LimeSurvey
|
||||
# Download, unzip and chmod LimeSurvey from official GitHub repository
|
||||
ADD "https://github.com/LimeSurvey/LimeSurvey/archive/${version}.tar.gz" /tmp
|
||||
|
||||
RUN tar xzvf "/tmp/${version}.tar.gz" --strip-components=1 -C /var/www/html/ && \
|
||||
rm "/tmp/${version}.tar.gz" && \
|
||||
chown -R www-data:www-data /var/www/html
|
||||
RUN set -ex; \
|
||||
echo "${sha256_checksum} /tmp/${version}.tar.gz" | sha256sum -c - && \
|
||||
\
|
||||
tar xzvf "/tmp/${version}.tar.gz" --strip-components=1 -C /var/www/html/ && \
|
||||
rm -f "/tmp/${version}.tar.gz" && \
|
||||
chown -R www-data:www-data /var/www/html
|
||||
|
||||
EXPOSE 9000
|
||||
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
#!/bin/bash
|
||||
# Entrypoint for Docker Container
|
||||
|
||||
set -e
|
||||
|
||||
DB_TYPE=${DB_TYPE:-'mysql'}
|
||||
DB_HOST=${DB_HOST:-'mysql'}
|
||||
DB_PORT=${DB_PORT:-'3306'}
|
||||
DB_SOCK=${DB_SOCK:-}
|
||||
DB_NAME=${DB_NAME:-'limesurvey'}
|
||||
DB_TABLE_PREFIX=${DB_TABLE_PREFIX:-'lime_'}
|
||||
DB_USERNAME=${DB_USERNAME:-'limesurvey'}
|
||||
@@ -19,17 +20,15 @@ PUBLIC_URL=${PUBLIC_URL:-}
|
||||
URL_FORMAT=${URL_FORMAT:-'path'}
|
||||
|
||||
|
||||
# Check if DB_PASSWORD is set
|
||||
if [ -z "$DB_PASSWORD" ]; then
|
||||
echo >&2 'Error: Missing DB_PASSWORD'
|
||||
exit 1
|
||||
# Check if database is available
|
||||
if [ -z "$DB_SOCK" ]; then
|
||||
until nc -z -v -w30 $DB_HOST $DB_PORT
|
||||
do
|
||||
echo "Info: Waiting for database connection..."
|
||||
sleep 5
|
||||
done
|
||||
fi
|
||||
|
||||
# Check if DB_PASSWORD is set
|
||||
if [ -z "$ADMIN_PASSWORD" ]; then
|
||||
echo >&2 'Error: Missing ADMIN_PASSWORD'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check if already provisioned
|
||||
if [ -f application/config/config.php ]; then
|
||||
@@ -43,14 +42,21 @@ else
|
||||
cp application/config/config-sample-mysql.php application/config/config.php
|
||||
fi
|
||||
|
||||
if [ "$DB_TYPE" = 'postgresql' ]; then
|
||||
if [ "$DB_TYPE" = 'pgsql' ]; then
|
||||
echo 'Info: Using PostgreSQL configuration'
|
||||
DB_CHARSET=${DB_CHARSET:-'utf8'}
|
||||
cp application/config/config-sample-pgsql.php application/config/config.php
|
||||
fi
|
||||
|
||||
# Set Database config
|
||||
sed -i "s#\('connectionString' => \).*,\$#\\1'${DB_TYPE}:host=${DB_HOST};port=${DB_PORT};dbname=${DB_NAME};',#g" application/config/config.php
|
||||
if [ ! -z "$DB_SOCK" ]; then
|
||||
echo 'Info: Using unix socket'
|
||||
sed -i "s#\('connectionString' => \).*,\$#\\1'${DB_TYPE}:unix_socket=${DB_SOCK};dbname=${DB_NAME};',#g" application/config/config.php
|
||||
else
|
||||
echo 'Info: Using TCP connection'
|
||||
sed -i "s#\('connectionString' => \).*,\$#\\1'${DB_TYPE}:host=${DB_HOST};port=${DB_PORT};dbname=${DB_NAME};',#g" application/config/config.php
|
||||
fi
|
||||
|
||||
sed -i "s#\('username' => \).*,\$#\\1'${DB_USERNAME}',#g" application/config/config.php
|
||||
sed -i "s#\('password' => \).*,\$#\\1'${DB_PASSWORD}',#g" application/config/config.php
|
||||
sed -i "s#\('charset' => \).*,\$#\\1'${DB_CHARSET}',#g" application/config/config.php
|
||||
@@ -66,14 +72,30 @@ else
|
||||
fi
|
||||
fi
|
||||
|
||||
until nc -z -v -w30 $DB_HOST $DB_PORT
|
||||
do
|
||||
echo "Info: Waiting for database connection..."
|
||||
sleep 5
|
||||
done
|
||||
|
||||
echo 'Running console.php install'
|
||||
# Hint: The console.php script seems to always exit with 1, so that is why
|
||||
php application/commands/console.php install $ADMIN_USER $ADMIN_PASSWORD $ADMIN_NAME $ADMIN_EMAIL || true
|
||||
# Check if LimeSurvey database is provisioned
|
||||
echo 'Info: Check if database already provisioned. Nevermind the Stack trace.'
|
||||
php application/commands/console.php updatedb
|
||||
|
||||
|
||||
if [ $? -eq 0 ]; then
|
||||
echo 'Info: Database already provisioned'
|
||||
else
|
||||
# Check if DB_PASSWORD is set
|
||||
if [ -z "$DB_PASSWORD" ]; then
|
||||
echo >&2 'Error: Missing DB_PASSWORD'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check if DB_PASSWORD is set
|
||||
if [ -z "$ADMIN_PASSWORD" ]; then
|
||||
echo >&2 'Error: Missing ADMIN_PASSWORD'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo ''
|
||||
echo 'Running console.php install'
|
||||
php application/commands/console.php install $ADMIN_USER $ADMIN_PASSWORD $ADMIN_NAME $ADMIN_EMAIL
|
||||
fi
|
||||
|
||||
exec "$@"
|
||||
|
||||
8
makefile
Normal file
8
makefile
Normal file
@@ -0,0 +1,8 @@
|
||||
.PHONY: apache fpm fpm-alpine
|
||||
|
||||
apache:
|
||||
docker build --pull -t limesurvey:apache apache
|
||||
fpm-alpine:
|
||||
docker build --pull -t limesurvey:fpm-alpine fpm-alpine
|
||||
fpm:
|
||||
docker build --pull -t limesurvey:fpm fpm
|
||||
@@ -1 +0,0 @@
|
||||
feedparser==5.2.1
|
||||
61
upgrade.py
61
upgrade.py
@@ -1,61 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
|
||||
|
||||
import argparse
|
||||
import feedparser
|
||||
import sys
|
||||
import subprocess
|
||||
|
||||
dockerfile_apache = 'apache/Dockerfile'
|
||||
dockerfile_fpm = 'fpm/Dockerfile'
|
||||
|
||||
limesv_feed_url = 'https://github.com/LimeSurvey/LimeSurvey/releases.atom'
|
||||
docker_feed_url = 'https://github.com/martialblog/docker-limesurvey/releases.atom'
|
||||
|
||||
limesv_feed = feedparser.parse(limesv_feed_url)
|
||||
docker_feed = feedparser.parse(docker_feed_url)
|
||||
|
||||
limesv_current_release = limesv_feed.entries[0].title_detail.value
|
||||
docker_current_release = docker_feed.entries[0].title_detail.value
|
||||
|
||||
argumentparser = argparse.ArgumentParser(description='Updates the LimeSurvey Version in the Dockerfiles')
|
||||
argumentparser.add_argument('--noop', dest='noop', action="store_true", required=False, help="Don't push just commit")
|
||||
argumentparser.add_argument('--check', dest='check', action="store_true", required=False, help="Only check if there's a new version available")
|
||||
|
||||
cmdargs = argumentparser.parse_args()
|
||||
|
||||
if limesv_current_release == docker_current_release:
|
||||
print('Nothing to do.')
|
||||
sys.exit(0)
|
||||
|
||||
print('New Version {} available.'.format(limesv_current_release))
|
||||
|
||||
if cmdargs.check:
|
||||
sys.exit(0)
|
||||
|
||||
commit_message = 'Updating to Version {}'.format(limesv_current_release)
|
||||
|
||||
# Dockerfiles
|
||||
regexp = 's/[0-9]+\.[0-9]+\.[0-9]+[0-9]*/{new_version}/'.format(new_version=limesv_current_release)
|
||||
subprocess.call(['sed', '-i', '-e', regexp, dockerfile_apache])
|
||||
subprocess.call(['sed', '-i', '-e', regexp, dockerfile_fpm])
|
||||
print('> Updated Dockerfiles')
|
||||
|
||||
# Git Commit/Tag
|
||||
# subprocess.call(['git', 'checkout', '-b', limesv_current_release])
|
||||
subprocess.call(['git', 'add', dockerfile_apache])
|
||||
subprocess.call(['git', 'add', dockerfile_fpm])
|
||||
subprocess.call(['git', 'commit', '-m', commit_message])
|
||||
subprocess.call(['git', 'tag', limesv_current_release])
|
||||
print('> Created new Commit and Tag')
|
||||
|
||||
if cmdargs.noop:
|
||||
sys.exit(0)
|
||||
|
||||
# Git Push
|
||||
# subprocess.call(['git', 'push', 'origin', limesv_current_release])
|
||||
subprocess.call(['git', 'push'])
|
||||
subprocess.call(['git', 'push', 'origin', '--tags'])
|
||||
print('> Pushed to new Branch')
|
||||
|
||||
sys.exit(0)
|
||||
32
upgrade.sh
Executable file
32
upgrade.sh
Executable file
@@ -0,0 +1,32 @@
|
||||
#!/usr/bin/env bash
|
||||
# Upgrade script
|
||||
|
||||
set -x
|
||||
|
||||
if [ $# -eq 0 ]
|
||||
then
|
||||
echo 'Pass new LimeSurvey Version tag:'
|
||||
echo 'upgrade.sh 3.15.8+190130'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
NEW_VERSION=$1
|
||||
|
||||
grep -qc $NEW_VERSION apache/Dockerfile fpm/Dockerfile fpm-alpine/Dockerfile
|
||||
|
||||
if [ $? -eq 0 ]
|
||||
then
|
||||
echo "Already at version ${NEW_VERSION}"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Download, unzip and chmod LimeSurvey from official GitHub repository
|
||||
wget -P /tmp "https://github.com/LimeSurvey/LimeSurvey/archive/${NEW_VERSION}.tar.gz"
|
||||
|
||||
SHA256_CHECKSUM=$(sha256sum "/tmp/${NEW_VERSION}.tar.gz" | awk '{ print $1 }')
|
||||
|
||||
# Update lines in the files
|
||||
sed -r -i -e "s/[0-9]+(\.[0-9]+)+\+[0-9]+/$NEW_VERSION/" apache/Dockerfile fpm/Dockerfile fpm-alpine/Dockerfile
|
||||
sed -r -i -e "s/[A-Fa-f0-9]{64}/$SHA256_CHECKSUM/" apache/Dockerfile fpm/Dockerfile fpm-alpine/Dockerfile
|
||||
|
||||
# After that, check and commit
|
||||
Reference in New Issue
Block a user