This is a port of Seafile for OpenWRT release 14.07 (Barrier Breaker).
NOTE: Packages in this repository are for Barrier Breaker only. Package definitions to be used with the development branch are now merged to Openwrt's official packages repository.
WARNING: Packages here are not regularly updated. Sorry guys, I don't have the time to keep stuffs here updated along with the version merged to the development branch. If you want to use the latest version of Seafile, please consider installing a snapshot image of Openwrt on your device. That way, you can have Seafile up and running as simple as running the command "opkg update && opkg install seafile-server" from a root shell.
This project was created to be able to run Seafile on OpenWRT-based devices (routers primarily). Some routers and other OpenWRT-compatible consumer devices are now fast enough and have enough memory to host a Seafile server. This makes it possible to conveniently store your personal files at a central location, just like in the cloud, but hosted in your own home. This enables to enjoy the benefits of cloud storage while keeping (physical) control over your data and retain your privacy. Also, having the possibility to run Seafile on your router eliminates the need to run a server machine in your home.
It can be considered as completed now (see "Known issues"), although it might need some long-run stability testing and maybe some performance optimization.
-
Any modern router or other networking device supported by OpenWrt. There's no minimum requirement on the CPU model or frequency - the faster the better, as always.
-
You need to have about 100 MB of non-volatile storage on your router to install the packages. It's advised to set up an extroot configuration using a USB stick or a portable hard disk.
-
Seahub, the web interface of Seafile consumes a lot of memory. Make sure your router has at least 128 MB of RAM and some additional swap space (optional but highly recommended) before installing and starting Seafile server.
- Checkout all the files from here to a directory of your choice
- Checkout and initialize the buildroot of the Barrier Breaker branch of OpenWRT as per the instructions on the OpenWrt Buildroot – Usage page. Use the link "git://git.openwrt.org/14.07/openwrt.git" to fetch the appropriate buildroot from Git.
- Within OpenWRT's buildroot, open the file feeds.conf.default in an editor
- Append the line below to the file, specifying the path where the contents of this repository have been checked out:
src-link seafile [path-to-checked-out-files]
- Update feed information and install packages to the menuconfig interface:
./scripts/feeds update -a
./scripts/feeds install -a
- Run make menuconfig and configure the environment as per your needs (make sure to select the correct platform for your router model!):
make menuconfig
- Start building a default image of OpenWRT. Cross-compiling consumes a lot of CPU and memory resources so be prepared that this will take a lot of time (anywhere between 20 - 50 minutes, on slower machines it might be even more). You can optimize the build process using make's '-j' option to use multiple CPU cores simultaneously, eg. 'make -j 5' might be a good choice for a quad-core machine.
make defconfig && make
-
Run
make menuconfig
and selectNetwork -> seafile-server
to be built as a package ('M' marker). This will also make all the required dependencies compiled. -
Finally, start the packaging process:
make package/seafile-server/{clean,compile}
- Once done, you'll find the packages in './bin/(platform)/packages/seafile' ready to be installed on your router.
To install or update the packages, you need to copy the package files to a directory accessible by your router along with a package index file. To do so, copy the script 'deploy-to-router.sh' to the directory holding the generated packages and set your router's IP address and the local path on the router that should hold the repository's files (scp parameters). Once done, run the script to have the files copied to the router.
To make opkg aware of your custom package repository, append the lines below to /etc/opkg.conf on your router (change paths as appropriate):
dest ext /mnt/sda1/extroot
src/gz seafile file:///mnt/sda1/packages/seafile
If you want to install the packages to an external location other than the / (root) directory, issue the following commands on your router (set the value of IPKG_INSTROOT so that it points to the desired destination directory):
opkg install shadow-useradd bash libncurses sudo procps procps-pkill
IPKG_INSTROOT=/mnt/sda1/extroot opkg -d ext install seafile-server
IMPORTANT: packages listed in the first command must be installed to the default root directory, otherwise they won't function correctly!
The fileserver daemon does not accept file uploads from Seahub because CORS is not working as expected (400 Bad request returned instead of 200 OK)FIXED!- Building the packages using multiple jobs ("make -jX") sometimes fails - restarting the build or allowing only one job ("make -j1") solves the problem
- Seahub is pretty slow - some additional optimizations might be needed if possible
- Installing Seafile and its dependencies to a custom root directory might cause strange issues. To avoid making the port too complex, I've removed this feature from the development branch. You might want to take a look at the extroot howto if your router doesn't have enough flash memory but has a USB port - a recently commited patch makes it possible to use this feature on devices utilizng NAND flash memory.
- The default installation of Seahub is insecure as it provides a plain HTTP interface which makes it easy to collect user passwords by eavesdropping network traffic. It's highly recommended to switch to fastcgi mode and configure an HTTPS connection. Nginx is a great choice for embedded devices as it has very low resource requirements compared to other implementations but you can use any other web server supporting HTTPS provided that you know how to configure it. Unfortunately, the default build of nginx does not have the HTTPS module compiled in, therefore you'll need to build your own version if you want to have HTTPS support included. To do so, just select the "Enable SSL module" option in nginx's build configuration within the make menuconfig interface, build the package and install the resulting .ipk file on your router.