Skip to content

Self-Hosting UGC Guard with Docker

Deploying UGC Guard using Docker is straightforward and efficient.

Prerequisites

  • A macOS or linux machine. UGC Guard might work on Windows, but we have not tested it.
  • Docker or a compatible alternative like Podman.
  • Sufficient disk space, memory, and a bit of time
  • An SMTP service (for local development, MailSlurper is sufficient)

Getting Started

First, clone the UGC Guard repository from GitHub:

bash
git clone https://github.com/SD-Software-Design-GmbH/ugc-guard.git

Next, set up your environment variables:

bash
cp /api/.example.env /api/.env

Local Development Setup

For local testing, you only need to configure your SMTP server. Refer to the configuration guide for detailed instructions.

Production Hosting Setup

To host UGC Guard on your own server, configure both the backend and frontend:

  1. Domain Setup:
    Decide on your domains. For example, we use reports.example.com for the frontend and api.reports.example.com for the API. Configure these domains with your provider.

  2. Backend Configuration:
    Edit the following fields in /api/.env:

    yaml
    frontend_url: "https://reports.example.com"
    api_url: "https://api.reports.example.com"
    secret_key: "Generate a secret key and paste it here" # openssl rand -hex 32
  3. SMTP Configuration:
    Set up your SMTP server as described in the configuration guide.

  4. Frontend Configuration:
    Update /app/ugc-guard/.env:

    toml
    VITE_UGC_GUARD_BACKEND_URL=https://api.reports.example.com

Once these steps are complete, you’re ready to launch the service.

Starting UGC Guard

To start all services, run:

bash
docker compose up

To run in detached mode:

bash
docker compose up -d

By default, the services will be available at:

API:      http://localhost:8099
Frontend: http://localhost:5173

Production Reverse Proxy

For production, use a reverse proxy like Caddy. Example configuration:

Caddyfile
reports.example.com {
  reverse_proxy localhost:5173
}

api.reports.example.com {
  reverse_proxy localhost:8099
}

Stopping UGC Guard

To stop the services:

bash
docker compose down

Hosting the Documentation

If you wish to host the documentation, it will be available on port 5174.