Seafile is a great alternative to Dropbox, Google Drive or Nextcloud for sharing files either with your own devices or 3rd parties.
Your VPS should already have the minimal configuration including
ssh
with PubPriv Keysufw
set up with at least: deny all / allow 22, 80, 443 rules in place. Don't forgetufw enable
fail2ban
docker
&docker-compose
set up for your distibutionhostname
set up- probably a domain/subdomain with an A record pointing to your servers IP
Install and set up Caddy following the official guide:
https://caddyserver.com/docs/install#debian-ubuntu-raspbian
The config file for Caddy should be in /etc/caddy/Caddyfile
. You can inspect this file at this point and test if everything
is working: go to your servers IP or domain on port 80. You should now be greeted by Caddy.
You can check if caddy runs with
$ sudo systemctl status caddy
This should return Active: active (running)
To have all your seafile containers in the same subnet with a static IP, you need to create an (external) docker network.
$ sudo docker network create --driver=bridge --subnet=10.10.10.0/24 --gateway=10.10.10.1 seafile_net
Navigate to your users home folder (e.g.) and then create the folders needed for seafile. Data and database will be in local folders using docker volumes with mount binds:
$ mkdir seafile
$ cd seafile
$ mkdir {data, db}
Create a new docker-compose file:
$ nano docker-compose.yml
Copy and paste the content from the example file below.
Value that need to be changed according to your setup:
MYSQL_ROOT_PASSWORD
andDB_ROOT_PASSWD
(same)SEAFILE_ADMIN_EMAIL
SEAFILE_ADMIN_PASSWORD
SEAFILE_SERVER_HOSTNAME
Edit your caddy config file. In Debian this file is in /etc/caddy/
. If you don't know where to find yours,
you can probably look it up with $ ps ax | grep caddy
$ sudo nano /etc/caddy/Caddyfile
Copy and paste the contents from the example Caddyfile below.
Change the domain name to your own.
When you are done, save the file, and reload the caddy service. In debian:
$ sudo service caddy reload
If you followed the example above, go to
$ cd ~/seafile
To start your containers execute
$ docker-compose up
Now your seafile installation should be reachable under your domain, i.e. https://seafile.YOURSEVER.net
Caddy automatically generates TLS certificates from Let's Encrypt, https is the default in caddy along with http/2.
If everything has worked and you can login with your admin data from the docker-compose.yml file.
Go back to your terminal and abort the docker-compose process with CTRL-C
.
Restart the process in detached mode:
$ docker-compose up -d
To make uploads work for your seafile installation, go to your installation in the browser
i.e. https://seafile.YOURSEVER.net
- Login with admin user
- Click on the avatar in the top right corner
- Select
System-Administration
- In the administration window choose
Preferences
from the menu on the left - Set up
SERVICE_URL
andFILE_SERVER_ROOT
: -
Hit the small green checkmark to save your changes per lineSERVICE_URL = https://seafile.YOURSEVER.net FILE_SERVER_ROOT = https://seafile.YOURSEVER.net/seafhttp
Versions used for this example are
- Debian 11 Bullseye
- Caddy v2.6.2
- Docker version 23.0.0, build e92dd87
- Seafile Server Version: 9.0.10
Just wanted to drop by to say thanks for this. I tried following the official docs, and a few blog posts, but nothing quite worked till I ended up here. 🎉