From 79a58b200db72de4968de2dd62cc08958a9cfe8b Mon Sep 17 00:00:00 2001 From: "flow.gunso" Date: Thu, 18 Apr 2019 17:12:13 +0200 Subject: [PATCH 1/6] Update the usage from previous changes in v1.1.0 to v1.1.2 --- README.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 7851453..ed8ac59 100644 --- a/README.md +++ b/README.md @@ -44,12 +44,13 @@ Docker Seafile Client allow you to sync a Seafile library within a container. # Usage -The *Seafile* daemon is running from `/.seafile/` and `~/.ccnet`. +The *Seafile* daemon is running as the user `seafuser` from it's directories `~/.seafile/` and `~/.ccnet`. + The library is synced at `/volume/`. The *Seafile* daemon is managed with *supervisord* since it can't run as a foreground process. -The *supervisord* is running from `/.supervisord/`, the `supervisord.conf`, `supervisord.log` and `supervisord.pid` can be found there. -*supervisord* also manage a shell script, `/infinite-seaf-cli-start.sh` which run `seaf-cli start` every hour: the synchronisation might not work properly if `seaf-cli start` is not run from times to times, for an unresolved reason. +The *supervisord* is running from `~/.supervisord/`, the `supervisord.conf`, `supervisord.log` and `supervisord.pid` can be found there. +*supervisord* also manage a shell script, `~/infinite-seaf-cli-start.sh` which stop then start the Seafile daemon every 20 minutes: the synchronisation might not work properly if the Seafile daemon is not restarted from times to times, for an unresolved reason. ## Examples You would have to share the path `/volume/` to other containers, with the following approaches: ### Docker CLI From 8a79d04d8c30255e3ab7b11bac2ff3da46fc0f9e Mon Sep 17 00:00:00 2001 From: "flow.gunso" Date: Fri, 19 Apr 2019 13:46:37 +0200 Subject: [PATCH 2/6] Explicitly add a probable issue to follow up --- assets/docker-entrypoint.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets/docker-entrypoint.sh b/assets/docker-entrypoint.sh index 23906f8..d7460f5 100644 --- a/assets/docker-entrypoint.sh +++ b/assets/docker-entrypoint.sh @@ -25,7 +25,7 @@ if [ -z $SEAF_LIBRARY_UUID ]; then echo "The \$SEAF_LIBRARY_UUID was not defined # Update the user ID, if the $UID changed. if [ "$UID" != "1000" ]; then usermod -u $UID $UNAME - # What if the $UID already exists ? + # TODO: What if the $UID already exists ? fi # Change the group, if the $GID changed. From a98cc3fe4ff07ea42b6c85b7a3569022e4ca52c6 Mon Sep 17 00:00:00 2001 From: "flow.gunso" Date: Fri, 19 Apr 2019 13:47:11 +0200 Subject: [PATCH 3/6] Add a license header and some description --- .../update-docker-hub-full-description.sh | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/utils/publish/update-docker-hub-full-description.sh b/utils/publish/update-docker-hub-full-description.sh index 50908df..670eb53 100644 --- a/utils/publish/update-docker-hub-full-description.sh +++ b/utils/publish/update-docker-hub-full-description.sh @@ -1,8 +1,27 @@ #!/bin/bash +# Docker Seafile client, help you mount a Seafile library as a volume. +# Copyright (C) 2019, flow.gunso@gmail.com +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + # Based upon https://gist.github.com/jlhawn/8f218e7c0b14c941c41f # and https://github.com/moikot/golang-dep/blob/master/.travis/push.sh +# This action can only be done with the actual owner of the repository, +# unless you can extend the collaborator's permissions but as far as I know, you can't. + # Install required system packages. apk add curl jq From 1a44140556cabf2506833af844e0816cbd51baca Mon Sep 17 00:00:00 2001 From: "flow.gunso" Date: Wed, 24 Apr 2019 11:06:53 +0200 Subject: [PATCH 4/6] Rename infinite-seaf-cli-start.sh into seafile-healthcheck.sh --- Dockerfile | 2 +- assets/{infinite-seaf-cli-start.sh => seafile-healthcheck.sh} | 0 assets/supervisord.conf | 2 +- 3 files changed, 2 insertions(+), 2 deletions(-) rename assets/{infinite-seaf-cli-start.sh => seafile-healthcheck.sh} (100%) diff --git a/Dockerfile b/Dockerfile index 56d653f..9f3e528 100644 --- a/Dockerfile +++ b/Dockerfile @@ -53,7 +53,7 @@ COPY assets/docker-entrypoint.sh /entrypoint.sh # Copy over the required files for Seafile/SupervisorD. COPY assets/supervisord.conf /home/seafuser/ -COPY assets/infinite-seaf-cli-start.sh /home/seafuser/ +COPY assets/seaf-healthcheck.sh /home/seafuser/ COPY assets/seafile-entrypoint.sh /home/seafuser/entrypoint.sh RUN mkdir /volume diff --git a/assets/infinite-seaf-cli-start.sh b/assets/seafile-healthcheck.sh similarity index 100% rename from assets/infinite-seaf-cli-start.sh rename to assets/seafile-healthcheck.sh diff --git a/assets/supervisord.conf b/assets/supervisord.conf index 560c374..c5425ee 100644 --- a/assets/supervisord.conf +++ b/assets/supervisord.conf @@ -24,7 +24,7 @@ file=~/.seafile/seafile-data/seafile.sock # Manage the infinite `seaf-cli start`. [program:seaf-cli-start-loop] -command=/bin/bash /home/seafuser/infinite-seaf-cli-start.sh +command=/bin/bash /home/seafuser/seaf-healthcheck.sh process_name=%(program_name)s numprocs=1 autostart=true From 33a93d7bc200395c4001a138a8d8b206f5980b60 Mon Sep 17 00:00:00 2001 From: "flow.gunso" Date: Wed, 24 Apr 2019 11:07:41 +0200 Subject: [PATCH 5/6] Improve with support for libraries status that prevent restarts --- assets/seafile-healthcheck.sh | 31 ++++++++++++++++++++++++++----- 1 file changed, 26 insertions(+), 5 deletions(-) diff --git a/assets/seafile-healthcheck.sh b/assets/seafile-healthcheck.sh index dc7abb6..16f60d4 100755 --- a/assets/seafile-healthcheck.sh +++ b/assets/seafile-healthcheck.sh @@ -16,11 +16,32 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -set -x +# `seaf-cli status` output csv-like information with tabulates as separators and columns named in comment lines. +# The Seafile client should not be restarted while some statuses are occuring, such as "downloading" or "committing". +# +# This script grabs the output while ignoring the comments to iterate over the informations set to their columns, +# then it compares the statuses, when not empty, to the ones that do not require a restart. Finally either restart or don't. -sleep 10 +seaf=/usr/bin/seaf-cli +dont_restart_on=("downloading" "committing" "waiting for sync") +restart=true + +sleep 10s while true; do - /usr/bin/seaf-cli stop - /usr/bin/seaf-cli start - sleep 1200 + while IFS=$'\t' read -r name status progress; do + if [ $status ]; then + for dont_restart_on_status in "${dont_restart_on[@]}"; do + if [ "$status" == "$dont_restart_on_status" ]; then + restart=false; break; break + fi + done + fi + done < <($seaf status | grep -v "^#") + + if $restart; then + $seaf stop + $seaf start + fi + + sleep 10m done \ No newline at end of file From cbb2b84e774f6c0f32e5f238c0cca075f125a098 Mon Sep 17 00:00:00 2001 From: "flow.gunso" Date: Thu, 25 Apr 2019 15:41:33 +0200 Subject: [PATCH 6/6] Fix the healthcheck script path --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 9f3e528..856e45b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -53,7 +53,7 @@ COPY assets/docker-entrypoint.sh /entrypoint.sh # Copy over the required files for Seafile/SupervisorD. COPY assets/supervisord.conf /home/seafuser/ -COPY assets/seaf-healthcheck.sh /home/seafuser/ +COPY assets/seafile-healthcheck.sh /home/seafuser/ COPY assets/seafile-entrypoint.sh /home/seafuser/entrypoint.sh RUN mkdir /volume