This repository has been archived on 2025-11-16. You can view files and clone it, but cannot push or open issues or pull requests.
Files
swarm-production/stacks/apps/peertube
2025-11-11 01:25:04 +00:00
..
2025-11-11 01:25:04 +00:00
2025-11-11 01:25:04 +00:00

PeerTube Docker Swarm Setup

Prerequisites

  1. Traefik is running and configured
  2. PostgreSQL is running (postgresSQL service)
  3. The homelab network exists
  4. DNS record for videos.frostlabs.me points to your server

Setup Steps

1. Create PeerTube Database

Connect to your existing PostgreSQL instance and create the PeerTube database:

# Connect to PostgreSQL container
docker exec -it $(docker ps -q -f name=postgresSQL) psql -U admin -d postgres

# Create database (user 'admin' already exists with postgres-master secret)
CREATE DATABASE peertube;
GRANT ALL PRIVILEGES ON DATABASE peertube TO admin;
\q

2. Create Docker Secret for PeerTube

You already have the postgres-master secret for database access. You just need to create the PeerTube application secret:

# Generate and create the PeerTube secret
echo "$(openssl rand -hex 32)" | docker secret create peertube-secret -

# Verify the secret was created
docker secret ls | grep peertube

Note: The stack uses your existing postgres-master secret for database authentication with the admin user.

3. Verify Data Directory Permissions

# Check that the PeerTube appdata directory exists and has correct permissions
ls -la /home/doc/projects/unraid-appdata/PeerTube

# If needed, fix permissions (UID 999 is the PeerTube user)
sudo chown -R 999:999 /home/doc/projects/unraid-appdata/PeerTube

4. Deploy the Stack

docker stack deploy -c stack.yml peertube

5. Monitor Deployment

# Watch the services
docker service ls | grep peertube

# Check logs
docker service logs -f peertube_peertube

# Check if healthy
docker ps | grep peertube

6. Access PeerTube

Once deployed, access PeerTube at: https://videos.frostlabs.me

The first time you access it, you'll need to:

  1. Complete the setup wizard
  2. Create an admin account
  3. Configure additional settings in the admin panel

Configuration Notes

Database Connection

  • Host: postgresSQL (existing Postgres service)
  • Port: 5432 (internal)
  • Database: peertube
  • User: admin
  • Password: From postgres-master secret

Redis Connection

  • Host: peertube-redis (internal service)
  • Port: 6379 (default)

SMTP/Email

Ports

  • 9000: PeerTube HTTP (internal, proxied by Traefik)
  • 1935: RTMP for live streaming (published on host)

Traefik Integration

The stack is configured to use Traefik for:

  • SSL/TLS certificates (Let's Encrypt)
  • HTTPS on port 443
  • HTTP to HTTPS redirect
  • Domain: videos.frostlabs.me

Storage Layout

All data is stored in /home/doc/projects/unraid-appdata/PeerTube:

  • Videos and media files
  • Thumbnails and previews
  • User uploads
  • Logs
  • Configuration

Troubleshooting

Check service status

docker service ps peertube_peertube --no-trunc

View logs

docker service logs peertube_peertube
docker service logs peertube_peertube-redis
docker service logs peertube_peertube-postfix

Database connection issues

# Test connection from PeerTube container
docker exec -it $(docker ps -q -f name=peertube_peertube) sh
nc -zv postgresSQL 5432

Restart services

docker service update --force peertube_peertube

Remove and redeploy

docker stack rm peertube
# Wait for cleanup
docker stack deploy -c stack.yml peertube

Updating PeerTube

# Update the image
docker service update --image chocobozzz/peertube:production-bookworm peertube_peertube

# Or redeploy the stack
docker stack deploy -c stack.yml peertube

Security Considerations

  1. Change the default admin password after first login
  2. Keep PEERTUBE_SECRET secure and never commit it to version control
  3. Regularly update the PeerTube image for security patches
  4. Configure proper email settings for notifications
  5. Review and configure user registration settings in admin panel

Additional Resources