Log inSign up

Leantime projects, goals and timesheets on your own VPS

Clone docker-leantime, copy sample.env to .env, set the app URL, database passwords and session key, keep the web port on 127.0.0.1:8080, and run docker compose up -d. Open /install to create the first company and admin user, then put Nginx with Certbot in front. Leantime is a PHP app with a MySQL container, so 2 GB of memory is enough for a small team.

Topic: Self-hosted apps · Tested on: Ubuntu 24.04 and 22.04, Debian 12 and 13 · Updated 2026-12-03

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 --version

How 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 .env

Set 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=UTC

LEAN_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 1

Once 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 enable

If 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=587

Run 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 leantime

Adjust 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 -d

Combine 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 .env differ, 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_URL and the proxy headers disagree about http and https.
  • Upload errors: increase client_max_body_size.
  • Logs: docker compose logs --tail 50 shows both containers.

Plans that fit this guide

Base city prices. Every plan includes a dedicated IPv4 address, IPv6, full root and all 18 images.

All prices
PlanFits becauseSizeMonthlyOrder from
A1-2a small team1 vCPU, 2 GB RAM, 50 GB NVMe$7.20/mo$43.20 for 6 months
A2-4several teams and many projects2 vCPU, 4 GB RAM, 100 GB NVMe$14.40/mo$43.20 for 3 months

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.