adamzammit / limesurvey-docker

Production ready dockerised Limesurvey
GNU General Public License v3.0
85 stars 51 forks source link

LimeSurvey

IMPORTANT NOTE for installations from 4.0.0 to 5.0.8 (fixed if you use a NEW install from 5.0.8.1 onwards) - POTENTIAL DATA LOSS

If you are using a version of this container from 4.0.0 to 5.0.8 inclusive AND your users have encrypted any data within LimeSurvey - please ensure to make a backup of /var/www/html/application/config/security.php before updating your image.

An example of how to do this is below, assuming the container name is 'some-limesurvey':

$ docker cp some-limesurvey:/var/www/html/application/config/security.php /tmp/security.php

Then update to 5.0.8.1 or greater. You can then copy the security.php file back:

$ docker cp /tmp/security.php some-limesurvey:/var/www/html/application/config/security.php

5.0.8.1 or greater will persist the config directory.

END IMPORTANT NOTE

LimeSurvey - the most popular Free Open Source Software survey tool on the web.

https://www.limesurvey.org/en/

This docker image is for Limesurvey on apache/php in its own container. It accepts environment variables to update the configuration file. On first run it will automatically create the database if a username and password are supplied, and on subsequent runs it can update the administrator password if provided as an environment variable.

Volumes are specified for plugins and upload directories for persistence.

Tags

Tags corresponding to version on https://community.limesurvey.org/downloads/

How to use this image

$ docker run --name some-limesurvey --link some-mysql:mysql -d adamzammit/limesurvey

The following environment variables are also honored for configuring your Limesurvey instance. If Limesurvey is already installed, these environment variables will update the Limesurvey config file.

If the LIMESURVEY_DB_NAME specified does not already exist on the given MySQL server, it will be created automatically upon startup of the limesurvey container, provided that the LIMESURVEY_DB_USER specified has the necessary permissions to create it.

If you'd like to be able to access the instance from the host without the container's IP, standard port mappings can be used:

$ docker run --name some-limesurvey --link some-mysql:mysql -p 8080:80 -d adamzammit/limesurvey

Then, access it via http://localhost:8080 or http://host-ip:8080 in a browser.

If you'd like to use an external database instead of a linked mysql container, specify the hostname and port with LIMESURVEY_DB_HOST along with the password in LIMESURVEY_DB_PASSWORD and the username in LIMESURVEY_DB_USER (if it is something other than root):

$ docker run --name some-limesurvey -e LIMESURVEY_DB_HOST=10.1.2.3:3306 \
    -e LIMESURVEY_DB_USER=... -e LIMESURVEY_DB_PASSWORD=... -d adamzammit/limesurvey

Volumes and Persistence

Since 5.6.11 there are now 4 volumes defined in the Dockerfile:

  1. /var/www/html/plugins
    • Installed LimeSurvey plugins
  2. /var/www/html/upload
    • New or created themes, Survey resources, Data from uploaded responses
  3. /var/www/html/application/config
    • Configuration and security.php for encrypted responses
  4. /var/lime/sessions
    • Sessions if using file based sessions (default)

... via docker-compose

Example docker-compose.yml for limesurvey:

version: '2'

services:

  limesurvey:
    image: adamzammit/limesurvey
    ports:
      - 8082:80
    environment:
      LIMESURVEY_DB_PASSWORD: example
      LIMESURVEY_ADMIN_USER: admin
      LIMESURVEY_ADMIN_PASSWORD: password
      LIMESURVEY_ADMIN_NAME: Lime Administrator
      LIMESURVEY_ADMIN_EMAIL: lime@lime.lime
    volumes:
      - ./plugins:/var/www/html/plugins
      - ./upload:/var/www/html/upload
      - ./config:/var/www/html/application/config
      - ./sessions:/var/lime/sessions

  mysql:
    image: mariadb:10.5
    environment:
      MYSQL_ROOT_PASSWORD: example

Run docker-compose up, wait for it to initialize completely, and visit http://localhost:8082 or http://host-ip:8082.

Supported Docker versions

This image is officially supported on Docker version 1.12.3.

Support for older versions (down to 1.6) is provided on a best-effort basis.

Please see the Docker installation documentation for details on how to upgrade your Docker daemon.

Notes

This Dockerfile is based on the Dockerfile from the Wordpress official docker image