Seafile Docker container
Make sure you have installed Portainer & Docker before proceeding. We will add a docker stack of Seafile with MariaDB (as a data store).
1. On Portainer, add a new Network for seafile container(s) to use. I am naming it as seafile-net and set the driver as bridge.
2. Add a new stack with name Seafile. Leave the Build method as Web Editor.
3. Copy the below compose file content into the Web editor. Do not deploy the stack yet, I’ll explain what some important configurations do in the following steps. You can customize them if required.
version: "2"
services:
db:
image: mariadb
container_name: seafile-mysql
environment:
- MYSQL_ROOT_PASSWORD=changeme
- MYSQL_LOG_CONSOLE=true
volumes:
- /opt/container/seafile-mysql/db:/var/lib/mysql
networks:
- seafile-net
memcached:
image: memcached
container_name: seafile-memcached
entrypoint: memcached -m 256
networks:
- seafile-net
seafile:
image: seafileltd/seafile-mc:latest
container_name: seafile
ports:
- "80:80"
# - "443:443"
volumes:
- /opt/container/seafile/seafile-data:/shared
environment:
- DB_HOST=db
- DB_ROOT_PASSWD=changeme
- TIME_ZONE=Etc/UTC
- SEAFILE_ADMIN_EMAIL=me@example.com
- SEAFILE_ADMIN_PASSWORD=changeme
- SEAFILE_SERVER_LETSENCRYPT=false
- SEAFILE_SERVER_HOSTNAME=seafile.example.com
depends_on:
- db
- memcached
networks:
- seafile-net
networks:
seafile-net:
external:
name: seafile-net
MariaDB Database container
4. We will configure a DB store in MariaDB for Seafile to use. Start with setting the root password at MYSQL_ROOT_PASSWORD, and map a folder for DB storage. Finally, point it to the network seafile-net we created in Step 1.
Memcached container
5. Seafile uses Memcached as a cache for better performance. This section adds it and you don’t have to customize anything here unless you want to.
Seafile container
6. The default Container port for Seafile hub is 80. You can map it to anything you want. (If you are exposing enabling SSL then you would want to map the port 443)
7. After that add a file storage location for Seafile. This is where the web and user files are stored.
8. Next, add the db host name and user credentials we entered earlier in MariaDB.
9. Set a default admin email and password to manage this Seafile server.
10. This is optional and needed only if you are enabling HTTPS. Make the SEAFILE_SERVER_LETSENCRYPT variable true to retrieve an SSL automatically from the LetsEncrypt server. You would also need to add the hostname in the next variable.
11. Click deploy and go to http://hostname or https://hostname on your web browser. Then login with the default admin credentials set up earlier.
That is it, now you can start using your Seafile server. You can also connect to your account via mobile apps and desktop sync clients.
1 comment
Great writeup, but unfortunately I’m using Cloudflare Zero Tunnel due to CG-NAT issues from my ISP. Something weird going on with Seafile that won’t let it pass.