Deploy Playnite Web with Docker Compose

Deploy Playnite Web with Docker Compose

See the attachments at the bottom this page to downloaded referenced docker-compose and moquitto configuration files.

This guide explains how to run Playnite Web using a (sample) docker-compose file. This setup includes the main web application, database, MQTT broker, and sync library processor.

First Time Setup

  1. Create your .env file, within the same directory as the compose-file, see Environment Variables for what to configure.

  2. Set up MQTT configuration (see Deploy Playnite Web with Docker Compose | MQTT Configuration below)

  3. Start the services, see Deploy Playnite Web with Docker Compose | What Gets Started for more details.

    docker-compose -f playnite-web.docker-compose.yaml up -d
  4. Check that all services are running:

    docker-compose -f playnite-web.docker-compose.yaml ps

Important Setup Requirements

MQTT Configuration

This is critical setup information. Do not skip.

The MQTT broker requires configuration files to work properly. You must create these files before starting the services. There is a sample mqtt configuration file that can be used to get started.

  1. Create the MQTT config volume first:

    docker volume create playnite-web_mqtt_config
  2. Create basic MQTT configuration:

    # Create a temporary container to add config files docker run --rm -v playnite-web_mqtt_config:/config eclipse-mosquitto:2.0.18 sh -c " echo 'listener 1883' > /config/mosquitto.conf echo 'allow_anonymous true' >> /config/mosquitto.conf echo 'listener 9001' >> /config/mosquitto.conf echo 'protocol websockets' >> /config/mosquitto.conf "
  3. For better security (optional, but recommended), set up MQTT authentication:

If you set up MQTT authentication, you must set the MQTT_USERNAME and MQTT_PASSWORD environment variables to match what you created above.

# Create password file docker run --rm -v playnite-web_mqtt_config:/config eclipse-mosquitto:2.0.18 sh -c " mosquitto_passwd -c -b /config/passwd MQTT_USERNAME MQTT_PASSWORD " # Update config to require authentication docker run --rm -v playnite-web_mqtt_config:/config eclipse-mosquitto:2.0.18 sh -c " echo 'listener 1883' > /config/mosquitto.conf echo 'allow_anonymous false' >> /config/mosquitto.conf echo 'password_file /mosquitto/config/passwd' >> /config/mosquitto.conf echo 'listener 9001' >> /config/mosquitto.conf echo 'protocol websockets' >> /config/mosquitto.conf "

What Gets Started

This docker-compose setup runs four services:

  1. PostgreSQL Database (db) - Stores your game library data

  2. MQTT Broker (mqtt) - Handles real-time communication between services

  3. Playnite Web App (playnite-web) - The main web interface (accessible at http://localhost:3000)

  4. Sync Library Processor (playnite-web-game-asssets-processor) - Processes game cover art, assets, and updates database when syncing library

Common Issues & Troubleshooting

MQTT Connection Failed Errors

Services won't start

  • Check that all required environment variables are set: DB_PASSWORD and APP_SECRET

  • Verify your .env file is in the same directory as the docker-compose file

  • Check logs: docker-compose -f playnite-web.docker-compose.yaml logs

Can't access the web interface

  • Verify the service is running: docker-compose -f playnite-web.docker-compose.yaml ps

  • Check the APP_PORT environment variable (default is 3000)

  • Try accessing http://localhost:3000 (or your custom port)

Security Notes

  • Never commit your .env file to version control

  • Use strong, randomly generated passwords for DB_PASSWORD

  • Generate a secure random string for APP_SECRET (at least 32 characters)

  • Set up MQTT authentication for production deployments

  • Consider using a secrets management tool for production deployments

  • The database port (5432) and MQTT ports (1883, 9001) are exposed - consider restricting access in production

Configuration Files

  File Modified

File mosquitto.conf

yesterday at 5:59 PM by Andrew Smith

File playnite-web.docker-compose.yaml

yesterday at 5:59 PM by Andrew Smith