Notes of setting up SeaFile under docker on Ubuntu Server 16.04 LTS
I have recently started using SeaFile to provide an easy method of centralized file storage. Trying the normal install with the installation script kept failing (Appears to not support latest version). As I am aiming for an easy install for others I looked to the docker based image. I use docker for packaging up other servers I often use, so this seems like a natural and easy way to work.
For Ubuntu Linux we need to install docker and also update the system.
sudo apt update sudo apt upgrade sudo apt install \ apt-transport-https \ ca-certificates \ curl \ software-properties-common \ git curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - sudo add-apt-repository \ "deb [arch=amd64] https://download.docker.com/linux/ubuntu \ $(lsb_release -cs) \ stable" sudo apt update
Install the SeaFile docker image
sudo git clone https://github.com/haiwen/seafile-docker.git /var/seafile/ cd /var/seafile/ sudo cp samples/server.conf bootstrap/bootstrap.conf sudo nano bootstrap/bootstrap.conf #Edit the first 3 fields minimum #server.name = local_ip #admin.email = firstname.lastname@example.org #admin.password = asecret sudo ./launcher bootstrap sudo ./launcher start
Check you can login
Before continuing, check you can login to the user interface over the web. This verifies that the server is setup correctly.
Open ports for FileServer - 8082/TCP Seahub - 8000/TCP Web Portal - 80/TCP
Move the Data directory
Be default the docker image will store all user data in the /var/seafile folder.
In most installations this is not ideal, as often boot off a smaller fast drive and store data on a large storage volume.
In this example my data volume is at
/mnt/Data and I will store everything in a folder called
seafile inside it.
sudo ./launcher stop sudo mv shared /mnt/Data/Seafile/ sudo ln -s /mnt/Data/Seafile/ shared sudo ./launcher start
As of current the launcher script does not appear to use the new docker restart features. Using the docker website as a reference, a systemd service can be used to automatically start the docker image for us.
Edit the file with
sudo nano /etc/systemd/system/docker-seafile.service
[Unit] Description=Seafile container Requires=docker.service After=docker.service [Service] Restart=always ExecStart=/usr/bin/docker start -a seafile ExecStop=/usr/bin/docker stop -t 2 seafile [Install] WantedBy=default.target
sudo systemctl daemon-reload sudo systemctl start docker-seafile.service sudo systemctl enable docker-seafile.service sudo reboot
This really is just a small memo for future installs.