Docker Deployment Guide

Prerequisites

Before starting the deployment, make sure you have:

  • Docker and Docker Compose installed
  • Basic understanding of Docker concepts
  • Access to a server or local machine where you want to deploy Usertour

Installation Steps

  1. Install Docker and Docker Compose

    For macOS users:

    brew install docker docker-compose
    

    For Windows users:

    choco install docker-desktop docker-compose -y
    
  2. Configure Environment Variables

    Create a docker.env file or add environment variables to your docker-compose.yml. You can use this example file as a reference. For detailed environment variable documentation, see Environment Variables.

  3. Create Docker Compose Configuration

    Choose one of the following deployment options:

    Option 1: Local Development Setup

    This configuration includes all dependencies (PostgreSQL and Redis) in Docker containers:

    version: "3.8"
    
    services:
      app:
        image: usertour/usertour:latest
        ports:
          - "8011:80"
        env_file:
          - .env
        environment:
          - PRISMA_BINARY_PLATFORM=linux-musl-openssl-3.0.x
        depends_on:
          - postgres
          - redis
        restart: always
    
      postgres:
        image: postgres:15-alpine
        environment:
          - POSTGRES_USER=postgres
          - POSTGRES_PASSWORD=postgres
          - POSTGRES_DB=usertour
        volumes:
          - postgres_data:/var/lib/postgresql/data
        restart: always
    
      redis:
        image: redis:alpine
        volumes:
          - redis_data:/data
        restart: always
    
    volumes:
      postgres_data:
      redis_data:
    

    For local development, make sure to set these environment variables in your .env file:

    # Redis Configuration
    REDIS_HOST=redis
    REDIS_PORT=6379
    REDIS_PASS=
    
    # PostgreSQL Configuration
    DATABASE_URL=postgresql://postgres:postgres@postgres:5432/usertour?schema=usertour&sslmode=prefer
    

    Option 2: Production Setup

    For production environments, you’ll need to:

    1. Install PostgreSQL and Redis separately
    2. Update the .env file with your database credentials
    3. Use this simplified configuration:
    version: "3.8"
    
    services:
      app:
        image: usertour/usertour:latest
        ports:
          - "8011:80"
        env_file:
          - .env
        environment:
          - PRISMA_BINARY_PLATFORM=linux-musl-openssl-3.0.x
        restart: always
    
  4. Start Usertour

    Run the following command in the directory containing your docker-compose.yml:

    docker-compose up -d
    

    This command will:

    • Create the database
    • Run database migrations
    • Start the Usertour application on port 8011

Accessing Usertour

  1. Initial Access

    • Navigate to http://<your-server-ip>:8011 or your configured domain
    • Note: Usertour runs on HTTP by default. For HTTPS, you’ll need to set up a reverse proxy
  2. Default Login Credentials

    • Email: lisa@simpson.com
    • Password: secret42
    • Important: Change the password immediately after your first login

Next Steps

To enable content delivery and user tracking, install Usertour.js in your application. See the Usertour.js installation guide for detailed instructions.