Skip to content

How to Build Seafile Server Release Package for Raspberry Pi

Table of contents:

Setup the build environment

Requirements:

  • A raspberry pi with raspian distribution installed.

Install packages

sudo apt-get install build-essential
sudo apt-get install libevent-dev libcurl4-openssl-dev libglib2.0-dev uuid-dev intltool libsqlite3-dev libmysqlclient-dev libarchive-dev libtool libjansson-dev valac libfuse-dev re2c flex python-setuptools cmake

Compile development libraries

libevhtp

libevhtp is a http server libary on top of libevent. It's used in seafile file server.

git clone https://www.github.com/haiwen/libevhtp.git
cd libevhtp
cmake -DEVHTP_DISABLE_SSL=ON -DEVHTP_BUILD_SHARED=OFF .
make
sudo make install

After compiling all the libraries, run ldconfig to update the system libraries cache:

sudo ldconfig

Install python libraries

Create a new directory /home/pi/dev/seahub_thirdpart:

mkdir -p ~/dev/seahub_thirdpart

Download these tarballs to /tmp/:

Install all these libaries to /home/pi/dev/seahub_thirdpart:

cd ~/dev/seahub_thirdpart
export PYTHONPATH=.
easy_install -d . /tmp/pytz-2016.1.tar.gz
easy_install -d . /tmp/Django-1.8.10.tar.gz
easy_install -d . /tmp/django-statici18n-1.1.3.tar.gz
easy_install -d . /tmp/djangorestframework-3.3.2.tar.gz
easy_install -d . /tmp/django_compressor-1.4.tar.gz
easy_install -d . /tmp/jsonfield-1.0.3.tar.gz
easy_install -d . /tmp/django-post_office-2.0.6.tar.gz
easy_install -d . /tmp/gunicorn-19.4.5.tar.gz
easy_install -d . /tmp/flup-1.0.2.tar.gz
easy_install -d . /tmp/chardet-2.3.0.tar.gz
easy_install -d . /tmp/python-dateutil-1.5.tar.gz
easy_install -d . /tmp/six-1.9.0.tar.gz
easy_install -d . /tmp/django-picklefield-0.3.2.tar.gz
wget -O /tmp/django_constance.zip https://github.com/haiwen/django-constance/archive/bde7f7c.zip
easy_install -d . /tmp/django_constance.zip
easy_install -d . /tmp/jdcal-1.2.tar.gz
easy_install -d . /tmp/et_xmlfile-1.0.1.tar.gz
easy_install -d . /tmp/openpyxl-2.3.0.tar.gz

Prepare seafile source code

To build seafile server, there are four sub projects involved:

The build process has two steps:

  • First, fetch the tags of each projects, and make a soruce tarball for each of them.
  • Then run a build-server.py script to build the server package from the source tarballs.

Fetch git tags and prepare source tarballs

Seafile manages the releases in tags on github.

Assume we are packaging for seafile server 6.0.1, then the tags are:

  • ccnet-server, seafile-server, and seahub would all have a v6.0.1-sever tag.
  • libsearpc would have the v3.0-latest tag (libsearpc has been quite stable and basically has no further development, so the tag is always v3.0-latest)

First setup the PKG_CONFIG_PATH enviroment variable (So we don't need to make and make install libsearpc/ccnet/seafile into the system):

export PKG_CONFIG_PATH=/home/pi/dev/seafile/lib:$PKG_CONFIG_PATH
export PKG_CONFIG_PATH=/home/pi/dev/libsearpc:$PKG_CONFIG_PATH
export PKG_CONFIG_PATH=/home/pi/dev/ccnet:$PKG_CONFIG_PATH

libsearpc

cd ~/dev
git clone https://github.com/haiwen/libsearpc.git
cd libsearpc
git reset --hard v3.0-latest
./autogen.sh
./configure
make dist

ccnet

cd ~/dev
git clone https://github.com/haiwen/ccnet-server.git
cd ccnet
git reset --hard v6.0.1-server
./autogen.sh
./configure
make dist

seafile

cd ~/dev
git clone https://github.com/haiwen/seafile-server.git
cd seafile
git reset --hard v6.0.1-server
./autogen.sh
./configure
make dist

seahub

cd ~/dev
git clone https://github.com/haiwen/seahub.git
cd seahub
git reset --hard v6.0.1-server
./tools/gen-tarball.py --version=6.0.1 --branch=HEAD

seafobj

cd ~/dev
git clone https://github.com/haiwen/seafobj.git
cd seafobj
git reset --hard v6.0.1-server
make dist

seafdav

cd ~/dev
git clone https://github.com/haiwen/seafdav.git
cd seafdav
git reset --hard v6.0.1-server
make

Copy the source tar balls to the same folder

mkdir ~/seafile-sources
cp ~/dev/libsearpc/libsearpc-<version>-tar.gz ~/seafile-sources
cp ~/dev/ccnet/ccnet-<version>-tar.gz ~/seafile-sources
cp ~/dev/seafile/seafile-<version>-tar.gz ~/seafile-sources
cp ~/dev/seahub/seahub-<version>-tar.gz ~/seafile-sources

cp ~/dev/seafobj/seafobj.tar.gz ~/seafile-sources
cp ~/dev/seafdav/seafdav.tar.gz ~/seafile-sources

Run the packaging script

Now we have all the tarballs prepared, we can run the build-server.py script to build the server package.

mkdir ~/seafile-server-pkgs
~/dev/seafile/scripts/build-server.py --libsearpc_version=<libsearpc_version> --ccnet_version=<ccnet_version> --seafile_version=<seafile_version> --seahub_version=<seahub_version> --srcdir=  --thirdpartdir=/home/pi/dev/seahub_thirdpart --srcdir=/home/pi/seafile-sources --outputdir=/home/pi/seafile-server-pkgs

After the script finisheds, we would get a seafile-server_6.0.1_pi.tar.gz in ~/seafile-server-pkgs folder.

Test the built package

Test a fresh install

Use the built seafile server package to go over the steps of Deploying Seafile with SQLite.

The test should cover these steps at least:

  • The setup process is ok
  • After seafile.sh start and seahub.sh start, you can login from a browser.
  • Uploading/Downloading files through a web browser works correctly.
  • Seafile WebDAV server works correctly

Test upgrading from a previous version

  • Download the package of the previous version seafile server, and setup it.
  • Upgrading according to the manual
  • After the upgrade, check the functionality is ok:
  • Uploading/Downloading files through a web browser works correctly.
  • Seafile WebDAV server works correctly