Mozillas syncstorage-rs as rady-to-deploy Docker image
1.5K
Mozilla Sync Storage Server (syncstorage-rs) with full tokenserver support and Python 3.13.
openssl rand -hex 32)Create a docker-compose.yml:
version: '3.8'
services:
mysql:
image: mysql:8.0
container_name: syncstorage-mysql
environment:
MYSQL_ROOT_PASSWORD: your-root-password
MYSQL_DATABASE: syncstorage_rs
MYSQL_USER: syncuser
MYSQL_PASSWORD: your-secure-password
volumes:
- mysql_data:/var/lib/mysql
- ./init.sql:/docker-entrypoint-initdb.d/init.sql
ports:
- "3306:3306"
healthcheck:
test: ["CMD", "mysqladmin", "ping", "-h", "localhost"]
timeout: 20s
retries: 10
syncstorage:
image: oratorian/syncstorage-rs:latest
container_name: syncstorage-rs
ports:
- "8000:8000"
environment:
# REQUIRED - Server Configuration
SYNC_HOST: "0.0.0.0"
SYNC_PORT: "8000"
# REQUIRED - Must be exactly 64 characters
# Generate with: openssl rand -hex 32
SYNC_MASTER_SECRET: "change-this-to-64-character-secret-key-absolutely-required-here!"
# REQUIRED - Database Configuration
SYNC_SYNCSTORAGE__DATABASE_URL: "mysql://syncuser:your-secure-password@mysql:3306/syncstorage_rs"
SYNC_SYNCSTORAGE__ENABLED: "true"
# REQUIRED for multi-user setup (optional for single user)
SYNC_TOKENSERVER__DATABASE_URL: "mysql://syncuser:your-secure-password@mysql:3306/tokenserver_rs"
SYNC_TOKENSERVER__ENABLED: "true"
SYNC_TOKENSERVER__RUN_MIGRATIONS: "true"
# REQUIRED for tokenserver - Must be exactly 64 characters
SYNC_TOKENSERVER__FXA_METRICS_HASH_SECRET: "change-this-to-another-64-character-secret-key-absolutely-required!"
# Firefox Accounts Configuration (use production or stage)
# Production (for real Firefox accounts):
SYNC_TOKENSERVER__FXA_EMAIL_DOMAIN: "api.accounts.firefox.com"
SYNC_TOKENSERVER__FXA_OAUTH_SERVER_URL: "https://oauth.accounts.firefox.com/v1"
SYNC_TOKENSERVER__FXA_BROWSERID_AUDIENCE: "https://token.services.mozilla.com"
SYNC_TOKENSERVER__FXA_BROWSERID_ISSUER: "api.accounts.firefox.com"
SYNC_TOKENSERVER__FXA_BROWSERID_SERVER_URL: "https://verifier.accounts.firefox.com/v2"
# Logging
SYNC_HUMAN_LOGS: "1"
RUST_LOG: "info"
depends_on:
mysql:
condition: service_healthy
restart: unless-stopped
volumes:
mysql_data:
Create init.sql:
-- This file is automatically run by MySQL container on first start
CREATE DATABASE IF NOT EXISTS syncstorage_rs;
CREATE DATABASE IF NOT EXISTS tokenserver_rs;
GRANT ALL PRIVILEGES ON syncstorage_rs.* TO 'syncuser'@'%';
GRANT ALL PRIVILEGES ON tokenserver_rs.* TO 'syncuser'@'%';
FLUSH PRIVILEGES;
Then run:
docker compose up -d
# Check if server is running
curl http://localhost:8000/__heartbeat__
# Should return:
# {"version":"0.20.1","database":"Ok","quota":{"enabled":false,"size":0},"status":"Ok"}
| Variable | Description | Example |
|---|---|---|
SYNC_HOST | Server bind address | 0.0.0.0 |
SYNC_MASTER_SECRET | EXACTLY 64 characters | Generate with openssl rand -hex 32 |
SYNC_SYNCSTORAGE__DATABASE_URL | MySQL connection string | mysql://user:pass@host:3306/syncstorage_rs |
SYNC_SYNCSTORAGE__ENABLED | Enable sync storage | true |
| Variable | Description | Example |
|---|---|---|
SYNC_TOKENSERVER__ENABLED | Enable tokenserver | true for multi-user, false for single |
SYNC_TOKENSERVER__DATABASE_URL | Tokenserver database | mysql://user:pass@host:3306/tokenserver_rs |
SYNC_TOKENSERVER__RUN_MIGRATIONS | Auto-run DB migrations | true |
SYNC_TOKENSERVER__FXA_METRICS_HASH_SECRET | EXACTLY 64 characters | Generate with openssl rand -hex 32 |
Use either production OR stage servers, not both:
For Production Firefox Accounts:
SYNC_TOKENSERVER__FXA_EMAIL_DOMAIN: api.accounts.firefox.comSYNC_TOKENSERVER__FXA_OAUTH_SERVER_URL: https://oauth.accounts.firefox.com/v1SYNC_TOKENSERVER__FXA_BROWSERID_AUDIENCE: https://token.services.mozilla.comSYNC_TOKENSERVER__FXA_BROWSERID_ISSUER: api.accounts.firefox.comSYNC_TOKENSERVER__FXA_BROWSERID_SERVER_URL: https://verifier.accounts.firefox.com/v2For Stage/Testing Accounts:
SYNC_TOKENSERVER__FXA_EMAIL_DOMAIN: api-accounts.stage.mozaws.netSYNC_TOKENSERVER__FXA_OAUTH_SERVER_URL: https://oauth.stage.mozaws.netSYNC_TOKENSERVER__FXA_BROWSERID_AUDIENCE: https://token.stage.mozaws.netSYNC_TOKENSERVER__FXA_BROWSERID_ISSUER: api-accounts.stage.mozaws.netSYNC_TOKENSERVER__FXA_BROWSERID_SERVER_URL: https://verifier.stage.mozaws.net/v2| Variable | Description | Default |
|---|---|---|
SYNC_PORT | Server port | 8000 |
SYNC_HUMAN_LOGS | Human-readable logs | 0 |
RUST_LOG | Log level | warn |
SYNC_SYNCSTORAGE__ENABLE_QUOTA | Enable storage quotas | false |
SYNC_SYNCSTORAGE__MAX_QUOTA_LIMIT | Max quota in bytes | 200000000 |
Open Firefox and navigate to about:config
Search for identity.sync.tokenserver.uri
Set it to your server:
http://YOUR_SERVER_IP:8000/tokenserver/1.0/sync/1.5
Replace YOUR_SERVER_IP with your actual server IP (e.g., 192.168.1.100)
Sign in to Firefox Sync:
SYNC_TOKENSERVER__ENABLED: "false"SYNC_TOKENSERVER__ENABLED: "true"Problem: "Access denied for user" or similar MySQL errors
Solution: Ensure these three places have the SAME username and password:
MYSQL_USER and MYSQL_PASSWORD in docker-compose.yml mysql serviceinit.sql GRANT statementsSYNC_SYNCSTORAGE__DATABASE_URL and SYNC_TOKENSERVER__DATABASE_URLExample of correct alignment:
# In docker-compose.yml mysql service:
MYSQL_USER: syncuser
MYSQL_PASSWORD: mypass123
# In init.sql:
GRANT ALL PRIVILEGES ON syncstorage_rs.* TO 'syncuser'@'%';
# In syncstorage service:
SYNC_SYNCSTORAGE__DATABASE_URL: "mysql://syncuser:mypass123@mysql:3306/syncstorage_rs"
docker-compose logs mysqlSHOW DATABASES;curl http://YOUR_SERVER_IP:8000/__heartbeat__identity.sync.tokenserver.uri is set correctlyGenerate secure secrets:
# Generate two different 64-character secrets
openssl rand -hex 32 # For SYNC_MASTER_SECRET
openssl rand -hex 32 # For SYNC_TOKENSERVER__FXA_METRICS_HASH_SECRET
Use HTTPS in production: Put this behind a reverse proxy (nginx/Caddy) with SSL
Firewall: Only expose port 8000 to trusted networks
Regular updates: Pull the latest image periodically for security updates
latest - Latest stable version (currently 0.20.1)0.20.1 - Specific versionMPL-2.0 (same as syncstorage-rs)
For issues with:
Content type
Image
Digest
sha256:d99b020c6…
Size
66.7 MB
Last updated
about 1 year ago
docker pull oratorian/syncstorage-rs