Deploying a Leantime App
Introduction
Leantime is an open-source project management and collaboration platform built with PHP. Deploying Leantime with a Dockerfile on Klutch.sh gives you reproducible builds, managed secrets, and persistent storage for uploads and logs—all managed from klutch.sh/app. This guide covers installation, repository prep, a production-ready Dockerfile, deployment steps, Nixpacks overrides, sample config, and production tips.
Prerequisites
- A Klutch.sh account (create one)
- A GitHub repository containing your Leantime code/config (GitHub is the only supported git source)
- Docker familiarity and PHP 8.1+ knowledge
- Database credentials (MySQL/MariaDB) and optional Redis for caching
- Storage for uploads and logs
For onboarding, see the Quick Start.
Architecture and ports
- Leantime serves HTTP; set the internal container port to
8080. - For MySQL/MariaDB, create a separate Klutch.sh TCP app exposed on port
8000and connect internally on3306. - Persistent storage is required for uploads and recommended for logs/cache.
Repository layout
leantime/├── public/ # Web root├── storage/ # Uploads, cache, logs (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 publicOptional helper start.sh for portability and Nixpacks fallback:
#!/usr/bin/env bashset -euo pipefailphp -S 0.0.0.0:8080 -t publicMake it executable with chmod +x start.sh.
Dockerfile for Leantime (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 libonig-dev libxml2-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 extensions for Leantime; adjust if you use additional plugins.
- Keep
storage/writable and mounted as a volume.
Environment variables (Klutch.sh)
Set these in the Klutch.sh app settings (Secrets tab) before deploying:
PORT=8080APP_URL=https://example-app.klutch.shDB_CONNECTION=mysqlDB_HOST=<db-host>DB_PORT=3306DB_DATABASE=<db-name>DB_USERNAME=<db-user>DB_PASSWORD=<db-password>APP_KEY=<secure-app-key>CACHE_DRIVER=file(or redis if configured)SESSION_DRIVER=file(or redis if configured)
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 publicNIXPACKS_INSTALL_PKGS="php82 php82Extensions.pdo_mysql php82Extensions.intl php82Extensions.gd php82Extensions.zip"
These keep Leantime 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/storage— uploads, cache, and logs./var/www/html/bootstrap/cache— optional if you want to persist application cache.
Ensure these paths are writable inside the container.
Deploy Leantime 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 Leantime.
- Set the internal port to
8080. - Add the environment variables above (database settings, app key, cache/session drivers, and any
NIXPACKS_*overrides if you temporarily deploy without the Dockerfile). - Attach persistent volumes for
/var/www/html/storage(and/var/www/html/bootstrap/cacheif used), selecting sizes that match your storage needs. - Deploy. Your Leantime 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
Add to .env (stored in Klutch.sh as secrets):
APP_ENV=productionAPP_DEBUG=falseAPP_URL=https://example-app.klutch.shHealth checks and production tips
- Use a reverse proxy probe on
/or 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
storage/and resize before it fills. - Back up your database and uploads regularly; do not rely on container filesystems for durability.
Leantime on Klutch.sh combines reproducible Docker builds with managed secrets, persistent storage for uploads, and flexible HTTP/TCP routing. With the Dockerfile at the repo root and port 8080 configured, you can deliver a reliable project management experience without extra YAML or workflow overhead.