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
Create your
.envfile, within the same directory as the compose-file, see https://public.home.playniteweb.com/wiki/spaces/PW/pages/27525131 for what to configure.Set up MQTT configuration (see https://public.home.playniteweb.com/wiki/spaces/PW/pages/27525162/Deploy+Playnite+Web+with+Docker+Compose#MQTT-Configuration below)
Start the services, see https://public.home.playniteweb.com/wiki/spaces/PW/pages/27525162/Deploy+Playnite+Web+with+Docker+Compose#What-Gets-Started for more details.
docker-compose -f playnite-web.docker-compose.yaml up -dCheck 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.
Create the MQTT config volume first:
docker volume create playnite-web_mqtt_configCreate 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 "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:
PostgreSQL Database (
db) - Stores your game library dataMQTT Broker (
mqtt) - Handles real-time communication between servicesPlaynite Web App (
playnite-web) - The main web interface (accessible athttp://localhost:3000)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
Make sure you've created the MQTT configuration files (see https://public.home.playniteweb.com/wiki/spaces/PW/pages/27525162/Deploy+Playnite+Web+with+Docker+Compose#MQTT-Configuration section)
If using MQTT authentication, ensure
MQTT_USERNAMEandMQTT_PASSWORDenvironment variables match your mosquitto password file
Services won't start
Check that all required environment variables are set:
DB_PASSWORDandAPP_SECRETVerify your
.envfile is in the same directory as the docker-compose fileCheck 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 psCheck the
APP_PORTenvironment variable (default is 3000)Try accessing
http://localhost:3000(or your custom port)
Security Notes
Never commit your
.envfile to version controlUse strong, randomly generated passwords for
DB_PASSWORDGenerate 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