How to Deploy Seafile – Secure File Sync

Updated on 18 December, 2025
Deploy Seafile File Sync and Collaboration Platform with Docker Compose.
How to Deploy Seafile – Secure File Sync header image

Seafile is an open-source cloud storage platform designed for file synchronization, sharing, and team collaboration. Seafile supports custom file properties and multiple organizational views to manage content more effectively. It offers a Dropbox-like experience, while giving you full control over your data on your own server.

This article demonstrates how to deploy Seafile on Ubuntu 24.04 using Docker Compose and secure it with HTTPS.

Prerequisites

Before you begin:

Set Up the Directory Structure and Environment Variables

Set up the project directory to store configuration files and persistent data. You must also configure the environment variables to define your domain, security keys, and administrative credentials.

  1. Create the /opt/seafile directory.

    console
    $ sudo mkdir -p /opt/seafile
    
  2. Change ownership of the directory to your current user. This allows you to manage files without using sudo for every command.

    console
    $ sudo chown -R $USER:$USER /opt/seafile
    
  3. Navigate to the project directory.

    console
    $ cd /opt/seafile
    
  4. Download the official environment variable template.

    console
    $ wget -O .env https://manual.seafile.com/latest/repo/docker/ce/env
    
  5. Install pwgen to generate a secure secret key.

    console
    $ sudo apt install pwgen -y
    
  6. Generate a random 40-character string for the JWT_PRIVATE_KEY variable of the .env file.

    console
    $ pwgen -s 40 1
    

    Copy the output string to use this in the next step.

  7. Edit the .env file.

    console
    $ nano .env
    

    Update the following variables:

    • Basic Configuration:
      • SEAFILE_SERVER_HOSTNAME: Set this to your domain (e.g., seafile.example.com).
      • SEAFILE_SERVER_PROTOCOL: Change http to https to enable TLS encryption.
      • JWT_PRIVATE_KEY: Paste the random string you generated in the last step.
    • Database Security:
      • SEAFILE_MYSQL_DB_PASSWORD: Set a secure password for the database connection.
      • INIT_SEAFILE_MYSQL_ROOT_PASSWORD: Set a secure password for the database root user.
    • Administrative Credentials:
      • INIT_SEAFILE_ADMIN_EMAIL: Set your email address.
      • INIT_SEAFILE_ADMIN_PASSWORD: Set a strong password for the admin dashboard.

    Save and close the file.

Deploy with Docker Compose

Download the official Docker Compose files and start the services. Seafile uses a modular setup where different components are defined in separate YAML files.

  1. Download the core Seafile server manifest.

    console
    $ wget https://manual.seafile.com/latest/repo/docker/ce/seafile-server.yml
    

    The seafile-server.yml defines the core services required for file synchronization:

    • seafile: The main application container that handles file storage, synchronization, versioning, and provides the web interface for file management.
    • db: A MariaDB container that stores user data and metadata.
    • redis: A high-performance cache and message broker used by Seafile.
  2. Download the SeaDoc extension manifest.

    console
    $ wget https://manual.seafile.com/latest/repo/docker/seadoc.yml
    

    The seadoc.yml defines the seadoc service. This container runs the document engine that allows multiple users to edit .sdoc files simultaneously in real-time.

  3. Download the Caddy web server manifest.

    console
    $ wget https://manual.seafile.com/latest/repo/docker/caddy.yml
    

    The caddy.yml file defines the caddy service. Caddy acts as a reverse proxy that automatically obtains and renews TLS certificates from Let's Encrypt, ensuring your site is accessible via HTTPS.

  4. Add your user account to the docker user group.

    console
    $ sudo usermod -aG docker $USER
    
  5. Apply new group membership.

    console
    $ newgrp docker
    
  6. Start the Seafile stack.

    console
    $ docker compose up -d
    

    The .env file downloaded earlier contains a COMPOSE_FILE variable that instructs Docker to use all three YAML files (seafile-server.yml, caddy.yml, seadoc.yml) simultaneously.

  7. Verify that the containers are running.

    console
    $ docker compose ps
    
    Note
    For more information on managing a Docker Compose stack, see the How To Use Docker Compose article.

Access Seafile

  1. Open your web browser and navigate to your domain, such as https://seafile.example.com.

    Login

  2. Log in using the Email and Password you defined in the .env file to access Seafile Dashboard.

    Dashboard

Conclusion

By following this article, you successfully deployed Seafile on Ubuntu 24.04. You now have a private, secure file cloud with integrated real-time document collaboration, and HTTPS encryption. For more information, refer to the official Seafile Manual.

Comments