Public | Automated Build

Last pushed: 2 years ago
Short Description
Dockerised seafile installation. Expects nginx & memcached contaniers already to exist.
Full Description

Seafile for Docker

Seafile is a "next-generation open source cloud storage
with advanced features on file syncing, privacy protection and teamwork".

This Dockerfile does not really package Seafile for Docker, but provides an environment
for running it including startup scripts + all dependencies for using MySQL and
memcached.

Note this version provides only with MySQL-backed installation (not SQLite). Both db
and memcache instances are expected to be created before seafile is set up.
Also note this installation of seafile is expected to be ran behind a reverse proxy
over https. An example of nginx config that could be used is included.

Setup

MySql/Mariadb

Assumes accessible mysql/maria db is already installed.

Log in to the docker/machine hosting the database and create the user & databases:
(from https://github.com/foxel/seafile-docker/blob/master/scripts/setup.sh)

mysql -uroot -p${DB_ROOT_PW} <<'EOF'
DROP DATABASE IF EXISTS `ccnet_db`;
DROP DATABASE IF EXISTS `seafile_db`;
DROP DATABASE IF EXISTS `seahub_db`;
CREATE DATABASE `ccnet_db` CHARACTER SET = 'utf8';
CREATE DATABASE `seafile_db` CHARACTER SET = 'utf8';
CREATE DATABASE `seahub_db` CHARACTER SET = 'utf8';
DROP USER IF EXISTS 'seafile'@'%';
CREATE USER IF NOT EXISTS 'seafile'@'%' IDENTIFIED BY 'seafile_passwd';
GRANT ALL PRIVILEGES ON `ccnet_db`.* TO `seafile`@'%';
GRANT ALL PRIVILEGES ON `seafile_db`.* TO `seafile`@'%';
GRANT ALL PRIVILEGES ON `seahub_db`.* TO `seafile`@'%';
FLUSH PRIVILEGES;
EOF

Note you need to link seafile docker to the mariadb/mysql docker by --linking it.

Seafile

The embedded setup-seafile script is executed when running the image for the
first time, which installs & sets up seafile under /seafile.
Reading through the setup manual
before setting up Seafile is still recommended, since there are more configuration
options that can be used and could be considered.
If you're using this docker on unraid, this means running the docker run command
below from command line, not from template.

Run the image in a container, exposing ports as needed and making /seafile volume permanent:

  • VER: actual seafile server ver (eg 6.0.7), or latest
  • SERVER_IP: domain or IP of the box where seafile is set up; without the protocol

For example, you could use following command to install & setup (note the db data must
match the one you used when creating the db tables & users)

docker run -it --rm \
  -e VER=6.0.7 \
  -e SERVER_NAME=seafile-server \
  -e SERVER_IP=seafile.yourdomain.com \
  -e FILESERVER_PORT=8082 \
  -e SEAHUB_ADMIN_USER=youradminuser \
  -e SEAHUB_ADMIN_PW=yourpassword \
  -e USE_EXISTING_DB=1 \
  -e MYSQL_HOST=db \
  -e MYSQL_PORT=3306 \
  -e MYSQL_USER=seafile \
  -e MYSQL_USER_PASSWD=seafile_passwd \
  -e CCNET_DB=ccnet_db \
  -e SEAFILE_DB=seafile_db \
  -e SEAHUB_DB=seahub_db \
  -v /path/on/host/to-installation-dir:/seafile \
  --link memcached \
  --link db \
  layr/seafile -- setup-seafile

Note the memcached instance is linked to your seafile container by adding
--link memcached_container:memcached to your docker run statement.
(or use user defined networks
instead, as --link option is now deprecated)

Running Seafile

Run the image again, this time you probably want to give it a name for using some
startup scripts.
The image will autostart the seafile and seahub processes if the environment
variable AUTOSTART=true is set.
A reasonable docker command would be

docker run -d \
  --name seafile \
  -p 10001:10001 \
  -p 12001:12001 \
  -p 8000:8000 \
  -p 8080:8080 \
  -p 8082:8082 \
  -v /path/on/host/to-installation-dir:/seafile \
  -e AUTOSTART=true \
  --link memcached \
  --link db \
  layr/seafile

For unraid users: this is the command that should to be converted into a Docker template.

Updates and Maintenance

The Seafile binaries are stored in the permanent volume /seafile. To update the
base system, just stop and drop the container, update the image using
docker pull layr/seafile and run it again. To update Seafile, follow the normal
upgrade process described in the Seafile upgrade manual.

Docker Pull Command
Owner
layr
Source Repository