On this page
- What will you set up?
- How do you prepare the environment file?
- How do you keep the app off the public interface?
- How do you start Leantime and run the installer?
- How do you add Nginx and a certificate?
- How do you configure Leantime email?
- How do you back up and upgrade Leantime?
- How do you troubleshoot a failing install?
- Questions
What will you set up?
Leantime is a project management tool that combines tasks (kanban, table and timeline views), milestones, goals, idea boards, retrospectives and timesheets. The Docker setup runs two containers: the Leantime app (PHP with its own web server) and MySQL.
On the server you need Docker Engine and Compose (Docker Engine, or the Docker app image), Git, and a name such as pm.example.net resolving to 198.51.100.24 and 2001:db8:4f2a::24.
sudo apt install -y git
docker compose version
git --versionHow do you prepare the environment file?
The docker-leantime repository holds the compose file and a sample environment; clone it and fill in the values marked for change.
git clone https://github.com/Leantime/docker-leantime.git ~/leantime
cd ~/leantime
cp sample.env .env
openssl rand -hex 24 # use for the database passwords
openssl rand -hex 32 # use for the session key
nano .envSet at least these keys:
LEAN_APP_URL=https://pm.example.net
LEAN_DB_PASSWORD=first-random-value
MYSQL_PASSWORD=first-random-value
MYSQL_ROOT_PASSWORD=second-random-value
LEAN_SESSION_PASSWORD=third-random-value
LEAN_DEFAULT_TIMEZONE=UTCLEAN_DB_PASSWORD and MYSQL_PASSWORD must be identical, because one tells the app and the other tells the database container. Leave the host and database names as the sample has them unless you rename services.
How do you keep the app off the public interface?
Bind the published port to loopback, so only the proxy on the same server can reach Leantime. Open docker-compose.yml, find the ports entry of the Leantime service, and make it read:
ports:
- "127.0.0.1:8080:8080"If your copy uses a LEAN_PORT variable in that line, setting LEAN_PORT=127.0.0.1:8080 in .env gives the same result. Docker writes its own packet filter rules for published ports, so a loopback binding is more dependable than a ufw rule for this purpose.
How do you start Leantime and run the installer?
Start the containers, confirm the port, then finish setup in the browser.
cd ~/leantime
docker compose up -d
docker compose ps
sudo ss -tlnp | grep 8080
curl -sI http://127.0.0.1:8080/install | head -n 1Once HTTPS is in place (next section), open https://pm.example.net/install, enter your email, password, name and company, and the installer creates the schema. You land on the dashboard and can create the first project. The image tag in the compose file pins the version; docker compose images lists it.
How do you add Nginx and a certificate?
Nginx proxies to port 8080 and passes the forwarded headers Leantime uses to build HTTPS links.
sudo apt install -y nginx certbot python3-certbot-nginx
sudo tee /etc/nginx/sites-available/leantime >/dev/null <<'EOF'
server {
listen 80;
listen [::]:80;
server_name pm.example.net;
client_max_body_size 64M;
location / {
proxy_pass http://127.0.0.1:8080;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Host $host;
}
}
EOF
sudo ln -s /etc/nginx/sites-available/leantime /etc/nginx/sites-enabled/
sudo nginx -t && sudo systemctl reload nginx
sudo certbot --nginx -d pm.example.net
sudo ufw allow OpenSSH && sudo ufw allow 'Nginx Full' && sudo ufw enableIf pages load but styles or links point to http, check that LEAN_APP_URL starts with https:// and recreate the container with docker compose up -d. Prefer Caddy? A site block with reverse_proxy 127.0.0.1:8080 replaces all of the above (Caddy HTTPS).
How do you configure Leantime email?
Turn on SMTP in .env and point it at an authenticated relay on port 587:
LEAN_EMAIL_RETURN=pm@example.net
LEAN_EMAIL_USE_SMTP=true
LEAN_EMAIL_SMTP_HOSTS=smtp.relay.example.net
LEAN_EMAIL_SMTP_USERNAME=relay-user
LEAN_EMAIL_SMTP_PASSWORD=relay-password
LEAN_EMAIL_SMTP_AUTO_TLS=true
LEAN_EMAIL_SMTP_SECURE=STARTTLS
LEAN_EMAIL_SMTP_PORT=587Run docker compose up -d to apply and invite a test user. Sending straight out on port 25 may be blocked on new servers; ask support with a ticket before designing around it. SMTP relay for apps walks through SPF and DKIM so invitations arrive.
How do you back up and upgrade Leantime?
Dump MySQL using the credentials already inside the database container, and keep a copy of .env and the upload volumes.
cd ~/leantime
docker compose ps --services
docker exec mysql_leantime sh -c 'mysqldump -u root -p"$MYSQL_ROOT_PASSWORD" "$MYSQL_DATABASE"' | gzip > leantime-$(date +%F).sql.gz
docker volume ls | grep leantimeAdjust mysql_leantime if your container name differs (docker ps shows it). To upgrade, pull and recreate; Leantime asks to run database updates on the next login if the schema changed.
git pull
docker compose pull
docker compose up -dCombine this with the server daily backups add-on for a second layer.
How do you troubleshoot a failing install?
- Database connection error on /install: the two password keys in
.envdiffer, or MySQL was first started with other values. Remove the database volume only on a fresh, empty install and start again. - Redirect loop after login:
LEAN_APP_URLand the proxy headers disagree about http and https. - Upload errors: increase
client_max_body_size. - Logs:
docker compose logs --tail 50shows both containers.
Plans that fit this guide
Base city prices. Every plan includes a dedicated IPv4 address, IPv6, full root and all 18 images.
Questions about Leantime project management
Is Leantime suitable for non-technical teams?
Yes. Its interface focuses on plain project steps, goals and to-dos, with views that suit people who do not use developer tools.
Can Leantime track time?
Yes. Timesheets are built in, and tasks can carry time estimates and logged hours.
Does it support LDAP or single sign-on?
Leantime supports LDAP and OIDC through environment settings in .env; the sample file lists the keys.
Which database does Leantime use?
MySQL or MariaDB. The Docker setup includes a MySQL container, so nothing else is needed.
Can I move Leantime to a bigger server later?
Yes. Copy the dump, the volumes and .env to the new server, start the stack and restore. Moving to a larger plan describes the general path.
More in Self-hosted apps
- Nextcloud on Nginx
- ownCloud Infinite Scale
- Seafile file sync
- Vaultwarden password vault
- Passbolt team password manager
- Gitea Git hosting
- Forgejo Git server
- GitLab Community Edition
- Gogs Git service
- Wiki.js
- BookStack documentation
- Outline knowledge base
- Paperless-ngx documents
- n8n workflow automation
- Activepieces automation
- Plausible Analytics (Community Edition)
- Umami analytics
- Mattermost team chat
- Matrix Synapse with Element
- Jitsi Meet video calls
- ONLYOFFICE Docs with Nextcloud
- HashiCorp Vault secrets server
- OpenBao secrets management
- Infisical secrets manager
- Authelia SSO and forward auth
- Zitadel identity platform
- VS Code in the browser (code-server)
- Joplin Server for notes sync
- Firefly III personal finance
- Snipe-IT asset tracking
- Odoo ERP on Ubuntu or Debian
- ERPNext with frappe_docker
- Dolibarr ERP and CRM with Nginx
- Penpot design tool with Docker
- Planka kanban boards
- Wekan boards with Docker
- Cal.com scheduling
- Chatwoot support inbox
- Mautic marketing automation
- DocuSeal document signing
- Metabase dashboards
- Appwrite backend server
- Self-hosted Supabase
- PocketBase backend
- RustDesk relay server
- Traccar GPS tracking
- Redmine project tracker
- The Lounge IRC client
- CyberChef data toolbox
- Typebot chat forms
- AFFiNE workspace
- Overleaf Community Edition
- Neko shared virtual browser
- imgproxy image resizing
- NetBox network inventory
- UVdesk help desk
- YetiForce CRM