Campfire Documentation

repository·main·Indexed 26 days ago

https://github.com/basecamp/once-campfire

A feature-rich, web-based chat application designed for self-hosting and bot integration. Includes documentation on deployment via ONCE or Docker, local development setup, environment configuration for SSL and Web Push notifications, and guides for backing up and restoring instances.

Tokens
2.9K
Snippets
12
Records
24
Agent score
89%

What's inside once-campfire

  1. Overview of Campfire features

    main

    Campfire is a web-based chat application that includes the following features:

    • Multiple rooms with access controls
    • Direct messages
    • File attachments with previews
    • Search functionality
    • Notifications via Web Push
    • @mentions
    • API support for bot integrations
  2. Back up Campfire instance

    main

    To ensure a consistent backup of the SQLite database, you must first run the prepare-backup script inside the running container. This creates a snapshot in storage/backups/.

    1. Create a database snapshot:
    docker exec campfire script/admin/prepare-backup

    (Use docker compose exec web if using Compose)

    1. Archive the storage volume:
    docker run --rm \
      --user root \
      --volume campfire:/rails/storage \
      --volume "$PWD":/backup \
      ghcr.io/basecamp/once-campfire:latest \
      tar czf "/backup/campfire-backup.tar.gz" -C /rails storage
    docker exec campfire script/admin/prepare-backup
  3. Deploy Campfire using ONCE

    main

    The easiest way to self-host Campfire is using ONCE, which handles initial setup and automatic updates.

    To install ONCE, run the following command on your target machine:

    curl https://get.once.com | sh

    Once installed, you can either select Campfire from the ONCE dashboard or deploy directly via the CLI using the following command:

    once deploy ghcr.io/basecamp/once-campfire --host chat.example.com
    curl https://get.once.com | sh
    # or
    once deploy ghcr.io/basecamp/once-campfire --host chat.example.com
  4. Self-host Campfire using Docker

    main

    Campfire can be deployed as a single-machine Docker container containing the web app, background jobs, caching, file serving, and SSL.

    Recommended image: ghcr.io/basecamp/once-campfire:latest.

    You can pin to specific versions using tags:

    • Exact version: ghcr.io/basecamp/once-campfire:1.4.4
    • Minor version: ghcr.io/basecamp/once-campfire:1.4
    • Major version: ghcr.io/basecamp/once-campfire:1
    • Bleeding edge: ghcr.io/basecamp/once-campfire:main

    To build the image from source:

    docker build -t campfire .
    docker build -t campfire .
  5. Run the Campfire development server

    main

    Start the development server using bin/dev. The application will be accessible at http://localhost:3000. On the first run, you will be prompted to create an admin account.

    Note: Campfire requires Redis for Action Cable, caching, and background jobs. If Redis is not running, ensure the Docker container is started with docker start campfire-redis.

    bin/dev
  6. Upgrade Campfire

    main

    Since all state is stored in the mounted volume, upgrading is performed by pulling the new image and recreating the container. Database migrations run automatically on boot.

    docker pull ghcr.io/basecamp/once-campfire:latest
    docker pull ghcr.io/basecamp/once-campfire:latest
  7. Set up the Campfire development environment

    main

    Initialize the development environment by running the setup script. This installs required system packages (SQLite, ffmpeg), manages the Ruby version via mise, installs gems, prepares the database, and starts a Redis Docker container named campfire-redis. To perform a clean installation and reset the environment, use the --reset flag.

    bin/setup
    # Or to start over:
    bin/setup --reset
  8. Configure Campfire storage volume

    main

    Campfire stores its database and uploaded file attachments in /rails/storage. To persist data between container restarts, you must mount a volume to this path.

    Use the --volume flag with docker run to create a named volume:

    docker run --volume campfire:/rails/storage ghcr.io/basecamp/once-campfire:latest
  9. Generate Campfire secrets

    main

    Campfire requires specific secret values for cryptography and Web Push notifications. You can generate these using the built-in admin script:

    docker run --rm ghcr.io/basecamp/once-campfire:latest script/admin/generate-secrets

    This will output values for:

    • SECRET_KEY_BASE
    • VAPID_PRIVATE_KEY
    • VAPID_PUBLIC_KEY

    Warning: Keep these values safe and reuse them across restarts and upgrades. Changing them later will invalidate user sessions and push notification subscriptions.

    docker run --rm ghcr.io/basecamp/once-campfire:latest script/admin/generate-secrets
  10. Configure Web Push notifications for development

    main

    To enable browser push notifications in development, you must provide VAPID (Voluntary Application Server Identification) keys via the following environment variables:

    • VAPID_PRIVATE_KEY
    • VAPID_PUBLIC_KEY

    You can generate a new key pair using the provided admin script.

    script/admin/generate-secrets