Self-hosting

Apache DevLake on a VPS: self-hosted DORA metrics

How many times did you deploy last month? How long does a commit take to reach production? How many of your changes caused an incident? Without a tool, these questions end up as guesses. Apache DevLake collects data from your repositories, your CI and your tickets, and turns it into the four DORA metrics in ready-made Grafana dashboards. This guide installs it on a VPS with Docker Compose, publishes it over HTTPS behind nginx and connects it to GitHub or GitLab.

Deploy on a VPS Cloud →
6 min read3 steps
Contents· What Apache DevLake does1/11
  1. 01What Apache DevLake does
  2. 02What DevLake gives you
  3. 03Estimated metrics or DevLake on your VPS
  4. 04Prepare the server
  5. 05Install DevLake with Docker Compose
  6. 06Keep the encryption key
  7. 07Publish DevLake over HTTPS behind nginx
  8. 08Connect GitHub or GitLab and create a project
  9. 09Report your deployments and incidents
  10. 10Backup and update
  11. 11Apache DevLake in one click on ServOrbit

What Apache DevLake does

DevLake is an Apache Software Foundation project, released under the Apache-2.0 license and written in Go. It is not one more tool in your chain: it reads the tools you already have — GitHub, GitLab, Bitbucket, Azure DevOps, Jenkins, GitHub Actions, Jira, Linear, PagerDuty, SonarQube and about forty others — and stores their data in a common model kept in MySQL.

On top of that model, Grafana dashboards compute the four DORA metrics — deployment frequency, lead time for changes, change failure rate, time to restore service — plus dozens of other views: code review, pull request cycle, issues, quality.

What DevLake gives you

  • DORA metrics per project — computed from your pull requests, deployments and incidents, not reported by hand.
  • One view across several forges — GitHub and GitLab in the same tables, comparable with the same query.
  • More than seventy Grafana dashboards — code review, pull request wait time, CI, issues, comparison by team.
  • Webhooks protected by an API key — to report a deployment or an incident from any CI or on-call tool.
  • Your data stays with you — access tokens encrypted in the database, activity history on your server, free SQL queries.

Estimated metrics or DevLake on your VPS

Scroll the table

Without a measurement toolWith DevLake on your VPS
Deployment frequencyCounted from memoryComputed from CI
Lead time for changesUnknownMeasured from commit to deployment
Several forgesOne dashboard per toolA common data model
Tokens and historyAt a third-party serviceEncrypted on your server
DashboardsTo be builtMore than seventy included

Prepare the server

Plan an Ubuntu 24.04 VPS with at least 2 GB of RAM and 2 vCPUs: MySQL, DevLake and Grafana use about 1 GB at rest. Move to 4 GB if you collect many repositories or several years of history, since MySQL carries the collection and metric computation. Plan 20 GB of disk.

You also need Docker with the Compose plugin, and a domain name (or subdomain) pointing to the VPS: the interface opens there over HTTPS, and your pipelines will send their deployments to it by webhook.

Install DevLake with Docker Compose

  1. Prepare the folder and the .env file

    The file holds the domain, the two MySQL passwords, the administration password and the key that encrypts the access tokens to your forges.

    mkdir -p /opt/devlake && cd /opt/devlake
    cat > .env <<EOF
    DOMAIN=devlake.example.com
    DB_ROOT_PASSWORD=$(openssl rand -hex 16)
    DB_PASSWORD=$(openssl rand -hex 16)
    ADMIN_PASSWORD=$(openssl rand -hex 12)
    ENCRYPTION_KEY_HEX64=$(openssl rand -hex 32)
    EOF
    chmod 600 .env
  2. Write the docker-compose.yml file

    Four services: MySQL, the DevLake server, Grafana and config-ui, an nginx that serves the interface and forwards /api to DevLake and /grafana to Grafana. Only config-ui publishes a port, and only on the loopback interface.

    services:
      mysql:
        image: mysql:8.4.13
        restart: unless-stopped
        environment:
          MYSQL_ROOT_PASSWORD: ${DB_ROOT_PASSWORD}
          MYSQL_DATABASE: lake
          MYSQL_USER: devlake
          MYSQL_PASSWORD: ${DB_PASSWORD}
        command: --character-set-server=utf8mb4 --collation-server=utf8mb4_bin --skip-log-bin
        volumes: [devlake-mysql:/var/lib/mysql]
        healthcheck:
          test: ["CMD", "mysqladmin", "ping", "-h", "127.0.0.1", "--silent"]
          interval: 10s
          retries: 30
      devlake:
        image: apache/devlake:v1.0.3-beta19
        restart: unless-stopped
        depends_on: {mysql: {condition: service_healthy}}
        environment:
          DB_URL: mysql://devlake:${DB_PASSWORD}@mysql:3306/lake?charset=utf8mb4&parseTime=True&loc=UTC
          ENCRYPTION_SECRET: ${ENCRYPTION_KEY_HEX64}
          AUTH_ENABLED: "false"
      grafana:
        image: apache/devlake-dashboard:v1.0.3-beta19
        restart: unless-stopped
        depends_on: {mysql: {condition: service_healthy}}
        environment:
          GF_SERVER_ROOT_URL: https://${DOMAIN}/grafana
          GF_SECURITY_ADMIN_PASSWORD: ${ADMIN_PASSWORD}
          MYSQL_URL: mysql:3306
          MYSQL_DATABASE: lake
          MYSQL_USER: devlake
          MYSQL_PASSWORD: ${DB_PASSWORD}
        volumes: [devlake-grafana:/var/lib/grafana]
      config-ui:
        image: apache/devlake-config-ui:v1.0.3-beta19
        restart: unless-stopped
        depends_on: [devlake, grafana]
        environment:
          DEVLAKE_ENDPOINT: devlake:8080
          GRAFANA_ENDPOINT: grafana:3000
          ADMIN_USER: admin
          ADMIN_PASS: ${ADMIN_PASSWORD}
        ports: ["127.0.0.1:4000:4000"]
    volumes:
      devlake-mysql: {}
      devlake-grafana: {}
  3. Start and check

    The first start creates the database schema, which takes one or two minutes. Without credentials the interface must answer 401; with the admin account, the API returns its version.

    docker compose up -d --wait
    curl -s -o /dev/null -w '%{http_code}\n' http://127.0.0.1:4000/          # 401
    curl -s -u admin:"$(grep ^ADMIN_PASSWORD= .env | cut -d= -f2)" http://127.0.0.1:4000/api/version

Keep the encryption key

ENCRYPTION_SECRET encrypts the GitHub, GitLab or Jira tokens you save in the database. Without it, DevLake refuses to start; if it changes, existing connections become unreadable and must be recreated. Back up the .env file together with the database. And never leave ADMIN_PASS empty: config-ui would then open without any password.

Publish DevLake over HTTPS behind nginx

The VPS's nginx receives the domain and forwards to config-ui's local port, which then serves the interface, the API and Grafana.

server {
  listen 443 ssl;
  server_name devlake.example.com;
  # certificats Let's Encrypt (certbot --nginx)
  location / {
    proxy_pass http://127.0.0.1:4000;
    proxy_set_header Host $host;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto https;
    proxy_read_timeout 300s;
  }
}

Get the certificate with certbot --nginx -d devlake.example.com. GF_SERVER_ROOT_URL must carry the same public address: Grafana uses it for its links.

Connect GitHub or GitLab and create a project

Open https://devlake.example.com and sign in with admin and the password from .env. Under Connections, add a GitHub connection with a read-only fine-grained token (contents, metadata, pull requests, actions), then choose the repositories to collect. GitLab, Jira or Jenkins are added the same way.

Under Projects, then create a project, enable the DORA metrics and attach your connections. Start the collection: DevLake fetches the history (six months by default), then only what has changed on each scheduled run.

Report your deployments and incidents

DORA metrics need to know what a deployment is and what an incident is. The simplest way is a rule on the data already collected: in the connection settings, state for example that every GitHub Actions job whose name contains deploy is a production deployment, and that every ticket labelled incident is an incident.

If your CI is not collected, create a Webhook connection: DevLake generates an API key and shows curl commands ready to paste into your pipeline. These calls go through /api/rest/, protected by the API key and not by the interface password.

Backup and update

All useful state lives in MySQL; the .env file holds the key without which saved tokens are unreadable. Back up both every night:

cd /opt/devlake
docker compose exec -T mysql sh -c 'mysqldump -uroot -p"$MYSQL_ROOT_PASSWORD" --single-transaction lake' \
  | gzip > /root/devlake-$(date +%F).sql.gz
cp .env /root/devlake-env-$(date +%F)

To update, change the version number of the three apache/devlake* images in the Compose file, then run docker compose pull && docker compose up -d. If the interface asks you to confirm a database migration, take a backup first, then confirm. Read the release notes before skipping several versions.

Apache DevLake in one click on ServOrbit

On a ServOrbit VPS, DevLake installs from the Marketplace: official images, MySQL, generated administration password and encryption key, and an nginx reverse proxy over HTTPS on your domain or on the VPS's free subdomain. Pair it with Gitea and Jenkins for a fully self-hosted development chain: DevLake can collect both.

Share this articleservorbit.com/ma-en/blog/self-host-devlake-vps-dora-metrics

Your DORA metrics, on your VPS

Prices shown excluding VAT, with their renewal price.