How to Deploy Seafile – Secure File Sync

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:
- Have access to an Ubuntu 24.04 server (with at least 2 GB of system memory and 2 CPU cores) as a non-root user with sudo privileges.
- Install Docker and Docker Compose.
- Configure a domain name, such as
seafile.example.com, pointing to your server’s public IP address.
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.
Create the
/opt/seafiledirectory.console$ sudo mkdir -p /opt/seafile
Change ownership of the directory to your current user. This allows you to manage files without using
sudofor every command.console$ sudo chown -R $USER:$USER /opt/seafile
Navigate to the project directory.
console$ cd /opt/seafile
Download the official environment variable template.
console$ wget -O .env https://manual.seafile.com/latest/repo/docker/ce/env
Install pwgen to generate a secure secret key.
console$ sudo apt install pwgen -y
Generate a random 40-character string for the
JWT_PRIVATE_KEYvariable of the.envfile.console$ pwgen -s 40 1
Copy the output string to use this in the next step.
Edit the
.envfile.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: Changehttptohttpsto 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.
- Basic Configuration:
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.
Download the core Seafile server manifest.
console$ wget https://manual.seafile.com/latest/repo/docker/ce/seafile-server.yml
The
seafile-server.ymldefines 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.
Download the SeaDoc extension manifest.
console$ wget https://manual.seafile.com/latest/repo/docker/seadoc.yml
The
seadoc.ymldefines the seadoc service. This container runs the document engine that allows multiple users to edit.sdocfiles simultaneously in real-time.Download the Caddy web server manifest.
console$ wget https://manual.seafile.com/latest/repo/docker/caddy.yml
The
caddy.ymlfile 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.Add your user account to the docker user group.
console$ sudo usermod -aG docker $USER
Apply new group membership.
console$ newgrp docker
Start the Seafile stack.
console$ docker compose up -d
The
.envfile downloaded earlier contains aCOMPOSE_FILEvariable that instructs Docker to use all three YAML files (seafile-server.yml,caddy.yml,seadoc.yml) simultaneously.Verify that the containers are running.
console$ docker compose ps
For more information on managing a Docker Compose stack, see the How To Use Docker Compose article.Note
Access Seafile
Open your web browser and navigate to your domain, such as
https://seafile.example.com.
Log in using the Email and Password you defined in the
.envfile to access Seafile 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.