How to Build Seafile Server Release Package¶
From Seafile 11.0, you can build Seafile release package with seafile-build script. You can check the README.md file in the same folder for detailed instructions.
The seafile-build.sh
compatible with more platforms, including Raspberry Pi, arm-64, x86-64.
Old version is below:
Table of contents:
- Setup the build environment
- Install packages
- Compile development libraries
- Install Python libraries
- Prepare source code
- Fetch git tags and prepare source tarballs
- Run the packaging script
- Test the built package
- Test a fresh install
- Test upgrading
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/
:
- pytz
- Django
- django-statici18n
- djangorestframework
- django_compressor
- jsonfield
- django-post_office
- gunicorn
- flup
- chardet
- python-dateutil
- six
- django-picklefield
- django-constance
- jdcal
- et_xmlfile
- openpyxl
- futures
- django-formtools
- qrcode
Install all these libaries to /home/pi/dev/seahub_thirdpart
:
cd ~/dev/seahub_thirdpart
export PYTHONPATH=.
pip install -t ~/dev/seahub_thirdpart/ /tmp/pytz-2016.1.tar.gz
pip install -t ~/dev/seahub_thirdpart/ /tmp/Django-1.8.10.tar.gz
pip install -t ~/dev/seahub_thirdpart/ /tmp/django-statici18n-1.1.3.tar.gz
pip install -t ~/dev/seahub_thirdpart/ /tmp/djangorestframework-3.3.2.tar.gz
pip install -t ~/dev/seahub_thirdpart/ /tmp/django_compressor-1.4.tar.gz
pip install -t ~/dev/seahub_thirdpart/ /tmp/jsonfield-1.0.3.tar.gz
pip install -t ~/dev/seahub_thirdpart/ /tmp/django-post_office-2.0.6.tar.gz
pip install -t ~/dev/seahub_thirdpart/ /tmp/gunicorn-19.4.5.tar.gz
pip install -t ~/dev/seahub_thirdpart/ /tmp/flup-1.0.2.tar.gz
pip install -t ~/dev/seahub_thirdpart/ /tmp/chardet-2.3.0.tar.gz
pip install -t ~/dev/seahub_thirdpart/ /tmp/python-dateutil-1.5.tar.gz
pip install -t ~/dev/seahub_thirdpart/ /tmp/six-1.9.0.tar.gz
pip install -t ~/dev/seahub_thirdpart/ /tmp/django-picklefield-0.3.2.tar.gz
wget -O /tmp/django_constance.zip https://github.com/haiwen/django-constance/archive/bde7f7c.zip
pip install -t ~/dev/seahub_thirdpart/ /tmp/django_constance.zip
pip install -t ~/dev/seahub_thirdpart/ /tmp/jdcal-1.2.tar.gz
pip install -t ~/dev/seahub_thirdpart/ /tmp/et_xmlfile-1.0.1.tar.gz
pip install -t ~/dev/seahub_thirdpart/ /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 alwaysv3.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
andseahub.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