Skip to content

Deployment

Docker deployment

Cthunline can be easily deployed using Docker images.

You will find below an example of docker-compose.yml file and its .env companion.

Edit configuration as you wish then use docker compose up -d to run the container.

docker-compose.yml

yaml
services:
    cthunline:
        image: cthunline/cthunline
        container_name: cthunline
        restart: always
        env_file:
            - .env
        volumes:
            - cthunline_assets:/data/assets
            - cthunline_logs:/data/logs
        networks:
            - cthunline-network
        ports:
            - 8080:8080
            # if your container is served by a reverse proxy then bind to localhost only
            # - 127.0.0.1:8080:8080
    postgresql:
        image: postgres
        container_name: postgresql
        restart: always
        networks:
            - cthunline-network
        volumes:
            - postgresql_data:/var/lib/postgresql/data
        environment:
            POSTGRES_USER: username
            POSTGRES_PASSWORD: password
    valkey:
        image: valkey/valkey
        container_name: valkey
        restart: always
        networks:
            - cthunline-network

volumes:
    cthunline_assets:
    cthunline_logs:

networks:
    cthunline-network:
        name: cthunline

.env

Check the .env.sample file from the repository.

Reverse proxy

When deploying Cthunline in production, it's convenient to put the app behind a reverse proxy.

Here is an example of a Nginx configuration that you can use to serve the app:

nginx
server {
  listen 80;
  listen [::]:80;
  # set your domain here
  server_name my.cthunline.app;
  return 301 https://$host$request_uri;
}

server {
  listen 443 ssl http2;
  # set your domain here
  server_name my.cthunline.app;
  # path to ssl certificate files here
  ssl_certificate /path/to/ssl/fullchain.pem;
  ssl_certificate_key /path/to/ssl/privkey.pem;
  location / {
    # change port here
    proxy_pass http://127.0.0.1:8080;
    proxy_http_version 1.1;
    proxy_set_header Host $host;
    proxy_set_header Connection 'upgrade';
    proxy_set_header Upgrade $http_upgrade;
    proxy_cache_bypass $http_upgrade;
    # change the max body size depending on server configuration
    client_max_body_size 100M;
  }
}