What is Seafile?
Seafile is an open-source, cross-platform file-hosting software system. Files are stored on a central server and can be synchronized with personal computers and mobile devices through apps. Files on the Seafile server can also be accessed directly via the server's web interface. Seafile's functionality is similar to other popular file hosting services such as Dropbox and Google Drive. The primary difference between Seafile and Dropbox/Google Drive is that Seafile is a self-hosted file sharing solution for private cloud applications. In private clouds, storage space and client connection limits are determined exclusively by the users' own infrastructure and settings rather than the terms and conditions of a cloud service provider.
In order to install Seafile with docker compose you need to have a working docker environment, you can see how to do it by clicking the link below.
To deploy Seafile, simply use the following docker-compose.yaml file and edit the values:
DB_ROOT_PASSWD(same than MYSQL_ROOT_PASSWORD)
/path/local/datas/with the real path of a folder you want to use to store Seafile datas and database
--- version: "2.1" services: db: image: mariadb:10.6 container_name: seafile-db environment: - MYSQL_ROOT_PASSWORD=A-SECRET-PASSWORD - MYSQL_LOG_CONSOLE=true volumes: - /path/local/datas/seafile/db:/var/lib/mysql restart: always memcached: image: memcached:1.6.18 container_name: memcached entrypoint: memcached -m 256 restart: always seafile: image: seafileltd/seafile-mc:latest container_name: seafile ports: - 80:80 volumes: - /path/local/datas/seafile/shared:/shared environment: - DB_HOST=db - DB_ROOT_PASSWD=A-SECRET-PASSWORD #Same as above - [email protected] - SEAFILE_ADMIN_PASSWORD=your-admin-password - SEAFILE_SERVER_HOSTNAME=https://seafile.your.domain # If you access your seafile with a domain in https depends_on: - db - memcached restart: always
Once your docker compose file saved you can launch your Seafile server with the command:
docker compose up -d
Force the Two-Factor Authentication
Before the first login, I higly recommend you to activate and force the Two-Factor Authentication fot all the users.
You can do that by edithing the file
/path/local/datas/seafile/shared/seafile/conf/seahub_settings.py and add those 2 lines at the end
ENABLE_TWO_FACTOR_AUTH = True ENABLE_FORCE_2FA_TO_ALL_USERS = True
Restart Seafile with
docker compose restart seafile
After a few seconds you can open a browser and go to
http://server-ip and you should be able to access the login page
Log in with the credentials you set with
SEAFILE_ADMIN_PASSWORD on your docker compose file.
After the login, you will be invited to setup the Two-Factor authentication by scanning a QR Code with the application of your choice (Google Authenticator, Bitwarden etc...)
Once logged in, I recommend you to:
- Reset the admin password
- Edit the docker compose file and remove the line
- Apply the changes with
docker compose up -d
Access Seafile in https and expose it publicly
Currently your Seafile server is only reachable from your home network, to expose it securely to internet you have several choices:
- Reverse proxy, you can see how to deploy a reverse proxy with Swag here
Reverse proxy with Swag
I will show you how to do it with Swag, it' s my to go reverse proxy to use with docker containers.
First you need to have a Swag reverse proxy up and running, you can follow my post
Seafile does not have a pre-configured file for swag, so you can use my
You can see the reverse proxy use the ports 8000 et 8082, to allow the reverse proxy to access it you need to edit the
docker-compose.yaml file and add the 2 ports in the seafile container ports definition.
***** seafile: image: image: seafileltd/seafile-mc:latest container_name: seafile ports: - 8000 - 8082 - 80:80 *****
Apply the configuration with
docker compose up -d
Then go edit the file gunicorn.conf.py in the folder
/path/local/datas/seafile/shared/seafile/conf and modify the line
bind = "127.0.0.1:8000"
bind = "0.0.0.0:8000"
save the file and restart Swag and Seafile with the command:
docker compose restart swag seafile
Now, you will be able to access your Seafile server with the url
You can also remove from the
docker-compose.yaml file the line
If you don' t want to access your Seafile from the local IP address.
The last thing to do in the Seafile web console is to set the url you use to access Seafile to avoid issues with the avatars:
You can download the desktop et mobile applications by followings this link: https://www.seafile.com/en/download/