Seafile 7.1.4 working on a docker swarm in rPi v4 - unofficial!

Hello,

Playing a little with docker I have been able to build and deploy successfully Seafile 7.1.4 in a raspberry pi v4.

The changes have been:

docker-compose.yml modified to use non official images and non official rPi seafile build image:

version: '3.0'
services:
  db:
    image: biarms/mysql:5.7.30-beta-travis
    environment:
      - PUID=1000
      - PGID=1000
      - MYSQL_ROOT_PASSWORD=db_dev  # Requested, set the root's password of MySQL service.
      - MYSQL_LOG_CONSOLE=true
    volumes:
      - /mnt/DISK/myfiles-mysql/db:/var/lib/mysql  # Requested, specifies the path to MySQL data persistent store.
    networks:
      - seafile-net
    deploy:
      placement:
        constraints:
          - "node.hostname==your-swarm-hostname"  #Force one node of the swarm to be the only one in which I can deploy the stack
      resources:
        limits:
          memory: 500M

  memcached:
    image: memcached:1.5.6
    entrypoint: memcached -m 256
    networks:
      - seafile-net
    deploy:
      placement:
        constraints:
          - "node.hostname==your-swarm-hostname"  #Force one node of the swarm to be the only one in which I can deploy the stack
      resources:
        limits:
          memory: 100M

  seafile:
    image: seafileltd/seafile-mc:7.1.4-rpi
    ports:
      - "80:80"
      - "443:443"  # If https is enabled, cancel the comment.
      - "8080:8080"
    volumes:
      - /mnt/DISK/myfiles:/shared   # Requested, specifies the path to Seafile data persistent store.
    environment:
      - DB_HOST=db
      - DB_USER_HOST=db
      - DB_ROOT_PASSWD=db_dev  # Requested, the value shuold be root's password of MySQL service.
      - TIME_ZONE=Etc/UTC  # Optional, default is UTC. Should be uncomment and set to your local time zone.
      - SEAFILE_SERVER_HOSTNAME=myfiles.duckdns.org # Specifies your host name if https is enabled.
      - SEAFILE_ADMIN_EMAIL=youremaile@gmail.com # Specifies Seafile admin user, default is 'me@example.com'.
      - SEAFILE_ADMIN_PASSWORD=yourpassword     # Specifies Seafile admin password, default is 'asecret'.
      - SEAFILE_SERVER_LETSENCRYPT=true   # Whether to use https or not.
    networks:
      - seafile-net
    depends_on:
      - db
      - memcached
    deploy:
      placement:
        constraints:
          - "node.hostname==your-swarm-hostname"  #Force one node of the swarm to be the only one in which I can deploy the stack
      resources:
        limits:
          memory: 500M

networks:
  seafile-net:

The changes in the github code to be able to generate the seafile image are in:
wilcome/seafile-docker
changes

If you want to build the image you should checkout , go to image folder and execute:

make server-rpi

Example of cli to start the stack in a docker swarm:

docker stack deploy -c docker-compose.yml seafile

1 Like

Hi,

Thank you for sharing your work !

I tried to make my docker image for PI too, but it didn’t work in the end. I was tired.
And then I saw your post. So I cloned you repo and compiled your image.

In fact, I have the same problem I already had with the image I made, but you said if worked for you.

So I don’t really understand…

This is my error:

*** Booting runit daemon…
*** Runit started as PID 6
*** Running /scripts/start.py…
*** /scripts/start.py exited with status 127.
runsv nginx: fatal: unable to start ./run: access denied
*** Shutting down runit daemon (PID 6)…
*** Running /etc/my_init.post_shutdown.d/10_syslog-ng.shutdown…
*** Killing all processes…

Do you perhaps have any idea why I would have this kind of error ?

Hi,

Give a little more context. You mean you were able to create the image, and when you execute the final step to deploy the 3 containers it fails. This mains that the seafile container give you this error? The other two keeps running?
could you give me the output of:

docker container ps -a

127 error code is seems to be something related with permissions. As the container has binds between host folders and internal folders, could you double check that the permisions and users are correct?

Hello mate,

Idk, we’re talking about the NGINX, and it’s not outside of the image, it’s inside. Even its (seafile) web pages. This is what I don’t understand.

But yes you understood well, I was able to compile your image based on the source you provided, and tried to launch it in a docker-compose on my raspberry pi v4.

I just tried again with the ‘/shared’ binded folder with 777 permissions, same error…

Concerning docker container ps -a :

Ok, I understand. In my case I have no 777 permissions but:

-rw------- 1 root root 4,0K jun 10 15:37 seafile.nginx.conf

I’m afraid it is not very good to have everything with root :frowning: but until now this is how I have it.

If you send me your seafile.nginx.conf I can compare with mine and check the differences just to be sure nothing strange is happening.

Also just to be sure, check in your rPi that no other process is using 80 or 443 port:

sudo netstat -pan | grep 443 
sudo netstat -pan | grep 80

To my understanding, the NGINX is in the docker image, and so is seafile.nginx.conf, isn’t it ?

So, as my container isn’t able to properly start the image, I cannot access the container, and thus cannot verify seafile.nginx.conf.

I indeed have a nginx directly on the raspberry pi (outside of any docker container, being a reverse proxy) and tried to disable it as to free the port. Anyway, I had it redirected to another outside port in the docker-compose file; didn’t work either way.

Here is my simple docker file :

version: '2.0'
services:
  ##
  # SEAFILE & DEPENDENCIES
  ##
  db:
    image: linuxserver/mariadb:latest
    container_name: seafile-mysql
    environment:
      - MYSQL_ROOT_PASSWORD=sqlPW # Requested, set the root's password of MySQL service
      - MYSQL_LOG_CONSOLE=true
    volumes:
      - /media/d2to/seafile/db:/var/lib/mysql # Requested, specifies the path to MySQL data persistent store.
    networks:
      - seafile-net

  memcached:
    image: memcached:1.5.6
    container_name: seafile-memcached
    entrypoint: memcached -m 256
    networks:
      - seafile-net
      
  seafile:
    image: seafileltd/seafile-mc:7.1.4-rpi
    container_name: seafile
    ports:
     - "6666:80"
     - "6667:8000" # seafile client ; connect with a client
     - "6668:8082" # seafhttp ; upload files from web portal
    volumes:
      - /media/d2to/seafile/files:/shared # Requested, specifies the path to Seafile data persistent store.
    environment:
      - DB_HOST=db
      - DB_ROOT_PASSWD=sqlPW                    # Requested, the value shuold be root's password of MySQL service.
      - TIME_ZONE=Etc/UTC                       # Optional, default is UTC. Should be uncomment and set to your local time zone.
      - SEAFILE_ADMIN_EMAIL=blab@posteo.net     # Specifies Seafile admin user, default is 'me@example.com'.
      - SEAFILE_ADMIN_PASSWORD=blabla           # Specifies Seafile admin password, default is 'asecret'.
#     - SEAFILE_SERVER_LETSENCRYPT=true         # Whether to use https or not.
      - SEAFILE_SERVER_HOSTNAME=bla.blab.blab   # Specifies your host name if https is enabled.
    depends_on:
      - db
      - memcached
    networks:
      - seafile-net

networks:
  seafile-net:

Only two folders are bound to /media/d2to/seafile/ *, they are different folders, I see that the containers succeeded in creating the sub folders, and I put the 777 permissions just in case.

I must have failed in compiling your image somehow (maybe compilation continued with some errors I wasn’t aware of). I don’t see any other possible reason.

Could you perhaps be so kind as to upload your image somewhere in tar.gz ?

Thank you mate.

Hi again,

I have this ones:

imagen

I sea you are using LETSENCRYPT=true I face with a problem with this because por 80 should be reachable from outside my network to let letsencrypt do its magic ( https://community.letsencrypt.org/t/certbot-auto-renewal-needs-port-80-to-be-enabled/106590/2 ) .

When I have time I will upload my image to my docker-hub account.

No I don’t use Let’s Encrypt, well not with the docker anyway : I have a nginx outside of docker as a reverse proxy, it’s the one with the ssl certs. I simply proxy-forward to any of my docker containers, without a need for them to individually implement httpS.

The line is there because it is suggested in one of the official docker-compose seafile images. But you can see the line has “#” at the beginning :).

Waiting for your image, thanks again mate.

Hi @Kynn,

Sorry for that. I was with my mobile phone and didn’t see the # . I have uploaded the image into my docker-hub repo. You can pull it as usual:

docker pull egorive/seafile-mc:7.1.4-rpi

Tell me if with this image it works or not.

Hi there,

It works, much thanks to you !

So here it goes:

  • there was something wrong with the way I compiled the image, since I had the same error with yours and my own image. I imagine a kind of unmet dependency or error which doesn’t stop compilation, but does disarrange the final result.
  • for anyone trying what I did, beware of mariadb on my docker-compose, I was unable to connect the seafile container to the database until I swapped the mariadb image for the mysql image @ego used for his own docker-compose.

I can now… rest in peace hahaha, thanks a lot mate, see you some other day.

1 Like

Hi @Kynn,

I’m glad to here that ! Enjoy it! I love this software! It’s very very stable and can manage lots of hundreds of files and nearly any sizing.

If anyone has also follow my steps and was lucky in the deployment it whould be nice to hear it. If we are many people using seafile-mc docker version in rPi., perhaps in the future it will come official ( I like to dream :stuck_out_tongue: )

Well why not :).

I personnally use seafile with mstream which is an audio streaming server ; for it I need seaf-fuse which allows mstream for browsing the music files ; so I will probably be modifying your image (or mine, but yours seems to be better written :)) in order to make it possible.