Home Install Torq How to add a domain to Torq using Caddy.

How to add a domain to Torq using Caddy.

Last updated on Jan 19, 2024

In this help article, we will guide you through the process of adding a reverse proxy using Caddy as part of the Docker-Compose setup for Torq.

Caddy will automatically create and update TLS certificates, meaning you will have https ready to go out of the box.

Prerequisites

Before proceeding, please ensure that you have:

  • Docker and Docker-Compose installed on your server

  • A registered domain name

Step 1: Stop Torq

Stop your docker-compose before proceeding. Either with stop-torq or docker-compose down.

Step 2: Add Caddy to the Docker-Compose Configuration

Add the following configuration to your docker compose file to set up your Caddy reverse proxy:

... the rest of the docker compose file from the quick install script above this point...

  caddy:
    image: "lucaslorentz/caddy-docker-proxy:ci-alpine"
    environment:
      - CADDY_INGRESS_NETWORKS=caddy
    restart: unless-stopped
    ports:
      - "80:80"
      - "443:443"
    command:
      - reverse-proxy
      - --from
      - your.domain
      - --to
      - torq:8080
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - caddy_data:/data
      - caddy_config:/config
volumes:
  torq_db:
  caddy_data:
  caddy_config:

NB: replace your.domain with your actual domain.

Step 3: Create the Required Caddy Folders

Add caddy_data and caddy_config folders inside the folder used for your Torq installation. By default, the torq folder is located at ~/.torq.

To create these folders, run the following commands if you are using the default location:

mkdir -p ~/.torq/caddy_data
mkdir -p ~/.torq/caddy_config

Step 4: Update Your DNS Settings

Add an A record in your domain's DNS settings pointing to the IP address of your server.

This step may vary depending on your domain registrar, so refer to their documentation for specific instructions.

Step 5: Start Torq

You can then start torq again using start-torq, or navigate to your .torq folder and docker-compose up -d.

NB: If your domain is not yet pointing to the address (for example before the DNS settings have propagated), you might need to restart the caddy container (or run the docker compose startup again).