File Sync & Share

    Seafile on RamNode VPS

    Deploy a high-performance, self-hosted file synchronization and sharing platform with end-to-end encryption. Combined with RamNode's reliable VPS hosting, you get enterprise-grade file storage infrastructure.

    Ubuntu 22.04/Debian 12
    Docker + Caddy
    ⏱️ 15-20 minutes

    Why Choose Seafile?

    • High Performance: Optimized delta sync algorithm reduces bandwidth usage and speeds up file transfers significantly compared to alternatives.
    • End-to-End Encryption: Client-side encryption ensures your files remain private, even from server administrators.
    • Built-in Collaboration: Online file editing, file locking, comments, and activity tracking for team workflows.
    • Enterprise Features: LDAP/AD integration, audit logging, antivirus scanning, and granular permissions.
    • Cross-Platform Clients: Native desktop and mobile apps for Windows, macOS, Linux, iOS, and Android.

    Prerequisites

    Server Requirements

    ResourceRecommendation
    CPU2+ vCPU cores (4+ for larger teams)
    RAM4 GB minimum, 8 GB recommended
    Storage50 GB+ SSD (scale based on file storage needs)
    Operating SystemUbuntu 22.04 LTS or Debian 12
    NetworkStatic IP, ports 80/443 open, domain name configured

    Required Software

    • Docker Engine 20.10 or later
    • Docker Compose v2.0 or later
    • A registered domain name pointing to your VPS IP
    • SSL certificate (provided via Let's Encrypt through Caddy)

    Installation

    1

    Update System and Install Docker

    Connect to your RamNode VPS via SSH and update the system packages:

    Update System
    sudo apt update && sudo apt upgrade -y
    sudo apt install -y ca-certificates curl gnupg

    Add Docker's official GPG key and repository:

    Add Docker Repository
    sudo install -m 0755 -d /etc/apt/keyrings
    curl -fsSL https://download.docker.com/linux/ubuntu/gpg \
      | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
    sudo chmod a+r /etc/apt/keyrings/docker.gpg
    
    echo "deb [arch=$(dpkg --print-architecture) \
      signed-by=/etc/apt/keyrings/docker.gpg] \
      https://download.docker.com/linux/ubuntu \
      $(. /etc/os-release && echo $VERSION_CODENAME) stable" \
      | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

    Install Docker Engine and Docker Compose:

    Install Docker
    sudo apt update
    sudo apt install -y docker-ce docker-ce-cli containerd.io \
      docker-buildx-plugin docker-compose-plugin
    
    # Add your user to the docker group
    sudo usermod -aG docker $USER
    newgrp docker
    2

    Create Directory Structure

    Create the directories for Seafile data and configuration:

    Create Directories
    mkdir -p ~/seafile/{seafile-data,seafile-mysql,caddy-data,caddy-config}
    cd ~/seafile
    3

    Create Environment Configuration

    Create an environment file to store sensitive configuration. Replace the placeholder values with your own:

    Create .env File
    cat > .env << 'EOF'
    # Database Configuration
    MYSQL_ROOT_PASSWORD=your_secure_root_password_here
    DB_ROOT_PASSWD=your_secure_root_password_here
    
    # Seafile Configuration
    SEAFILE_ADMIN_EMAIL=admin@yourdomain.com
    SEAFILE_ADMIN_PASSWORD=your_admin_password_here
    SEAFILE_SERVER_HOSTNAME=seafile.yourdomain.com
    
    # Time Zone
    TIME_ZONE=America/Chicago
    EOF

    Secure the environment file:

    Secure .env
    chmod 600 .env

    Important: Use strong, unique passwords for both database and admin accounts. Store these credentials securely.

    4

    Create Docker Compose Configuration

    Create the docker-compose.yml file with MariaDB, Seafile, Memcached, and Caddy:

    docker-compose.yml
    cat > docker-compose.yml << 'EOF'
    version: '3.8'
    
    services:
      db:
        image: mariadb:10.11
        container_name: seafile-mysql
        restart: unless-stopped
        environment:
          - MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD}
          - MYSQL_LOG_CONSOLE=true
        volumes:
          - ./seafile-mysql:/var/lib/mysql
        networks:
          - seafile-net
    
      memcached:
        image: memcached:1.6-alpine
        container_name: seafile-memcached
        restart: unless-stopped
        entrypoint: memcached -m 256
        networks:
          - seafile-net
    
      seafile:
        image: seafileltd/seafile-mc:11.0-latest
        container_name: seafile
        restart: unless-stopped
        depends_on:
          - db
          - memcached
        environment:
          - DB_HOST=db
          - DB_ROOT_PASSWD=${DB_ROOT_PASSWD}
          - SEAFILE_ADMIN_EMAIL=${SEAFILE_ADMIN_EMAIL}
          - SEAFILE_ADMIN_PASSWORD=${SEAFILE_ADMIN_PASSWORD}
          - SEAFILE_SERVER_HOSTNAME=${SEAFILE_SERVER_HOSTNAME}
          - TIME_ZONE=${TIME_ZONE}
        volumes:
          - ./seafile-data:/shared
        networks:
          - seafile-net
    
      caddy:
        image: caddy:2-alpine
        container_name: seafile-caddy
        restart: unless-stopped
        ports:
          - '80:80'
          - '443:443'
        volumes:
          - ./Caddyfile:/etc/caddy/Caddyfile
          - ./caddy-data:/data
          - ./caddy-config:/config
        networks:
          - seafile-net
        depends_on:
          - seafile
    
    networks:
      seafile-net:
        driver: bridge
    EOF
    5

    Create Caddy Configuration

    Create the Caddyfile for automatic HTTPS and reverse proxying. Replace seafile.yourdomain.com with your actual domain:

    Caddyfile
    cat > Caddyfile << 'EOF'
    seafile.yourdomain.com {
        reverse_proxy seafile:80
    
        # WebSocket support for real-time features
        @websockets {
            header Connection *Upgrade*
            header Upgrade websocket
        }
        reverse_proxy @websockets seafile:80
    
        # File upload size limit (adjust as needed)
        request_body {
            max_size 10GB
        }
    
        # Security headers
        header {
            X-Content-Type-Options nosniff
            X-Frame-Options SAMEORIGIN
            Referrer-Policy strict-origin-when-cross-origin
        }
    }
    EOF
    6

    Configure Firewall

    Configure UFW to allow necessary traffic:

    Configure Firewall
    sudo ufw allow 22/tcp      # SSH
    sudo ufw allow 80/tcp      # HTTP (for Let's Encrypt)
    sudo ufw allow 443/tcp     # HTTPS
    sudo ufw enable
    7

    Launch Seafile

    Start the Seafile stack:

    Start Seafile
    docker compose up -d
    
    # Monitor the startup process
    docker compose logs -f

    Wait approximately 2-3 minutes for initial setup. Once you see "Seafile server started" in the logs, the installation is complete. Press Ctrl+C to exit the log view.

    8

    Access Seafile

    Open your browser and navigate to your domain (e.g., https://seafile.yourdomain.com). Log in with the admin credentials you configured in the .env file.

    Post-Installation Configuration

    Essential Settings

    • 1. System Settings:Navigate to System Admin → Settings to configure site name, file upload limits, and default quota.
    • 2. Email Configuration:Set up SMTP settings for password resets and notifications under System Admin → Settings → Email.
    • 3. User Management:Create user accounts and groups, set quotas, and define permissions.
    • 4. Library Encryption:Enable client-side encryption for sensitive libraries.
    9

    Configure Email Notifications

    Edit the Seafile configuration to enable email. Access the container and modify the config:

    Access Container
    docker exec -it seafile bash
    nano /shared/seafile/conf/seahub_settings.py

    Add your SMTP configuration:

    SMTP Configuration
    EMAIL_USE_TLS = True
    EMAIL_HOST = 'smtp.yourdomain.com'
    EMAIL_HOST_USER = 'notifications@yourdomain.com'
    EMAIL_HOST_PASSWORD = 'your_email_password'
    EMAIL_PORT = 587
    DEFAULT_FROM_EMAIL = 'notifications@yourdomain.com'
    SERVER_EMAIL = 'notifications@yourdomain.com'

    Restart Seafile to apply changes:

    Restart Seafile
    docker compose restart seafile

    Backup & Maintenance

    10

    Automated Backup Script

    Create a backup script to protect your data:

    backup.sh
    cat > ~/seafile/backup.sh << 'EOF'
    #!/bin/bash
    BACKUP_DIR="/home/$USER/seafile-backups"
    DATE=$(date +%Y%m%d_%H%M%S)
    mkdir -p $BACKUP_DIR
    
    # Stop services for consistent backup
    cd ~/seafile
    docker compose stop seafile
    
    # Backup database
    docker exec seafile-mysql mysqldump -u root \
      -p"$MYSQL_ROOT_PASSWORD" --all-databases \
      > $BACKUP_DIR/db_$DATE.sql
    
    # Backup Seafile data
    tar -czf $BACKUP_DIR/seafile-data_$DATE.tar.gz \
      -C ~/seafile seafile-data
    
    # Restart services
    docker compose start seafile
    
    # Keep only last 7 days of backups
    find $BACKUP_DIR -type f -mtime +7 -delete
    
    echo "Backup completed: $DATE"
    EOF
    
    chmod +x ~/seafile/backup.sh

    Schedule daily backups with cron:

    Schedule Backup
    crontab -e
    # Add this line for daily 2 AM backups:
    0 2 * * * /home/$USER/seafile/backup.sh >> /var/log/seafile-backup.log 2>&1
    11

    Updating Seafile

    To update Seafile to the latest version:

    Update Seafile
    cd ~/seafile
    
    # Pull latest images
    docker compose pull
    
    # Recreate containers with new images
    docker compose up -d
    
    # Clean up old images
    docker image prune -f

    Troubleshooting

    Container Won't Start

    Check container logs for specific errors:

    Check Logs
    docker compose logs seafile
    docker compose logs db

    Database Connection Issues

    Verify MariaDB is running and accessible:

    Check Database
    docker exec -it seafile-mysql mysql -u root -p
    SHOW DATABASES;

    SSL Certificate Problems

    Check Caddy logs and verify DNS:

    Check SSL
    docker compose logs caddy
    # Verify DNS resolution
    dig +short seafile.yourdomain.com

    Upload Failures for Large Files

    Increase the upload limit in Seafile configuration:

    Increase Upload Limit
    docker exec -it seafile bash
    nano /shared/seafile/conf/seafile.conf
    
    # Add under [fileserver]:
    max_upload_size = 10240     # Size in MB

    Performance Optimization

    • Memcached: Already included in our setup. Increase memory allocation in docker-compose.yml if needed.
    • Database Tuning: For large deployments, add custom MariaDB configuration for better performance.
    • Storage: Use RamNode's SSD storage for optimal I/O performance. Consider block storage for large file volumes.
    • Monitoring: Use docker stats to monitor resource usage and scale your VPS accordingly.

    Quick Reference Commands

    ActionCommand
    Start all servicesdocker compose up -d
    Stop all servicesdocker compose down
    View logsdocker compose logs -f
    Restart Seafiledocker compose restart seafile
    Access Seafile shelldocker exec -it seafile bash
    Check container statusdocker compose ps
    Monitor resourcesdocker stats

    Need Help?

    Contact RamNode support at support@ramnode.com

    Visit ramnode.com for VPS plans and documentation

    Seafile documentation: manual.seafile.com