Build Seafile RPI 7.1.x with Seahub starting problems

  1. Launch images (Terminal 1)

    lxc launch images:<image-name> <container-name>
    

    1.a Build for armhf for 32 bit (armv7l):

    lxc launch images:ubuntu/21.04/armhf armhf-hirsute
    lxc launch images:ubuntu/20.04/armhf armhf-focal
    lxc launch images:ubuntu/18.04/armhf armhf-bionic
    
    lxc launch images:debian/11/armhf armhf-bullseye
    lxc launch images:debian/10/armhf armhf-buster
    lxc launch images:debian/9/armhf armhf-stretch
    

    1.b Build for arm64 for 64 bit (aarch64):

    lxc launch images:ubuntu/21.04/arm64 arm64-hirsute
    lxc launch images:ubuntu/20.04/arm64 arm64-focal
    lxc launch images:ubuntu/18.04/arm64 arm64-bionic
    
    lxc launch images:debian/11/arm64 arm64-bullseye
    lxc launch images:debian/10/arm64 arm64-buster
    lxc launch images:debian/9/arm64 arm64-stretch
    

    Optionally can start or stop container with:

    lxc start <container-name>
    lxc stop <container-name>
    
  2. Do for each container:

    Start another terminal (Terminal 2)!

    2.1 Log in container (Terminal 2)

    lxc exec <container-name> -- /bin/bash
    

    2.2 If no internet connection / change domain name system (Terminal 2)

    vim /etc/netplan/10-lxc.yaml
    Then add:

    eth0:
       nameservers:
           addresses: [8.8.8.8, 8.8.4.4]
    

    Then netplan apply

    2.3 Install missing dependencies (Terminal 2)

    apt install sudo // If not installed
    

    2.4 Add seafile user (Terminal 2)

    useradd -m -s /bin/bash seafile
    visudo
    

    Add the line:

    seafile ALL=(ALL) NOPASSWD: ALL
    

    Change visudo with commands: Insert-Key to edit, Esc to exit edit mode, :w to save, :q to quit.

    2.5 Push build file to container (Terminal 1)

    lxc file push build.sh <container-name>/home/seafile/
    

    For stretch remove this string from build.sh beforehand or edit with vim:

    --no-warn-script-location
    

    2.6 Run build (Terminal 2)

    su - seafile
    time bash ./build.sh -D -A -v 9.0.1
    

    Wait for build to finish…

    If no success sudo bash ./build.sh -D -A -v 9.0.1

    2.7 Download the built package (Terminal 1)

    lxc file pull <container-name>/home/seafile/built-seafile-server-pkgs/seafile-server-9.0.1-<distro-name>-<architecture>.tar.gz ./
    
  3. To clean the distro containers and images run (Terminal 1):

    lxc list
    lxc delete <container-name>
    
    lxc image list
    lxc image delete <image-fingerprint>
    
  4. Test and fix your build

    4.1 Start seafile and seahub

    tar -xf seafile-server-9.0.1-<distro-name>-<architecture>.tar.gz -C ./
    

    For debugging, set daemon = False in conf/gunicorn.conf.py

    seafile-server-latest/seafile.sh start
    seafile-server-latest/seahub.sh start
    

    4.2 Fix bugs

    If you get the error ModuleNotFoundError: No module named 'Image' most likely in (stretch and bionic), you have to install pillow again (see here):

    pip3 install -U Pillow -t ./seafile-server-9.0.1/seahub/thirdpart
    
2 Likes