Deploying a LimeSurvey App
Introduction
LimeSurvey is an open-source survey platform built with PHP. Deploying LimeSurvey with a Dockerfile on Klutch.sh gives you reproducible builds, managed secrets, and persistent storage for responses and uploads—all managed from klutch.sh/app. This guide covers installation, repository prep, a production-ready Dockerfile, deployment steps, Nixpacks overrides, sample configuration, and production tips.
Prerequisites
- A Klutch.sh account (create one)
- A GitHub repository containing your LimeSurvey code/config (GitHub is the only supported git source)
- Docker familiarity and PHP 8.1+ knowledge
- Database credentials (MySQL/MariaDB)
- Storage for uploads, responses, and logs
For onboarding, see the Quick Start.
Architecture and ports
- LimeSurvey serves HTTP; set the internal container port to
8080. - MySQL/MariaDB should run as a separate Klutch.sh TCP app, exposed on port
8000, connecting internally on3306. - Persistent storage is required for uploads and recommended for logs/cache.
Repository layout
limesurvey/├── application/ # LimeSurvey app code├── upload/ # User uploads and survey files (mount as volume)├── Dockerfile # Must be at repo root for auto-detection├── composer.json├── composer.lock└── .env.example # Template only; no secretsKeep secrets out of Git; store them in Klutch.sh environment variables.
Installation (local) and starter commands
Install dependencies and run locally before pushing to GitHub:
composer install --no-dev --optimize-autoloaderphp -S 0.0.0.0:8080 -t .Optional helper start.sh for portability and Nixpacks fallback:
#!/usr/bin/env bashset -euo pipefailphp -S 0.0.0.0:8080 -t .Make it executable with chmod +x start.sh.
Dockerfile for LimeSurvey (production-ready)
Place this Dockerfile at the repo root; Klutch.sh auto-detects it (no Docker selection in the UI):
FROM php:8.2-apache
RUN apt-get update && apt-get install -y \ libpng-dev libjpeg-dev libfreetype6-dev libzip-dev libicu-dev libxml2-dev libonig-dev git unzip \ && docker-php-ext-configure gd --with-freetype --with-jpeg \ && docker-php-ext-install pdo_mysql gd intl zip opcache \ && a2enmod rewrite \ && rm -rf /var/lib/apt/lists/*
WORKDIR /var/www/html
COPY . /var/www/html
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer && \ composer install --no-dev --optimize-autoloader && \ chown -R www-data:www-data /var/www/html
ENV PORT=8080
EXPOSE 8080CMD ["apache2-foreground"]Notes:
- Includes common PHP extensions required by LimeSurvey.
- Keep
upload/writable and on a volume.
Environment variables (Klutch.sh)
Set these in the Klutch.sh app settings (Secrets tab) before deploying:
PORT=8080DB_TYPE=mysqlDB_HOST=<db-host>DB_PORT=3306DB_NAME=<db-name>DB_USER=<db-user>DB_PASSWORD=<db-password>APP_URL=https://example-app.klutch.shAPP_ENV=production
If you deploy without the Dockerfile and need Nixpacks overrides:
NIXPACKS_BUILD_CMD=composer install --no-dev --optimize-autoloaderNIXPACKS_START_CMD=php -S 0.0.0.0:8080 -t .NIXPACKS_INSTALL_PKGS="php82 php82Extensions.pdo_mysql php82Extensions.intl php82Extensions.gd php82Extensions.zip"
These keep LimeSurvey compatible with Nixpacks defaults when a Dockerfile is absent.
Attach persistent volumes
In Klutch.sh storage settings, add mount paths and sizes (no names required):
/var/www/html/upload— required for survey uploads and exports./var/www/html/application/logs— optional if you persist logs locally.
Ensure these paths are writable inside the container.
Deploy LimeSurvey on Klutch.sh (Dockerfile workflow)
- Push your repository (with the Dockerfile at the root) to GitHub.
- Open klutch.sh/app, create a project, and add an app.
- Connect the GitHub repository; Klutch.sh automatically detects the Dockerfile.
- Choose HTTP traffic for LimeSurvey.
- Set the internal port to
8080. - Add the environment variables above (database settings, app URL, and any
NIXPACKS_*overrides if you temporarily deploy without the Dockerfile). - Attach persistent volumes for
/var/www/html/upload(and/var/www/html/application/logsif used), selecting sizes that fit your storage needs. - Deploy. Your LimeSurvey instance will be reachable at
https://example-app.klutch.sh; attach a custom domain if desired.
For MySQL/MariaDB on Klutch.sh, create a separate TCP app, expose it on port 8000, and point DB_HOST to that endpoint (internal port 3306).
Sample configuration snippet
Set environment-driven config in application/config/config.php (use env vars, not hardcoded secrets):
$config['debug'] = 0;$config['sitename'] = 'LimeSurvey on Klutch.sh';Health checks and production tips
- Use a reverse proxy probe on
/adminor a lightweight route to verify availability. - Enforce HTTPS at the edge; forward HTTP to port 8080 internally.
- Keep dependencies and image tags pinned; upgrade intentionally.
- Monitor disk usage on
upload/and resize before it fills. - Back up your database and uploads regularly; do not rely on container filesystems for durability.
LimeSurvey on Klutch.sh combines reproducible Docker builds with managed secrets, persistent storage for survey uploads, and flexible HTTP/TCP routing. With the Dockerfile at the repo root and port 8080 configured, you can deliver reliable survey experiences without extra YAML or workflow overhead.