From c6039412427e94592838728eff8b5583f40e7106 Mon Sep 17 00:00:00 2001 From: "flow.gunso" Date: Tue, 9 Apr 2019 10:38:09 +0200 Subject: [PATCH 01/40] Add a script to change files ownership --- assets/change-ownership.sh | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 assets/change-ownership.sh diff --git a/assets/change-ownership.sh b/assets/change-ownership.sh new file mode 100644 index 0000000..5d3e590 --- /dev/null +++ b/assets/change-ownership.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +if [ -z $UID ] && [ -z $GID ]; then + groupadd -g $GID -o $UNAME ;\ + useradd -m -u $UID -g $GID -o -s /bin/bash $UNAME ;\ + chown $UID.$GID -R /.seafile ;\ + chown $UID.$GID -R /.supervisord ;\ + chown $UID.$GID -R /volume ;\ + chown $UID.$GID /entrypoint.sh ;\ + chown $UID.$GID /infinite-seaf-cli-start.sh +else + echo "\$UID and \$GID environment variables are required to update files ownership." +fi \ No newline at end of file From 4c527f4aa4663005634c1a5c55211d954d70f677 Mon Sep 17 00:00:00 2001 From: "flow.gunso" Date: Tue, 9 Apr 2019 10:39:57 +0200 Subject: [PATCH 02/40] Copy @c6039412427e94592838728eff8b5583f40e7106 into the container and run it --- Dockerfile | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/Dockerfile b/Dockerfile index 830b31e..6aba8c6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -28,6 +28,7 @@ RUN mkdir /.seafile ;\ COPY assets/seafile.list /etc/apt/sources.list.d/ COPY assets/supervisord.conf /.supervisord/ COPY assets/infinite-seaf-cli-start.sh / +COPY assets/change-ownership.sh / COPY entrypoint.sh / # Safely import Seafile APT key, then install both seafile-cli and supervisord. @@ -41,13 +42,7 @@ RUN rm -f /import-seafile-apt-key.sh ENV UNAME=seafuser ENV UID=1000 ENV GID=1000 -RUN groupadd -g $GID -o $UNAME ;\ - useradd -m -u $UID -g $GID -o -s /bin/bash $UNAME ;\ - chown $UID.$GID -R /.seafile ;\ - chown $UID.$GID -R /.supervisord ;\ - chown $UID.$GID -R /volume ;\ - chown $UID.$GID /entrypoint.sh ;\ - chown $UID.$GID /infinite-seaf-cli-start.sh +RUN /bin/bash /change-ownership.sh USER $UNAME ENTRYPOINT ["/bin/bash", "/entrypoint.sh"] \ No newline at end of file From 3b528f1b122994979f0b2fb43f29aaa2c3c8af2d Mon Sep 17 00:00:00 2001 From: "flow.gunso" Date: Tue, 9 Apr 2019 10:40:18 +0200 Subject: [PATCH 03/40] Update files ownership at entrypoint using @c6039412427e94592838728eff8b5583f40e7106 --- entrypoint.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/entrypoint.sh b/entrypoint.sh index 3cec95b..67298f9 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -29,6 +29,8 @@ supervisord_conf=/.supervisord/supervisord.conf supervisord_pid=/.supervisord/supervisord.pid supervisord_log=/.supervisord/supervisord.log +# Update the file ownership. +/bin/bash /change-ownership.sh # Safely initialize Seafile. /usr/bin/seaf-cli init -d /.seafile while [ ! -f $seafile_ini ]; do sleep 1; done From 891d34aad168862120ef7e55fe14327e6594e9e4 Mon Sep 17 00:00:00 2001 From: "flow.gunso" Date: Tue, 9 Apr 2019 11:46:40 +0200 Subject: [PATCH 04/40] UID and GID are always set --- assets/change-ownership.sh | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/assets/change-ownership.sh b/assets/change-ownership.sh index 5d3e590..9b7c77d 100644 --- a/assets/change-ownership.sh +++ b/assets/change-ownership.sh @@ -1,13 +1,9 @@ #!/bin/bash -if [ -z $UID ] && [ -z $GID ]; then - groupadd -g $GID -o $UNAME ;\ - useradd -m -u $UID -g $GID -o -s /bin/bash $UNAME ;\ - chown $UID.$GID -R /.seafile ;\ - chown $UID.$GID -R /.supervisord ;\ - chown $UID.$GID -R /volume ;\ - chown $UID.$GID /entrypoint.sh ;\ - chown $UID.$GID /infinite-seaf-cli-start.sh -else - echo "\$UID and \$GID environment variables are required to update files ownership." -fi \ No newline at end of file +groupadd -g $GID -o $UNAME ;\ +useradd -m -u $UID -g $GID -o -s /bin/bash $UNAME ;\ +chown $UID.$GID -R /.seafile ;\ +chown $UID.$GID -R /.supervisord ;\ +chown $UID.$GID -R /volume ;\ +chown $UID.$GID /entrypoint.sh ;\ +chown $UID.$GID /infinite-seaf-cli-start.sh From 10b4eda111a292ea2afc59cf96ed531d338c1ecf Mon Sep 17 00:00:00 2001 From: "flow.gunso" Date: Tue, 9 Apr 2019 11:48:24 +0200 Subject: [PATCH 05/40] Don't change ownership at build time, allow all to execute the entrypoint --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 6aba8c6..831702b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -30,6 +30,7 @@ COPY assets/supervisord.conf /.supervisord/ COPY assets/infinite-seaf-cli-start.sh / COPY assets/change-ownership.sh / COPY entrypoint.sh / +RUN chmod 777 /entrypoint.sh # Safely import Seafile APT key, then install both seafile-cli and supervisord. COPY utils/build/import-seafile-apt-key.sh / @@ -42,7 +43,6 @@ RUN rm -f /import-seafile-apt-key.sh ENV UNAME=seafuser ENV UID=1000 ENV GID=1000 -RUN /bin/bash /change-ownership.sh USER $UNAME ENTRYPOINT ["/bin/bash", "/entrypoint.sh"] \ No newline at end of file From 4bc58a0927631c4e3c328b4a185fe8829309eb7d Mon Sep 17 00:00:00 2001 From: "flow.gunso" Date: Tue, 9 Apr 2019 11:59:56 +0200 Subject: [PATCH 06/40] Creathe the user at build time --- Dockerfile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Dockerfile b/Dockerfile index 831702b..1a2d53e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -43,6 +43,8 @@ RUN rm -f /import-seafile-apt-key.sh ENV UNAME=seafuser ENV UID=1000 ENV GID=1000 +RUN groupadd -g $GID -o $UNAME ;\ + useradd -m -u $UID -g $GID -o -s /bin/bash $UNAME USER $UNAME ENTRYPOINT ["/bin/bash", "/entrypoint.sh"] \ No newline at end of file From 8a0225edeb8f277adf29b4c4fa8b94859714b2bc Mon Sep 17 00:00:00 2001 From: "flow.gunso" Date: Tue, 9 Apr 2019 12:00:42 +0200 Subject: [PATCH 07/40] Update user/groud ID, fix the script --- assets/change-ownership.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/assets/change-ownership.sh b/assets/change-ownership.sh index 9b7c77d..a18b6b6 100644 --- a/assets/change-ownership.sh +++ b/assets/change-ownership.sh @@ -1,9 +1,9 @@ #!/bin/bash -groupadd -g $GID -o $UNAME ;\ -useradd -m -u $UID -g $GID -o -s /bin/bash $UNAME ;\ -chown $UID.$GID -R /.seafile ;\ -chown $UID.$GID -R /.supervisord ;\ -chown $UID.$GID -R /volume ;\ -chown $UID.$GID /entrypoint.sh ;\ +groupmod -u $GID $UNAME +usermod -u $UID $UNAME +chown $UID.$GID -R /.seafile +chown $UID.$GID -R /.supervisord +chown $UID.$GID -R /volume +chown $UID.$GID /entrypoint.sh chown $UID.$GID /infinite-seaf-cli-start.sh From 9d986aa086e94bce473d13569dd29579019b1c5f Mon Sep 17 00:00:00 2001 From: "flow.gunso" Date: Tue, 9 Apr 2019 12:28:30 +0200 Subject: [PATCH 08/40] Drop the change-ownership script --- Dockerfile | 1 - 1 file changed, 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 1a2d53e..f4b03ea 100644 --- a/Dockerfile +++ b/Dockerfile @@ -28,7 +28,6 @@ RUN mkdir /.seafile ;\ COPY assets/seafile.list /etc/apt/sources.list.d/ COPY assets/supervisord.conf /.supervisord/ COPY assets/infinite-seaf-cli-start.sh / -COPY assets/change-ownership.sh / COPY entrypoint.sh / RUN chmod 777 /entrypoint.sh From 6c6737c716f07f045d9859ab3bce50c661d54b7f Mon Sep 17 00:00:00 2001 From: "flow.gunso" Date: Tue, 9 Apr 2019 12:28:47 +0200 Subject: [PATCH 09/40] Run as container user, change files ownership --- entrypoint.sh | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/entrypoint.sh b/entrypoint.sh index 67298f9..78e4ade 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -30,14 +30,24 @@ supervisord_pid=/.supervisord/supervisord.pid supervisord_log=/.supervisord/supervisord.log # Update the file ownership. -/bin/bash /change-ownership.sh +groupmod -u $GID $UNAME +usermod -u $UID $UNAME +chown $UID.$GID -R /.seafile +chown $UID.$GID -R /.supervisord +chown $UID.$GID -R /volume +chown $UID.$GID /entrypoint.sh +chown $UID.$GID /infinite-seaf-cli-start.sh + # Safely initialize Seafile. -/usr/bin/seaf-cli init -d /.seafile +su - $UNAME -H -c /usr/bin/seaf-cli init -d /.seafile while [ ! -f $seafile_ini ]; do sleep 1; done + # Safely start the Seafile daemon. -/usr/bin/seaf-cli start +su - $UNAME -H -c /usr/bin/seaf-cli start while [ ! -S $seafile_sock ]; do sleep 1; done + # Start the synchronisation. -/usr/bin/seaf-cli sync -u $SEAF_USERNAME -p $SEAF_PASSWORD -s $SEAF_SERVER_URL -l $SEAF_LIBRARY_UUID -d /volume +su - $UNAME -H -c /usr/bin/seaf-cli sync -u $SEAF_USERNAME -p $SEAF_PASSWORD -s $SEAF_SERVER_URL -l $SEAF_LIBRARY_UUID -d /volume + # Start the supervisord. -/usr/bin/supervisord -u $UNAME -c $supervisord_conf -j $supervisord_pid -l $supervisord_log \ No newline at end of file +su - $UNAME -H -c /usr/bin/supervisord -u $UNAME -c $supervisord_conf -j $supervisord_pid -l $supervisord_log \ No newline at end of file From db08e076c6999960acdd452014c99e4279c9c675 Mon Sep 17 00:00:00 2001 From: "flow.gunso" Date: Tue, 9 Apr 2019 12:40:56 +0200 Subject: [PATCH 10/40] Fix the group ID change --- entrypoint.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/entrypoint.sh b/entrypoint.sh index 78e4ade..ea1255a 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -30,8 +30,8 @@ supervisord_pid=/.supervisord/supervisord.pid supervisord_log=/.supervisord/supervisord.log # Update the file ownership. -groupmod -u $GID $UNAME usermod -u $UID $UNAME +groupmod -g $GID $UNAME chown $UID.$GID -R /.seafile chown $UID.$GID -R /.supervisord chown $UID.$GID -R /volume From 502d2d13a62f01aac0afaf4bc39cda3556835e43 Mon Sep 17 00:00:00 2001 From: "flow.gunso" Date: Tue, 9 Apr 2019 12:48:55 +0200 Subject: [PATCH 11/40] Remove the invalid H option with su --- entrypoint.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/entrypoint.sh b/entrypoint.sh index ea1255a..9468cd0 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -39,15 +39,15 @@ chown $UID.$GID /entrypoint.sh chown $UID.$GID /infinite-seaf-cli-start.sh # Safely initialize Seafile. -su - $UNAME -H -c /usr/bin/seaf-cli init -d /.seafile +su - $UNAME -c /usr/bin/seaf-cli init -d /.seafile while [ ! -f $seafile_ini ]; do sleep 1; done # Safely start the Seafile daemon. -su - $UNAME -H -c /usr/bin/seaf-cli start +su - $UNAME -c /usr/bin/seaf-cli start while [ ! -S $seafile_sock ]; do sleep 1; done # Start the synchronisation. -su - $UNAME -H -c /usr/bin/seaf-cli sync -u $SEAF_USERNAME -p $SEAF_PASSWORD -s $SEAF_SERVER_URL -l $SEAF_LIBRARY_UUID -d /volume +su - $UNAME -c /usr/bin/seaf-cli sync -u $SEAF_USERNAME -p $SEAF_PASSWORD -s $SEAF_SERVER_URL -l $SEAF_LIBRARY_UUID -d /volume # Start the supervisord. -su - $UNAME -H -c /usr/bin/supervisord -u $UNAME -c $supervisord_conf -j $supervisord_pid -l $supervisord_log \ No newline at end of file +su - $UNAME -c /usr/bin/supervisord -u $UNAME -c $supervisord_conf -j $supervisord_pid -l $supervisord_log \ No newline at end of file From 5a7e2a6775cb453f9ae01620e45afd2b6501b8cd Mon Sep 17 00:00:00 2001 From: "flow.gunso" Date: Tue, 9 Apr 2019 13:39:58 +0200 Subject: [PATCH 12/40] Actually exit when env vars are missing --- entrypoint.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/entrypoint.sh b/entrypoint.sh index 9468cd0..d4a5fbf 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -17,10 +17,10 @@ # along with this program. If not, see . # Check mandatory Seafile configuration have been properly set. -if [ -z $SEAF_SERVER_URL ]; then echo "The \$SEAF_SERVER_URL was not defined. Stopping container..."; echo 1; fi -if [ -z $SEAF_USERNAME ]; then echo "The \$SEAF_USERNAME was not defined. Stopping container..."; echo 1; fi -if [ -z $SEAF_PASSWORD ]; then echo "The \$SEAF_PASSWORD was not defined. Stopping container..."; echo 1; fi -if [ -z $SEAF_LIBRARY_UUID ]; then echo "The \$SEAF_LIBRARY_UUID was not defined. Stopping container..."; echo 1; fi +if [ -z $SEAF_SERVER_URL ]; then echo "The \$SEAF_SERVER_URL was not defined. Stopping container..."; exit 1; fi +if [ -z $SEAF_USERNAME ]; then echo "The \$SEAF_USERNAME was not defined. Stopping container..."; exit 1; fi +if [ -z $SEAF_PASSWORD ]; then echo "The \$SEAF_PASSWORD was not defined. Stopping container..."; exit 1; fi +if [ -z $SEAF_LIBRARY_UUID ]; then echo "The \$SEAF_LIBRARY_UUID was not defined. Stopping container..."; exit 1; fi # Define variable shortcuts for readability purposes. seafile_ini=~/.ccnet/seafile.ini From e78b76550fe85246fba38eabf4c519973b515921 Mon Sep 17 00:00:00 2001 From: "flow.gunso" Date: Tue, 9 Apr 2019 13:40:21 +0200 Subject: [PATCH 13/40] Move the USER parameter after the ENTRYPOINT --- Dockerfile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index f4b03ea..7bc93b1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -44,6 +44,7 @@ ENV UID=1000 ENV GID=1000 RUN groupadd -g $GID -o $UNAME ;\ useradd -m -u $UID -g $GID -o -s /bin/bash $UNAME -USER $UNAME -ENTRYPOINT ["/bin/bash", "/entrypoint.sh"] \ No newline at end of file +ENTRYPOINT ["/bin/bash", "/entrypoint.sh"] + +USER $UNAME From 303b387869e5b0314bebeae14e733b1b5b3e3ca7 Mon Sep 17 00:00:00 2001 From: "flow.gunso" Date: Tue, 9 Apr 2019 13:51:47 +0200 Subject: [PATCH 14/40] Remove overriding the user in favor of root --- Dockerfile | 2 -- 1 file changed, 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 7bc93b1..7e82c06 100644 --- a/Dockerfile +++ b/Dockerfile @@ -46,5 +46,3 @@ RUN groupadd -g $GID -o $UNAME ;\ useradd -m -u $UID -g $GID -o -s /bin/bash $UNAME ENTRYPOINT ["/bin/bash", "/entrypoint.sh"] - -USER $UNAME From 8a66e3993d1604d8e0547c5206cb81e28ee9e4ff Mon Sep 17 00:00:00 2001 From: "flow.gunso" Date: Tue, 9 Apr 2019 14:13:51 +0200 Subject: [PATCH 15/40] Fix the user/group ID changes, fix the su -c command calls --- entrypoint.sh | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/entrypoint.sh b/entrypoint.sh index d4a5fbf..a94ec8d 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -29,9 +29,22 @@ supervisord_conf=/.supervisord/supervisord.conf supervisord_pid=/.supervisord/supervisord.pid supervisord_log=/.supervisord/supervisord.log -# Update the file ownership. -usermod -u $UID $UNAME -groupmod -g $GID $UNAME +# Update the user ID, if the $UID changed. +if [ "$UID" != "1000" ]; then + usermod -u $UID $UNAME + # What the $UID already exists ? +fi +# Change the group, if the $GID changed. +if [ "$GID" != "1000" ]; then + getent group | grep ":$GID:" + if [ $? -eq 0 ]; then + groupmod -g $GID $UNAME + else + usermod -g $UID -G $GID $UNAME + fi +fi + +# Set the files ownership. chown $UID.$GID -R /.seafile chown $UID.$GID -R /.supervisord chown $UID.$GID -R /volume @@ -39,15 +52,15 @@ chown $UID.$GID /entrypoint.sh chown $UID.$GID /infinite-seaf-cli-start.sh # Safely initialize Seafile. -su - $UNAME -c /usr/bin/seaf-cli init -d /.seafile +su - $UNAME -c "/usr/bin/seaf-cli init -d /.seafile" while [ ! -f $seafile_ini ]; do sleep 1; done # Safely start the Seafile daemon. -su - $UNAME -c /usr/bin/seaf-cli start +su - $UNAME -c "/usr/bin/seaf-cli start" while [ ! -S $seafile_sock ]; do sleep 1; done # Start the synchronisation. -su - $UNAME -c /usr/bin/seaf-cli sync -u $SEAF_USERNAME -p $SEAF_PASSWORD -s $SEAF_SERVER_URL -l $SEAF_LIBRARY_UUID -d /volume +su - $UNAME -c "/usr/bin/seaf-cli sync -u $SEAF_USERNAME -p $SEAF_PASSWORD -s $SEAF_SERVER_URL -l $SEAF_LIBRARY_UUID -d /volume" # Start the supervisord. -su - $UNAME -c /usr/bin/supervisord -u $UNAME -c $supervisord_conf -j $supervisord_pid -l $supervisord_log \ No newline at end of file +su - $UNAME -c "/usr/bin/supervisord -u $UNAME -c $supervisord_conf -j $supervisord_pid -l $supervisord_log" \ No newline at end of file From 99687759278969e0280cc9c51af036a641b22877 Mon Sep 17 00:00:00 2001 From: "flow.gunso" Date: Tue, 9 Apr 2019 14:23:24 +0200 Subject: [PATCH 16/40] Invert group modification, redirect getent query to /dev/null --- entrypoint.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/entrypoint.sh b/entrypoint.sh index a94ec8d..c32a7d3 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -36,11 +36,11 @@ if [ "$UID" != "1000" ]; then fi # Change the group, if the $GID changed. if [ "$GID" != "1000" ]; then - getent group | grep ":$GID:" - if [ $? -eq 0 ]; then - groupmod -g $GID $UNAME + getent group | grep ":$GID:" &>/dev/null + if [ $? -eq 1 ]; then + usermod -g $GID -G 1000 $UNAME else - usermod -g $UID -G $GID $UNAME + groupmod -g $GID $UNAME fi fi From 1f4b0653b9d6bfc4130fc9f0066f15f84b939fe7 Mon Sep 17 00:00:00 2001 From: "flow.gunso" Date: Tue, 9 Apr 2019 14:38:20 +0200 Subject: [PATCH 17/40] Only redirect stdout, fix existing group detection --- entrypoint.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/entrypoint.sh b/entrypoint.sh index c32a7d3..433f8f0 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -36,8 +36,8 @@ if [ "$UID" != "1000" ]; then fi # Change the group, if the $GID changed. if [ "$GID" != "1000" ]; then - getent group | grep ":$GID:" &>/dev/null - if [ $? -eq 1 ]; then + getent group | grep ":$GID:" >/dev/null + if [ $? -eq 0 ]; then usermod -g $GID -G 1000 $UNAME else groupmod -g $GID $UNAME From e2fcfcee053017c93675f98e80a9ae8327889770 Mon Sep 17 00:00:00 2001 From: "flow.gunso" Date: Tue, 9 Apr 2019 15:00:11 +0200 Subject: [PATCH 18/40] Drop the script now useless --- assets/change-ownership.sh | 9 --------- 1 file changed, 9 deletions(-) delete mode 100644 assets/change-ownership.sh diff --git a/assets/change-ownership.sh b/assets/change-ownership.sh deleted file mode 100644 index a18b6b6..0000000 --- a/assets/change-ownership.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/bash - -groupmod -u $GID $UNAME -usermod -u $UID $UNAME -chown $UID.$GID -R /.seafile -chown $UID.$GID -R /.supervisord -chown $UID.$GID -R /volume -chown $UID.$GID /entrypoint.sh -chown $UID.$GID /infinite-seaf-cli-start.sh From 315c3838263ff70a1e70b94c4a56eeda27b18973 Mon Sep 17 00:00:00 2001 From: "flow.gunso" Date: Tue, 9 Apr 2019 15:00:28 +0200 Subject: [PATCH 19/40] Add an entrypoint for the actual seafile client user --- assets/entrypoint.sh | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 assets/entrypoint.sh diff --git a/assets/entrypoint.sh b/assets/entrypoint.sh new file mode 100644 index 0000000..e600437 --- /dev/null +++ b/assets/entrypoint.sh @@ -0,0 +1,44 @@ +#!/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 . + +# Define variable shortcuts for readability purposes. +seafile_ini=~/.ccnet/seafile.ini +seafile_sock=~/.seafile/seafile-data/seafile.sock +supervisord_conf=~/supervisord.conf +supervisord_pid=~/.supervisord/supervisord.pid +supervisord_log=~/.supervisord/supervisord.log + +# Prepare the directories. +mkdir ~/.ccnet +mkdir ~/.seafile +mkdir ~/.supervisord +mkdir ~/share + +# Safely initialise the Seafile client. +/usr/bin/seaf-cli init -d /.seafile +while [ ! -f $seafile_ini ]; do sleep 1; done + +# Safely start the Seafile daemon. +/usr/bin/seaf-cli start +while [ ! -S $seafile_sock ]; do sleep 1; done + +# Start the synchronisation. +/usr/bin/seaf-cli sync -u $SEAF_USERNAME -p $SEAF_PASSWORD -s $SEAF_SERVER_URL -l $SEAF_LIBRARY_UUID -d /volume + +# Start the supervisord. +/usr/bin/supervisord -u $UNAME -c $supervisord_conf -j $supervisord_pid -l $supervisord_log \ No newline at end of file From 4e7b550d8adf9da31e8f4cfab2c20346cbd54dca Mon Sep 17 00:00:00 2001 From: "flow.gunso" Date: Tue, 9 Apr 2019 15:00:51 +0200 Subject: [PATCH 20/40] Move the Seafile client related stuff to it's entrypoint and run it --- entrypoint.sh | 31 ++++++------------------------- 1 file changed, 6 insertions(+), 25 deletions(-) diff --git a/entrypoint.sh b/entrypoint.sh index 433f8f0..fdcf103 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -22,18 +22,12 @@ if [ -z $SEAF_USERNAME ]; then echo "The \$SEAF_USERNAME was not defined. Stoppi if [ -z $SEAF_PASSWORD ]; then echo "The \$SEAF_PASSWORD was not defined. Stopping container..."; exit 1; fi if [ -z $SEAF_LIBRARY_UUID ]; then echo "The \$SEAF_LIBRARY_UUID was not defined. Stopping container..."; exit 1; fi -# Define variable shortcuts for readability purposes. -seafile_ini=~/.ccnet/seafile.ini -seafile_sock=/.seafile/seafile-data/seafile.sock -supervisord_conf=/.supervisord/supervisord.conf -supervisord_pid=/.supervisord/supervisord.pid -supervisord_log=/.supervisord/supervisord.log - # Update the user ID, if the $UID changed. if [ "$UID" != "1000" ]; then usermod -u $UID $UNAME # What the $UID already exists ? fi + # Change the group, if the $GID changed. if [ "$GID" != "1000" ]; then getent group | grep ":$GID:" >/dev/null @@ -45,22 +39,9 @@ if [ "$GID" != "1000" ]; then fi # Set the files ownership. -chown $UID.$GID -R /.seafile -chown $UID.$GID -R /.supervisord -chown $UID.$GID -R /volume -chown $UID.$GID /entrypoint.sh -chown $UID.$GID /infinite-seaf-cli-start.sh +chown $UID.$GID -R /home/seafuser/supervisord.conf +chown $UID.$GID -R /home/seafuser/infinite-seaf-cli-start.sh +chown $UID.$GID -R /home/seafuser/entrypoint.sh -# Safely initialize Seafile. -su - $UNAME -c "/usr/bin/seaf-cli init -d /.seafile" -while [ ! -f $seafile_ini ]; do sleep 1; done - -# Safely start the Seafile daemon. -su - $UNAME -c "/usr/bin/seaf-cli start" -while [ ! -S $seafile_sock ]; do sleep 1; done - -# Start the synchronisation. -su - $UNAME -c "/usr/bin/seaf-cli sync -u $SEAF_USERNAME -p $SEAF_PASSWORD -s $SEAF_SERVER_URL -l $SEAF_LIBRARY_UUID -d /volume" - -# Start the supervisord. -su - $UNAME -c "/usr/bin/supervisord -u $UNAME -c $supervisord_conf -j $supervisord_pid -l $supervisord_log" \ No newline at end of file +# Run the Seafile client as the container user. +su - $UNAME -c "/bin/bash /home/seafuser/entrypoint.sh" From 0dde8d6e9aa69dd00273044405eec3be7c1bb943 Mon Sep 17 00:00:00 2001 From: "flow.gunso" Date: Tue, 9 Apr 2019 15:01:10 +0200 Subject: [PATCH 21/40] Add the new entrypoint --- Dockerfile | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/Dockerfile b/Dockerfile index 7e82c06..efd225b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -19,18 +19,6 @@ FROM debian:jessie # Prevent the packages installation to halt. ENV DEBIAN_FRONTEND noninteractive -# Prepare the directories. -RUN mkdir /.seafile ;\ - mkdir /.supervisord ;\ - mkdir /volume - -# Put the core functionalities into the image. -COPY assets/seafile.list /etc/apt/sources.list.d/ -COPY assets/supervisord.conf /.supervisord/ -COPY assets/infinite-seaf-cli-start.sh / -COPY entrypoint.sh / -RUN chmod 777 /entrypoint.sh - # Safely import Seafile APT key, then install both seafile-cli and supervisord. COPY utils/build/import-seafile-apt-key.sh / RUN /bin/bash /import-seafile-apt-key.sh ;\ @@ -38,11 +26,19 @@ RUN /bin/bash /import-seafile-apt-key.sh ;\ apt-get install -o Dpkg::Options::="--force-confold" -y seafile-cli supervisor RUN rm -f /import-seafile-apt-key.sh -# Configure the user. +# Create the seafile client user. ENV UNAME=seafuser ENV UID=1000 ENV GID=1000 RUN groupadd -g $GID -o $UNAME ;\ useradd -m -u $UID -g $GID -o -s /bin/bash $UNAME +# Put the core functionalities into the image. +COPY assets/seafile.list /etc/apt/sources.list.d/ +COPY entrypoint.sh / +# and the ones for the seafile client user. +COPY assets/supervisord.conf /home/seafuser/ +COPY assets/infinite-seaf-cli-start.sh /home/seafuser/ +COPY assets/entrypoint.sh /home/seafuser/ + ENTRYPOINT ["/bin/bash", "/entrypoint.sh"] From b54cbc7564a07be21d199ee2a2b917fdc1dc357d Mon Sep 17 00:00:00 2001 From: "flow.gunso" Date: Tue, 9 Apr 2019 15:57:12 +0200 Subject: [PATCH 22/40] Fix files copy order --- Dockerfile | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index efd225b..b75aa3a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -19,6 +19,9 @@ FROM debian:jessie # Prevent the packages installation to halt. ENV DEBIAN_FRONTEND noninteractive +# Copy over the seafile repository. +COPY assets/seafile.list /etc/apt/sources.list.d/ + # Safely import Seafile APT key, then install both seafile-cli and supervisord. COPY utils/build/import-seafile-apt-key.sh / RUN /bin/bash /import-seafile-apt-key.sh ;\ @@ -33,10 +36,9 @@ ENV GID=1000 RUN groupadd -g $GID -o $UNAME ;\ useradd -m -u $UID -g $GID -o -s /bin/bash $UNAME -# Put the core functionalities into the image. -COPY assets/seafile.list /etc/apt/sources.list.d/ +# Copy over the Docker entrypoint. COPY entrypoint.sh / -# and the ones for the seafile client user. +# 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/entrypoint.sh /home/seafuser/ From 80863387377c066ba724fa59e1fd5a3d6c1a41d7 Mon Sep 17 00:00:00 2001 From: "flow.gunso" Date: Tue, 9 Apr 2019 16:11:23 +0200 Subject: [PATCH 23/40] Rename as the seafile's entrypoint --- assets/{entrypoint.sh => seafile-entrypoint.sh} | 1 - 1 file changed, 1 deletion(-) rename assets/{entrypoint.sh => seafile-entrypoint.sh} (99%) diff --git a/assets/entrypoint.sh b/assets/seafile-entrypoint.sh similarity index 99% rename from assets/entrypoint.sh rename to assets/seafile-entrypoint.sh index e600437..35676d3 100644 --- a/assets/entrypoint.sh +++ b/assets/seafile-entrypoint.sh @@ -24,7 +24,6 @@ supervisord_pid=~/.supervisord/supervisord.pid supervisord_log=~/.supervisord/supervisord.log # Prepare the directories. -mkdir ~/.ccnet mkdir ~/.seafile mkdir ~/.supervisord mkdir ~/share From 587821bfff124e14b07d65660b57ffb602179de0 Mon Sep 17 00:00:00 2001 From: "flow.gunso" Date: Tue, 9 Apr 2019 16:11:42 +0200 Subject: [PATCH 24/40] Rename as the Docker's entrypoint and move into assets --- entrypoint.sh => assets/docker-entrypoint.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename entrypoint.sh => assets/docker-entrypoint.sh (97%) diff --git a/entrypoint.sh b/assets/docker-entrypoint.sh similarity index 97% rename from entrypoint.sh rename to assets/docker-entrypoint.sh index fdcf103..c20f4d4 100644 --- a/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 the $UID already exists ? + # What if the $UID already exists ? fi # Change the group, if the $GID changed. From 6f62ba44840d879b1285181340cfa8710a5e7ff3 Mon Sep 17 00:00:00 2001 From: "flow.gunso" Date: Tue, 9 Apr 2019 16:12:02 +0200 Subject: [PATCH 25/40] Update with new entrypoint names --- Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index b75aa3a..3195cd5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -37,10 +37,10 @@ RUN groupadd -g $GID -o $UNAME ;\ useradd -m -u $UID -g $GID -o -s /bin/bash $UNAME # Copy over the Docker entrypoint. -COPY entrypoint.sh / +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/entrypoint.sh /home/seafuser/ +COPY assets/seafile-entrypoint.sh /home/seafuser/entrypoint.sh ENTRYPOINT ["/bin/bash", "/entrypoint.sh"] From 9f82f02ec5e530ef9fbc0c51555b88f3146ba2f1 Mon Sep 17 00:00:00 2001 From: "flow.gunso" Date: Tue, 9 Apr 2019 16:19:34 +0200 Subject: [PATCH 26/40] Fix Seafile init path --- assets/seafile-entrypoint.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/assets/seafile-entrypoint.sh b/assets/seafile-entrypoint.sh index 35676d3..3176c6a 100644 --- a/assets/seafile-entrypoint.sh +++ b/assets/seafile-entrypoint.sh @@ -24,12 +24,12 @@ supervisord_pid=~/.supervisord/supervisord.pid supervisord_log=~/.supervisord/supervisord.log # Prepare the directories. -mkdir ~/.seafile +mkdir ~/.seafile mkdir ~/.supervisord mkdir ~/share # Safely initialise the Seafile client. -/usr/bin/seaf-cli init -d /.seafile +/usr/bin/seaf-cli init -d ~/.seafile while [ ! -f $seafile_ini ]; do sleep 1; done # Safely start the Seafile daemon. From e23d93338e302138599bb4de368dc36e2998d8c6 Mon Sep 17 00:00:00 2001 From: "flow.gunso" Date: Tue, 9 Apr 2019 16:36:53 +0200 Subject: [PATCH 27/40] Preserve environment when starting Seafile --- 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 c20f4d4..f0c7e1f 100644 --- a/assets/docker-entrypoint.sh +++ b/assets/docker-entrypoint.sh @@ -44,4 +44,4 @@ chown $UID.$GID -R /home/seafuser/infinite-seaf-cli-start.sh chown $UID.$GID -R /home/seafuser/entrypoint.sh # Run the Seafile client as the container user. -su - $UNAME -c "/bin/bash /home/seafuser/entrypoint.sh" +su - $UNAME -m -c "/bin/bash /home/seafuser/entrypoint.sh" From e953effc582f4f07e6508be94c295499a5c48cf2 Mon Sep 17 00:00:00 2001 From: "flow.gunso" Date: Tue, 9 Apr 2019 16:53:34 +0200 Subject: [PATCH 28/40] Export required environment variables --- assets/docker-entrypoint.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/assets/docker-entrypoint.sh b/assets/docker-entrypoint.sh index f0c7e1f..b17d300 100644 --- a/assets/docker-entrypoint.sh +++ b/assets/docker-entrypoint.sh @@ -44,4 +44,10 @@ chown $UID.$GID -R /home/seafuser/infinite-seaf-cli-start.sh chown $UID.$GID -R /home/seafuser/entrypoint.sh # Run the Seafile client as the container user. -su - $UNAME -m -c "/bin/bash /home/seafuser/entrypoint.sh" +su - $UNAME -c ' \ + export SEAFILE_SERVER_URL=$SEAFILE_SERVER_URL \ + export SEAF_USERNAME=$SEAF_USERNAME \ + export SEAF_PASSWORD=$SEAF_PASSWORD \ + export SEAF_LIBRARY_UUID=$SEAF_LIBRARY_UUID \ + export UNAME=$UNAME \ + /bin/bash /home/seafuser/entrypoint.sh' From b5831b6ae7f5b7b8a336012c64399a84c95a02f1 Mon Sep 17 00:00:00 2001 From: "flow.gunso" Date: Tue, 9 Apr 2019 17:08:16 +0200 Subject: [PATCH 29/40] Separate commands with ; --- assets/docker-entrypoint.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/assets/docker-entrypoint.sh b/assets/docker-entrypoint.sh index b17d300..fe911fb 100644 --- a/assets/docker-entrypoint.sh +++ b/assets/docker-entrypoint.sh @@ -45,9 +45,9 @@ chown $UID.$GID -R /home/seafuser/entrypoint.sh # Run the Seafile client as the container user. su - $UNAME -c ' \ - export SEAFILE_SERVER_URL=$SEAFILE_SERVER_URL \ - export SEAF_USERNAME=$SEAF_USERNAME \ - export SEAF_PASSWORD=$SEAF_PASSWORD \ - export SEAF_LIBRARY_UUID=$SEAF_LIBRARY_UUID \ - export UNAME=$UNAME \ + export SEAFILE_SERVER_URL=$SEAFILE_SERVER_URL ;\ + export SEAF_USERNAME=$SEAF_USERNAME ;\ + export SEAF_PASSWORD=$SEAF_PASSWORD ;\ + export SEAF_LIBRARY_UUID=$SEAF_LIBRARY_UUID ;\ + export UNAME=$UNAME ;\ /bin/bash /home/seafuser/entrypoint.sh' From 66e100ab813fe4e1e8394ad56432a53f27f92ae8 Mon Sep 17 00:00:00 2001 From: "flow.gunso" Date: Tue, 9 Apr 2019 17:19:41 +0200 Subject: [PATCH 30/40] Fix an env var name --- 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 fe911fb..44b7075 100644 --- a/assets/docker-entrypoint.sh +++ b/assets/docker-entrypoint.sh @@ -45,7 +45,7 @@ chown $UID.$GID -R /home/seafuser/entrypoint.sh # Run the Seafile client as the container user. su - $UNAME -c ' \ - export SEAFILE_SERVER_URL=$SEAFILE_SERVER_URL ;\ + export SEAF_SERVER_URL=$SEAF_SERVER_URL ;\ export SEAF_USERNAME=$SEAF_USERNAME ;\ export SEAF_PASSWORD=$SEAF_PASSWORD ;\ export SEAF_LIBRARY_UUID=$SEAF_LIBRARY_UUID ;\ From 42096915337f81dc8f30169a4da603d0e9f6b868 Mon Sep 17 00:00:00 2001 From: "flow.gunso" Date: Tue, 9 Apr 2019 17:35:24 +0200 Subject: [PATCH 31/40] Debug mode activated --- assets/seafile-entrypoint.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/assets/seafile-entrypoint.sh b/assets/seafile-entrypoint.sh index 3176c6a..078295f 100644 --- a/assets/seafile-entrypoint.sh +++ b/assets/seafile-entrypoint.sh @@ -16,6 +16,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . +set -x + # Define variable shortcuts for readability purposes. seafile_ini=~/.ccnet/seafile.ini seafile_sock=~/.seafile/seafile-data/seafile.sock From 0fd2b8324dfaf2df198b302cb5470f1cf18b5d72 Mon Sep 17 00:00:00 2001 From: "flow.gunso" Date: Tue, 9 Apr 2019 17:55:52 +0200 Subject: [PATCH 32/40] Test with EO instead of -c --- assets/docker-entrypoint.sh | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/assets/docker-entrypoint.sh b/assets/docker-entrypoint.sh index 44b7075..91443e5 100644 --- a/assets/docker-entrypoint.sh +++ b/assets/docker-entrypoint.sh @@ -44,10 +44,11 @@ chown $UID.$GID -R /home/seafuser/infinite-seaf-cli-start.sh chown $UID.$GID -R /home/seafuser/entrypoint.sh # Run the Seafile client as the container user. -su - $UNAME -c ' \ - export SEAF_SERVER_URL=$SEAF_SERVER_URL ;\ - export SEAF_USERNAME=$SEAF_USERNAME ;\ - export SEAF_PASSWORD=$SEAF_PASSWORD ;\ - export SEAF_LIBRARY_UUID=$SEAF_LIBRARY_UUID ;\ - export UNAME=$UNAME ;\ - /bin/bash /home/seafuser/entrypoint.sh' +su - $UNAME << EO + export SEAF_SERVER_URL=$SEAF_SERVER_URL + export SEAF_USERNAME=$SEAF_USERNAME + export SEAF_PASSWORD=$SEAF_PASSWORD + export SEAF_LIBRARY_UUID=$SEAF_LIBRARY_UUID + export UNAME=$UNAME + /bin/bash /home/seafuser/entrypoint.sh +EO \ No newline at end of file From 982044d1c84e2d44ea6c2b6043469dd0f3dcb4b7 Mon Sep 17 00:00:00 2001 From: "flow.gunso" Date: Tue, 9 Apr 2019 18:10:08 +0200 Subject: [PATCH 33/40] Fix the path using ~ --- assets/supervisord.conf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/assets/supervisord.conf b/assets/supervisord.conf index 4b38bba..27d6d2a 100644 --- a/assets/supervisord.conf +++ b/assets/supervisord.conf @@ -20,11 +20,11 @@ nodaemon=true # Manage the Seafile daemon. [unix_http_socket] -file=/seafile/seafile-data/seafile.sock +file=~/.seafile/seafile-data/seafile.sock # Manage the infinite `seaf-cli start`. [program:seaf-cli-start-loop] -command=/bin/bash /infinite-seaf-cli-start.sh +command=/bin/bash ~/infinite-seaf-cli-start.sh process_name=%(program_name)s numprocs=1 autostart=true \ No newline at end of file From ac12bb334977dcb4d1cc65d896706ef2d9ffb8b0 Mon Sep 17 00:00:00 2001 From: "flow.gunso" Date: Tue, 9 Apr 2019 18:21:21 +0200 Subject: [PATCH 34/40] Set -x --- assets/infinite-seaf-cli-start.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/assets/infinite-seaf-cli-start.sh b/assets/infinite-seaf-cli-start.sh index f6fa3f3..1c1454e 100755 --- a/assets/infinite-seaf-cli-start.sh +++ b/assets/infinite-seaf-cli-start.sh @@ -16,8 +16,10 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -/bin/sleep 10 +set -x + +sleep 10 while true; do /usr/bin/seaf-cli start - /bin/sleep 3600 + sleep 3600 done \ No newline at end of file From 4320e5b85be318b0fc6b69b49d80c2e842fefa03 Mon Sep 17 00:00:00 2001 From: "flow.gunso" Date: Tue, 9 Apr 2019 18:21:27 +0200 Subject: [PATCH 35/40] Unset -x --- assets/seafile-entrypoint.sh | 2 -- 1 file changed, 2 deletions(-) diff --git a/assets/seafile-entrypoint.sh b/assets/seafile-entrypoint.sh index 078295f..3176c6a 100644 --- a/assets/seafile-entrypoint.sh +++ b/assets/seafile-entrypoint.sh @@ -16,8 +16,6 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -set -x - # Define variable shortcuts for readability purposes. seafile_ini=~/.ccnet/seafile.ini seafile_sock=~/.seafile/seafile-data/seafile.sock From 2076319342feb1ad0825d8522605d5727a897aa5 Mon Sep 17 00:00:00 2001 From: "flow.gunso" Date: Tue, 9 Apr 2019 18:39:57 +0200 Subject: [PATCH 36/40] Fix the /volume path used for the seafile data --- Dockerfile | 2 ++ assets/docker-entrypoint.sh | 1 + assets/seafile-entrypoint.sh | 1 - 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 3195cd5..f828658 100644 --- a/Dockerfile +++ b/Dockerfile @@ -38,9 +38,11 @@ RUN groupadd -g $GID -o $UNAME ;\ # Copy over the Docker entrypoint. 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/seafile-entrypoint.sh /home/seafuser/entrypoint.sh +RUN mkdir /volume ENTRYPOINT ["/bin/bash", "/entrypoint.sh"] diff --git a/assets/docker-entrypoint.sh b/assets/docker-entrypoint.sh index 91443e5..23906f8 100644 --- a/assets/docker-entrypoint.sh +++ b/assets/docker-entrypoint.sh @@ -42,6 +42,7 @@ fi chown $UID.$GID -R /home/seafuser/supervisord.conf chown $UID.$GID -R /home/seafuser/infinite-seaf-cli-start.sh chown $UID.$GID -R /home/seafuser/entrypoint.sh +chown $UID.$GID -R /volume # Run the Seafile client as the container user. su - $UNAME << EO diff --git a/assets/seafile-entrypoint.sh b/assets/seafile-entrypoint.sh index 3176c6a..e603906 100644 --- a/assets/seafile-entrypoint.sh +++ b/assets/seafile-entrypoint.sh @@ -26,7 +26,6 @@ supervisord_log=~/.supervisord/supervisord.log # Prepare the directories. mkdir ~/.seafile mkdir ~/.supervisord -mkdir ~/share # Safely initialise the Seafile client. /usr/bin/seaf-cli init -d ~/.seafile From d1bbf07dff25b88866f7613c097342dff1c0cdc0 Mon Sep 17 00:00:00 2001 From: "flow.gunso" Date: Tue, 9 Apr 2019 18:41:48 +0200 Subject: [PATCH 37/40] Add a log the seaf-cli start loop --- assets/supervisord.conf | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/assets/supervisord.conf b/assets/supervisord.conf index 27d6d2a..0b0b726 100644 --- a/assets/supervisord.conf +++ b/assets/supervisord.conf @@ -27,4 +27,5 @@ file=~/.seafile/seafile-data/seafile.sock command=/bin/bash ~/infinite-seaf-cli-start.sh process_name=%(program_name)s numprocs=1 -autostart=true \ No newline at end of file +autostart=true +stdout_logfile=~/.supervisord/infinite-seaf-cli-start.log \ No newline at end of file From ed14e0ca5ff18b809c27847ae5a2c186e2e6e245 Mon Sep 17 00:00:00 2001 From: "flow.gunso" Date: Tue, 9 Apr 2019 18:50:25 +0200 Subject: [PATCH 38/40] Set the script absolute path, remote stdout logging --- assets/supervisord.conf | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/assets/supervisord.conf b/assets/supervisord.conf index 0b0b726..560c374 100644 --- a/assets/supervisord.conf +++ b/assets/supervisord.conf @@ -24,8 +24,7 @@ file=~/.seafile/seafile-data/seafile.sock # Manage the infinite `seaf-cli start`. [program:seaf-cli-start-loop] -command=/bin/bash ~/infinite-seaf-cli-start.sh +command=/bin/bash /home/seafuser/infinite-seaf-cli-start.sh process_name=%(program_name)s numprocs=1 autostart=true -stdout_logfile=~/.supervisord/infinite-seaf-cli-start.log \ No newline at end of file From b00a452ec6ee145663df039db726a82c28ab46f2 Mon Sep 17 00:00:00 2001 From: "flow.gunso" Date: Tue, 9 Apr 2019 19:13:39 +0200 Subject: [PATCH 39/40] Document changes in v1.1.0 --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index afcffc7..219f189 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +## [1.1.0] - 2019/04/09 +- The container now actually use the UID/GID provided to it: +The container entrypoint is run with root, then another entrypoint is run by the container's user, seafuser, to run the Seafile client. + ### [1.0.6] - 2019/03/25 - More minor fixes from v1.0.4 ### [1.0.5] - 2019/03/25 From e73a9f339b6258eb5b9ce5783e06f7c209c0149f Mon Sep 17 00:00:00 2001 From: "flow.gunso" Date: Tue, 9 Apr 2019 19:14:19 +0200 Subject: [PATCH 40/40] Update the documentation following v1.1.0 changes --- README.md | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index 4f72a22..a857d3c 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![1.0.6 build status](https://gitlab.com/flwgns-docker/seafile-client/badges/1.0.6/pipeline.svg)](https://gitlab.com/flwgns-docker/seafile-client/commits/1.0.6) +[![1.1.0 build status](https://gitlab.com/flwgns-docker/seafile-client/badges/1.1.0/pipeline.svg)](https://gitlab.com/flwgns-docker/seafile-client/commits/1.1.0) [![Docker pulls](https://img.shields.io/docker/pulls/flowgunso/seafile-client.svg)](https://hub.docker.com/r/flowgunso/seafile-client) [![Licensed under GPLv3](https://img.shields.io/badge/License-GPLv3-red.svg)](https://www.gnu.org/licenses/gpl-3.0) [![@gitlab.com/flwgns-docker/seafile-client](https://img.shields.io/badge/Code%20source-GitLab-red.svg)](https://gitlab.com/flwgns-docker/seafile-client/) @@ -11,24 +11,25 @@ Permanent stable releases will not be built again. You can rely on the weekly stable releases. They are stable. ## Weekly stable releases. -[`1`](https://gitlab.com/flwgns-docker/seafile-client/tags/1.0.6), -[`1.0`](https://gitlab.com/flwgns-docker/seafile-client/tags/1.0.6), -[`1.0.6`](https://gitlab.com/flwgns-docker/seafile-client/tags/1.0.6), -[`latest`](https://gitlab.com/flwgns-docker/seafile-client/tags/1.0.6) -(see tag/release [1.0.6](https://gitlab.com/flwgns-docker/seafile-client/tags/1.0.6)) +[`1`](https://gitlab.com/flwgns-docker/seafile-client/tags/1.1.0), +[`1.1`](https://gitlab.com/flwgns-docker/seafile-client/tags/1.1.0), +[`1.1.0`](https://gitlab.com/flwgns-docker/seafile-client/tags/1.1.0), +[`latest`](https://gitlab.com/flwgns-docker/seafile-client/tags/1.1.0) +(see tag/release [1.1.0](https://gitlab.com/flwgns-docker/seafile-client/tags/1.1.0)) ## Permanent stable releases. -[`1.0.3`](https://gitlab.com/flwgns-docker/seafile-client/tags/1.0.3) -(see tag/release [1.0.3](https://gitlab.com/flwgns-docker/seafile-client/tags/1.0.3)) -[`1.0.2`](https://gitlab.com/flwgns-docker/seafile-client/tags/1.0.2) -(see tag/release [1.0.2](https://gitlab.com/flwgns-docker/seafile-client/tags/1.0.2)) -[`1.0.0`](https://gitlab.com/flwgns-docker/seafile-client/tags/1.0.0) -(see tag/release [1.0.0](https://gitlab.com/flwgns-docker/seafile-client/tags/1.0.0)) +None at the moment. ## Developmental releases. [`staging`](https://gitlab.com/flwgns-docker/seafile-client/tree/staging) (see branch [staging](https://gitlab.com/flwgns-docker/seafile-client/tree/staging)) +## Obsolete releases. +[`1.0`](https://gitlab.com/flwgns-docker/seafile-client/tags/1.0.6) and it's revision +[`1.0.6`](https://gitlab.com/flwgns-docker/seafile-client/tags/1.0.6), +[`1.0.3`](https://gitlab.com/flwgns-docker/seafile-client/tags/1.0.3), +[`1.0.2`](https://gitlab.com/flwgns-docker/seafile-client/tags/1.0.2), +[`1.0.0`](https://gitlab.com/flwgns-docker/seafile-client/tags/1.0.0) are now obsolete. # Purpose Docker Seafile Client allow you to sync a Seafile library within a container.