Run Codeny with Docker Compose: start, TLS proxy, first admin account, updates and backup.

Codeny consists of one program (web interface, API, Git over HTTPS and SSH) and PostgreSQL. Repositories are stored as bare repositories on disk.

Requirements#

  • Linux server with Docker and Docker Compose
  • 2 CPU cores and 2 GB RAM are enough for small teams; more temporarily while building the image
  • a domain and a TLS reverse proxy (nginx, Caddy, Traefik) for production

Starting#

git clone <codeny-source> codeny
cd codeny/deploy
cp .env.example .env
# set at least POSTGRES_PASSWORD, for HTTPS also:
#   CODENY_BASE_URL=https://git.example.com
#   CODENY_COOKIE_SECURE=true
docker compose --env-file .env up -d --build

Codeny then listens on port 8080 (HTTP) and 2222 (SSH). On first start it creates the database schema.

First account = administrator#

The first registered account automatically becomes instance administrator. Register right after starting. Afterwards you can close self-registration in the admin area.

Behind a TLS proxy#

server {
    listen 443 ssl http2;
    server_name git.example.com;
    # ssl_certificate …; ssl_certificate_key …;

    client_max_body_size 512m;      # uploads, LFS, release assets
    proxy_request_buffering off;    # pass large pushes straight through

    location / {
        proxy_pass http://127.0.0.1:8080;
        proxy_http_version 1.1;
        proxy_set_header Host $host;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header Upgrade $http_upgrade;     # WebSocket for notifications
        proxy_set_header Connection "upgrade";
    }
}

Set CODENY_BASE_URL to the public address – it is used in clone URLs, email links, the SSO callback and the MCP sign-in. SSH does not go through the proxy but directly to port 2222 (or the port you set in CODENY_SSH_PORT).

Updates#

cd codeny && git pull
cd deploy && docker compose --env-file .env up -d --build codeny

Database migrations run automatically on start.

Backup#

deploy/scripts/backup.sh backs up database and repositories, restore.sh backups/<timestamp> restores them. Make sure to include:

  • the repos volume (repositories, LFS objects, release files, artifacts),
  • the key file .secret.key inside it – or CODENY_SECRET_KEY from .env. Without it webhook secrets, CI secrets, mirror credentials and 2FA secrets can no longer be decrypted,
  • the SSH host key .ssh_host_ed25519_key, otherwise the fingerprint changes and Git clients warn.
Last updated