From 760d5b511ff547ae674764bae99a7dd3060e506b Mon Sep 17 00:00:00 2001 From: "flow.gunso" Date: Thu, 18 Apr 2019 14:57:00 +0200 Subject: [PATCH 01/35] Fix typo in source code badge label --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index a940afb..bc2557d 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ [![1.1.1 build status](https://gitlab.com/flwgns-docker/seafile-client/badges/1.1.1/pipeline.svg)](https://gitlab.com/flwgns-docker/seafile-client/commits/1.1.1) [![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/) +[![@gitlab.com/flwgns-docker/seafile-client](https://img.shields.io/badge/Source%20code-GitLab-red.svg)](https://gitlab.com/flwgns-docker/seafile-client/) # Available tags From 2b228c3484edc45c7593c338ac5d42b417ad183e Mon Sep 17 00:00:00 2001 From: "flow.gunso" Date: Thu, 18 Apr 2019 17:32:25 +0200 Subject: [PATCH 02/35] Add a script to build image for cron and supervisord --- utils/publish/feature--cron-or-supervisord.sh | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100755 utils/publish/feature--cron-or-supervisord.sh diff --git a/utils/publish/feature--cron-or-supervisord.sh b/utils/publish/feature--cron-or-supervisord.sh new file mode 100755 index 0000000..71806be --- /dev/null +++ b/utils/publish/feature--cron-or-supervisord.sh @@ -0,0 +1,32 @@ +#!/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 . + +# Restrict to pipeline triggered by pushes. +if [ $CI_PIPELINE_SOURCE != "push" ]; then + echo "This must be only ran from pushes." + exit 1 +fi + +# Login with Docker Registry. +echo $CI_REGISTRY_BOT_PASSWORD | docker login -u $CI_REGISTRY_BOT_USERNAME docker.io --password-stdin + +# Build and push as staging. +docker build -t index.docker.io/$CI_REGISTRY_IMAGE:staging-supervisord Dockerfile.supervisord +docker build -t index.docker.io/$CI_REGISTRY_IMAGE:staging-cron Dockerfile.cron +docker push index.docker.io/$CI_REGISTRY_IMAGE:staging-supervisord +docker push index.docker.io/$CI_REGISTRY_IMAGE:staging-cron \ No newline at end of file From e7daeeaec112231f40176cfcaa8a29dc29a8331a Mon Sep 17 00:00:00 2001 From: "flow.gunso" Date: Thu, 18 Apr 2019 17:32:41 +0200 Subject: [PATCH 03/35] Add the CI stage to build for cron and supervisord --- .gitlab-ci.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 09d9c34..d9f9960 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -9,6 +9,13 @@ stages: before_script: - apk add bash +cron_or_supervisord: + stage: build_publish + script: + - /bin/bash utils/publish/feature--cron-or-supervisord.sh + only: + - feature--cron-or-supervisord + staging: stage: build_publish script: From c8c575dfa192c9cb66f0aedf8a3812adb93f7200 Mon Sep 17 00:00:00 2001 From: "flow.gunso" Date: Thu, 18 Apr 2019 17:55:22 +0200 Subject: [PATCH 04/35] Remove the debugging, use absolute paths --- assets/infinite-seaf-cli-start.sh | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/assets/infinite-seaf-cli-start.sh b/assets/infinite-seaf-cli-start.sh index dc7abb6..5aadbcf 100755 --- a/assets/infinite-seaf-cli-start.sh +++ b/assets/infinite-seaf-cli-start.sh @@ -16,11 +16,9 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -set -x - -sleep 10 +/bin/sleep 10 while true; do /usr/bin/seaf-cli stop /usr/bin/seaf-cli start - sleep 1200 + /bin/sleep 1200 done \ No newline at end of file From 7ca5f507271285171a7a4b27bb170e70d5efd61e Mon Sep 17 00:00:00 2001 From: "flow.gunso" Date: Thu, 18 Apr 2019 17:55:53 +0200 Subject: [PATCH 05/35] Rename with supervisord --- .../{seafile-entrypoint.sh => seafile-supervisord-entrypoint.sh} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename assets/{seafile-entrypoint.sh => seafile-supervisord-entrypoint.sh} (100%) diff --git a/assets/seafile-entrypoint.sh b/assets/seafile-supervisord-entrypoint.sh similarity index 100% rename from assets/seafile-entrypoint.sh rename to assets/seafile-supervisord-entrypoint.sh From fe5f07f20a7f9399ae9bb8fa3a4fb3466c8cd33c Mon Sep 17 00:00:00 2001 From: "flow.gunso" Date: Thu, 18 Apr 2019 17:56:05 +0200 Subject: [PATCH 06/35] Rename with supervisord --- Dockerfile => Dockerfile.supervisord | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) rename Dockerfile => Dockerfile.supervisord (93%) diff --git a/Dockerfile b/Dockerfile.supervisord similarity index 93% rename from Dockerfile rename to Dockerfile.supervisord index 56d653f..1f4254d 100644 --- a/Dockerfile +++ b/Dockerfile.supervisord @@ -19,12 +19,10 @@ FROM debian:jessie-slim # 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 ;\ +RUN echo "deb http://deb.seadrive.org jessie main" > /etc/apt/source.list.d/seafile.list ;\ + /bin/bash /import-seafile-apt-key.sh ;\ apt-get update ;\ apt-get install \ -o Dpkg::Options::="--force-confold" \ From f4247ef87595ea67e44c36a621c66cde8e6b7576 Mon Sep 17 00:00:00 2001 From: "flow.gunso" Date: Thu, 18 Apr 2019 17:56:44 +0200 Subject: [PATCH 07/35] Update paths to the Seafile entrypoint --- assets/docker-entrypoint.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/assets/docker-entrypoint.sh b/assets/docker-entrypoint.sh index 23906f8..63f6082 100644 --- a/assets/docker-entrypoint.sh +++ b/assets/docker-entrypoint.sh @@ -41,7 +41,7 @@ fi # Set the files ownership. 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 /home/seafuser/seafile-entrypoint.sh chown $UID.$GID -R /volume # Run the Seafile client as the container user. @@ -51,5 +51,5 @@ su - $UNAME << EO export SEAF_PASSWORD=$SEAF_PASSWORD export SEAF_LIBRARY_UUID=$SEAF_LIBRARY_UUID export UNAME=$UNAME - /bin/bash /home/seafuser/entrypoint.sh + /bin/bash /home/seafuser/seafile-entrypoint.sh EO \ No newline at end of file From 9e76014bc355afd27127f53de607f3bbd1e40ace Mon Sep 17 00:00:00 2001 From: "flow.gunso" Date: Thu, 18 Apr 2019 17:56:54 +0200 Subject: [PATCH 08/35] Add a Dockerfile for cron --- Dockerfile.cron | 57 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 Dockerfile.cron diff --git a/Dockerfile.cron b/Dockerfile.cron new file mode 100644 index 0000000..cb4433c --- /dev/null +++ b/Dockerfile.cron @@ -0,0 +1,57 @@ +# 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 . + +FROM debian:jessie-slim + +# Prevent the packages installation to halt. +ENV DEBIAN_FRONTEND noninteractive + +# Copy over the Docker related files. +COPY utils/build/import-seafile-apt-key.sh assets/docker-entrypoint.sh / + +# Copy over the required files for Seafile/SupervisorD. +COPY assets/infinite-seaf-cli-start.sh assets/seafile-entrypoint.sh /home/seafuser/ + +# Safely import Seafile APT key, then install both seafile-cli and supervisord. +RUN echo "deb http://deb.seadrive.org jessie main" \ > /etc/apt/source.list.d/seafile.list ;\ + bash /import-seafile-apt-key.sh ;\ + apt-get update ;\ + apt-get install \ + -o Dpkg::Options::="--force-confold" \ + -y \ + seafile-cli \ + cron ;\ + apt-get clean ;\ + apt-get autoclean \ + -o APT::Clean-Installed=true ;\ + rm \ + -f \ + /var/log/fsck/*.log \ + /var/log/apt/*.log \ + /var/cache/debconf/*.dat-old \ + /import-seafile-apt-key.sh ;\ + mkdir /volume/ ;\ + echo "seafuser" > /etc/cron.allow ;\ + echo "*/20 * * * * /bin/bash /home/seafuser/infinite-seaf-cli-start.sh" > /var/spool/cron/crontabs/seafuser + +# 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 + +ENTRYPOINT ["/bin/bash", "/docker-entrypoint.sh"] From 6b57dd606b1ffc79fcd2aa8f51afbcaa9f997da0 Mon Sep 17 00:00:00 2001 From: "flow.gunso" Date: Thu, 18 Apr 2019 17:57:04 +0200 Subject: [PATCH 09/35] Add a Seafile entrypoint for cron --- assets/seafile-cron-entrypoint.sh | 39 +++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 assets/seafile-cron-entrypoint.sh diff --git a/assets/seafile-cron-entrypoint.sh b/assets/seafile-cron-entrypoint.sh new file mode 100644 index 0000000..5eda987 --- /dev/null +++ b/assets/seafile-cron-entrypoint.sh @@ -0,0 +1,39 @@ +#!/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 + +# Prepare the directories. +mkdir ~/.seafile +mkdir ~/.supervisord + +# 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/sbin/cron -f \ No newline at end of file From 5382c5c6e1b32c5251b101060b5c12de0eedbe6c Mon Sep 17 00:00:00 2001 From: "flow.gunso" Date: Thu, 18 Apr 2019 18:02:23 +0200 Subject: [PATCH 10/35] Revert back to not named entrypoints --- assets/docker-entrypoint.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/assets/docker-entrypoint.sh b/assets/docker-entrypoint.sh index 63f6082..23906f8 100644 --- a/assets/docker-entrypoint.sh +++ b/assets/docker-entrypoint.sh @@ -41,7 +41,7 @@ fi # Set the files ownership. 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/seafile-entrypoint.sh +chown $UID.$GID -R /home/seafuser/entrypoint.sh chown $UID.$GID -R /volume # Run the Seafile client as the container user. @@ -51,5 +51,5 @@ su - $UNAME << EO export SEAF_PASSWORD=$SEAF_PASSWORD export SEAF_LIBRARY_UUID=$SEAF_LIBRARY_UUID export UNAME=$UNAME - /bin/bash /home/seafuser/seafile-entrypoint.sh + /bin/bash /home/seafuser/entrypoint.sh EO \ No newline at end of file From 5501553cb518f3337d3077ed98707a071d9b39e2 Mon Sep 17 00:00:00 2001 From: "flow.gunso" Date: Thu, 18 Apr 2019 18:02:53 +0200 Subject: [PATCH 11/35] Reduce layers, revert back to not named entrypoints --- Dockerfile.cron | 29 ++++++++++++++++------------- Dockerfile.supervisord | 29 ++++++++++++++--------------- 2 files changed, 30 insertions(+), 28 deletions(-) diff --git a/Dockerfile.cron b/Dockerfile.cron index cb4433c..6371a76 100644 --- a/Dockerfile.cron +++ b/Dockerfile.cron @@ -18,15 +18,18 @@ FROM debian:jessie-slim # Prevent the packages installation to halt. ENV DEBIAN_FRONTEND noninteractive +# Create the seafile client user. +ENV UNAME=seafuser +ENV UID=1000 +ENV GID=1000 # Copy over the Docker related files. -COPY utils/build/import-seafile-apt-key.sh assets/docker-entrypoint.sh / - -# Copy over the required files for Seafile/SupervisorD. -COPY assets/infinite-seaf-cli-start.sh assets/seafile-entrypoint.sh /home/seafuser/ +COPY utils/build/import-seafile-apt-key.sh / +COPY assets/docker-entrypoint.sh /entrypoint.sh # Safely import Seafile APT key, then install both seafile-cli and supervisord. -RUN echo "deb http://deb.seadrive.org jessie main" \ > /etc/apt/source.list.d/seafile.list ;\ +RUN echo "deb http://deb.seadrive.org jessie main" \ + > /etc/apt/source.list.d/seafile.list ;\ bash /import-seafile-apt-key.sh ;\ apt-get update ;\ apt-get install \ @@ -45,13 +48,13 @@ RUN echo "deb http://deb.seadrive.org jessie main" \ > /etc/apt/source.list.d/se /import-seafile-apt-key.sh ;\ mkdir /volume/ ;\ echo "seafuser" > /etc/cron.allow ;\ - echo "*/20 * * * * /bin/bash /home/seafuser/infinite-seaf-cli-start.sh" > /var/spool/cron/crontabs/seafuser - -# Create the seafile client user. -ENV UNAME=seafuser -ENV UID=1000 -ENV GID=1000 -RUN groupadd -g $GID -o $UNAME ;\ + echo "*/20 * * * * /bin/bash /home/seafuser/infinite-seaf-cli-start.sh" \ + > /var/spool/cron/crontabs/seafuser \; + groupadd -g $GID -o $UNAME ;\ useradd -m -u $UID -g $GID -o -s /bin/bash $UNAME -ENTRYPOINT ["/bin/bash", "/docker-entrypoint.sh"] +# Copy over the required files for Seafile/SupervisorD. +COPY assets/infinite-seaf-cli-start.sh /home/seafuser/ +COPY assets/seafile-entrypoint.sh /home/seafuser/entrypoint.sh + +ENTRYPOINT ["/bin/bash", "/entrypoint.sh"] diff --git a/Dockerfile.supervisord b/Dockerfile.supervisord index 1f4254d..0075026 100644 --- a/Dockerfile.supervisord +++ b/Dockerfile.supervisord @@ -18,10 +18,18 @@ FROM debian:jessie-slim # Prevent the packages installation to halt. ENV DEBIAN_FRONTEND noninteractive +# Specify the user running Seafile. +ENV UNAME=seafuser +ENV UID=1000 +ENV GID=1000 + +# Copy over the Docker related files. +COPY utils/build/import-seafile-apt-key.sh / +COPY assets/docker-entrypoint.sh /entrypoint.sh # Safely import Seafile APT key, then install both seafile-cli and supervisord. -COPY utils/build/import-seafile-apt-key.sh / -RUN echo "deb http://deb.seadrive.org jessie main" > /etc/apt/source.list.d/seafile.list ;\ +RUN echo "deb http://deb.seadrive.org jessie main" \ + > /etc/apt/source.list.d/seafile.list ;\ /bin/bash /import-seafile-apt-key.sh ;\ apt-get update ;\ apt-get install \ @@ -37,22 +45,13 @@ RUN echo "deb http://deb.seadrive.org jessie main" > /etc/apt/source.list.d/seaf /var/log/fsck/*.log \ /var/log/apt/*.log \ /var/cache/debconf/*.dat-old \ - /import-seafile-apt-key.sh - -# Create the seafile client user. -ENV UNAME=seafuser -ENV UID=1000 -ENV GID=1000 -RUN groupadd -g $GID -o $UNAME ;\ + /import-seafile-apt-key.sh ;\ + mkdir /volume ;\ + groupadd -g $GID -o $UNAME ;\ useradd -m -u $UID -g $GID -o -s /bin/bash $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/supervisord.conf 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"] From 2b9c85c65de03bdcce5e907963cda1b5ba877107 Mon Sep 17 00:00:00 2001 From: "flow.gunso" Date: Thu, 18 Apr 2019 18:05:40 +0200 Subject: [PATCH 12/35] Fix docker build parameter when using named files --- utils/publish/feature--cron-or-supervisord.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/utils/publish/feature--cron-or-supervisord.sh b/utils/publish/feature--cron-or-supervisord.sh index 71806be..7fd2670 100755 --- a/utils/publish/feature--cron-or-supervisord.sh +++ b/utils/publish/feature--cron-or-supervisord.sh @@ -26,7 +26,7 @@ fi echo $CI_REGISTRY_BOT_PASSWORD | docker login -u $CI_REGISTRY_BOT_USERNAME docker.io --password-stdin # Build and push as staging. -docker build -t index.docker.io/$CI_REGISTRY_IMAGE:staging-supervisord Dockerfile.supervisord -docker build -t index.docker.io/$CI_REGISTRY_IMAGE:staging-cron Dockerfile.cron +docker build -t index.docker.io/$CI_REGISTRY_IMAGE:staging-supervisord -f Dockerfile.supervisord +docker build -t index.docker.io/$CI_REGISTRY_IMAGE:staging-cron -f Dockerfile.cron docker push index.docker.io/$CI_REGISTRY_IMAGE:staging-supervisord docker push index.docker.io/$CI_REGISTRY_IMAGE:staging-cron \ No newline at end of file From d56cb13d7f84261afcec806233cdd3bbca04079e Mon Sep 17 00:00:00 2001 From: "flow.gunso" Date: Thu, 18 Apr 2019 18:07:57 +0200 Subject: [PATCH 13/35] Build with the current path helps --- utils/publish/feature--cron-or-supervisord.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/utils/publish/feature--cron-or-supervisord.sh b/utils/publish/feature--cron-or-supervisord.sh index 7fd2670..7785594 100755 --- a/utils/publish/feature--cron-or-supervisord.sh +++ b/utils/publish/feature--cron-or-supervisord.sh @@ -26,7 +26,7 @@ fi echo $CI_REGISTRY_BOT_PASSWORD | docker login -u $CI_REGISTRY_BOT_USERNAME docker.io --password-stdin # Build and push as staging. -docker build -t index.docker.io/$CI_REGISTRY_IMAGE:staging-supervisord -f Dockerfile.supervisord -docker build -t index.docker.io/$CI_REGISTRY_IMAGE:staging-cron -f Dockerfile.cron +docker build -t index.docker.io/$CI_REGISTRY_IMAGE:staging-supervisord -f Dockerfile.supervisord . +docker build -t index.docker.io/$CI_REGISTRY_IMAGE:staging-cron -f Dockerfile.cron . docker push index.docker.io/$CI_REGISTRY_IMAGE:staging-supervisord docker push index.docker.io/$CI_REGISTRY_IMAGE:staging-cron \ No newline at end of file From 9cfbe0d1298b686a1b61990e95da6e866f375146 Mon Sep 17 00:00:00 2001 From: "flow.gunso" Date: Thu, 18 Apr 2019 18:14:07 +0200 Subject: [PATCH 14/35] Create the missing apt source.list.d directory --- Dockerfile.cron | 3 ++- Dockerfile.supervisord | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Dockerfile.cron b/Dockerfile.cron index 6371a76..2713a36 100644 --- a/Dockerfile.cron +++ b/Dockerfile.cron @@ -28,7 +28,8 @@ COPY utils/build/import-seafile-apt-key.sh / COPY assets/docker-entrypoint.sh /entrypoint.sh # Safely import Seafile APT key, then install both seafile-cli and supervisord. -RUN echo "deb http://deb.seadrive.org jessie main" \ +RUN mkdir -p /etc/apt/source.list.d/ ;\ + echo "deb http://deb.seadrive.org jessie main" \ > /etc/apt/source.list.d/seafile.list ;\ bash /import-seafile-apt-key.sh ;\ apt-get update ;\ diff --git a/Dockerfile.supervisord b/Dockerfile.supervisord index 0075026..c13b15c 100644 --- a/Dockerfile.supervisord +++ b/Dockerfile.supervisord @@ -28,7 +28,8 @@ COPY utils/build/import-seafile-apt-key.sh / COPY assets/docker-entrypoint.sh /entrypoint.sh # Safely import Seafile APT key, then install both seafile-cli and supervisord. -RUN echo "deb http://deb.seadrive.org jessie main" \ +RUN mkdir -p /etc/apt/source.list.d/ ;\ + echo "deb http://deb.seadrive.org jessie main" \ > /etc/apt/source.list.d/seafile.list ;\ /bin/bash /import-seafile-apt-key.sh ;\ apt-get update ;\ From 16f58875224dbeb5de659843e969809c07759738 Mon Sep 17 00:00:00 2001 From: "flow.gunso" Date: Thu, 18 Apr 2019 23:10:41 +0200 Subject: [PATCH 15/35] Add the missing 's' to sources.list.d --- Dockerfile.cron | 4 ++-- Dockerfile.supervisord | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Dockerfile.cron b/Dockerfile.cron index 2713a36..7723c31 100644 --- a/Dockerfile.cron +++ b/Dockerfile.cron @@ -28,9 +28,9 @@ COPY utils/build/import-seafile-apt-key.sh / COPY assets/docker-entrypoint.sh /entrypoint.sh # Safely import Seafile APT key, then install both seafile-cli and supervisord. -RUN mkdir -p /etc/apt/source.list.d/ ;\ +RUN mkdir -p /etc/apt/sources.list.d/ ;\ echo "deb http://deb.seadrive.org jessie main" \ - > /etc/apt/source.list.d/seafile.list ;\ + > /etc/apt/sources.list.d/seafile.list ;\ bash /import-seafile-apt-key.sh ;\ apt-get update ;\ apt-get install \ diff --git a/Dockerfile.supervisord b/Dockerfile.supervisord index c13b15c..33a8d32 100644 --- a/Dockerfile.supervisord +++ b/Dockerfile.supervisord @@ -28,9 +28,9 @@ COPY utils/build/import-seafile-apt-key.sh / COPY assets/docker-entrypoint.sh /entrypoint.sh # Safely import Seafile APT key, then install both seafile-cli and supervisord. -RUN mkdir -p /etc/apt/source.list.d/ ;\ +RUN mkdir -p /etc/apt/sources.list.d/ ;\ echo "deb http://deb.seadrive.org jessie main" \ - > /etc/apt/source.list.d/seafile.list ;\ + > /etc/apt/sources.list.d/seafile.list ;\ /bin/bash /import-seafile-apt-key.sh ;\ apt-get update ;\ apt-get install \ From 511d18c4ae79aaac5bbb6ceebb5210cef9623bbf Mon Sep 17 00:00:00 2001 From: "flow.gunso" Date: Thu, 18 Apr 2019 23:16:19 +0200 Subject: [PATCH 16/35] Fix the path to cron/supervisord specific entrypoints --- Dockerfile.cron | 2 +- Dockerfile.supervisord | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile.cron b/Dockerfile.cron index 7723c31..b808306 100644 --- a/Dockerfile.cron +++ b/Dockerfile.cron @@ -56,6 +56,6 @@ RUN mkdir -p /etc/apt/sources.list.d/ ;\ # Copy over the required files for Seafile/SupervisorD. COPY assets/infinite-seaf-cli-start.sh /home/seafuser/ -COPY assets/seafile-entrypoint.sh /home/seafuser/entrypoint.sh +COPY assets/seafile-cron-entrypoint.sh /home/seafuser/entrypoint.sh ENTRYPOINT ["/bin/bash", "/entrypoint.sh"] diff --git a/Dockerfile.supervisord b/Dockerfile.supervisord index 33a8d32..acbcf5c 100644 --- a/Dockerfile.supervisord +++ b/Dockerfile.supervisord @@ -53,6 +53,6 @@ RUN mkdir -p /etc/apt/sources.list.d/ ;\ # Copy over the required files for Seafile/SupervisorD. COPY assets/supervisord.conf assets/infinite-seaf-cli-start.sh /home/seafuser/ -COPY assets/seafile-entrypoint.sh /home/seafuser/entrypoint.sh +COPY assets/seafile-supervisord-entrypoint.sh /home/seafuser/entrypoint.sh ENTRYPOINT ["/bin/bash", "/entrypoint.sh"] From 2fc76dbf8be7922f4d7520e7352ff7c2eacf33cb Mon Sep 17 00:00:00 2001 From: "flow.gunso" Date: Thu, 18 Apr 2019 23:21:50 +0200 Subject: [PATCH 17/35] Fix the inverted line/command break --- Dockerfile.cron | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile.cron b/Dockerfile.cron index b808306..1a7a31e 100644 --- a/Dockerfile.cron +++ b/Dockerfile.cron @@ -50,7 +50,7 @@ RUN mkdir -p /etc/apt/sources.list.d/ ;\ mkdir /volume/ ;\ echo "seafuser" > /etc/cron.allow ;\ echo "*/20 * * * * /bin/bash /home/seafuser/infinite-seaf-cli-start.sh" \ - > /var/spool/cron/crontabs/seafuser \; + > /var/spool/cron/crontabs/seafuser ;\ groupadd -g $GID -o $UNAME ;\ useradd -m -u $UID -g $GID -o -s /bin/bash $UNAME From 19281a3883d3931ca331c8f7f917a1af041d4d41 Mon Sep 17 00:00:00 2001 From: "flow.gunso" Date: Tue, 23 Apr 2019 20:29:31 +0200 Subject: [PATCH 18/35] Rename into a supervisord specific docker entrypoint --- assets/{docker-entrypoint.sh => docker-supervisord-entrypoint.sh} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename assets/{docker-entrypoint.sh => docker-supervisord-entrypoint.sh} (100%) diff --git a/assets/docker-entrypoint.sh b/assets/docker-supervisord-entrypoint.sh similarity index 100% rename from assets/docker-entrypoint.sh rename to assets/docker-supervisord-entrypoint.sh From 82f52e36df817fa3b62d852842d5e583185538ec Mon Sep 17 00:00:00 2001 From: "flow.gunso" Date: Tue, 23 Apr 2019 20:29:42 +0200 Subject: [PATCH 19/35] A a cron specific docker entrypoint --- assets/docker-cron-entrypoint.sh | 54 ++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 assets/docker-cron-entrypoint.sh diff --git a/assets/docker-cron-entrypoint.sh b/assets/docker-cron-entrypoint.sh new file mode 100644 index 0000000..c446e0f --- /dev/null +++ b/assets/docker-cron-entrypoint.sh @@ -0,0 +1,54 @@ +#!/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 . + +# Check mandatory Seafile configuration have been properly set. +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 + +# Update the user ID, if the $UID changed. +if [ "$UID" != "1000" ]; then + usermod -u $UID $UNAME + # What if the $UID already exists ? +fi + +# Change the group, if the $GID changed. +if [ "$GID" != "1000" ]; then + getent group | grep ":$GID:" >/dev/null + if [ $? -eq 0 ]; then + usermod -g $GID -G 1000 $UNAME + else + groupmod -g $GID $UNAME + fi +fi + +# Set the files ownership. +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 + 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 215db335a66a16f4ee1346e8aba1d549f4359e69 Mon Sep 17 00:00:00 2001 From: "flow.gunso" Date: Wed, 24 Apr 2019 11:26:22 +0200 Subject: [PATCH 20/35] Use the proper Docker entrypoint --- Dockerfile.cron | 2 +- Dockerfile.supervisord | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile.cron b/Dockerfile.cron index 1a7a31e..3cd88ab 100644 --- a/Dockerfile.cron +++ b/Dockerfile.cron @@ -25,7 +25,7 @@ ENV GID=1000 # Copy over the Docker related files. COPY utils/build/import-seafile-apt-key.sh / -COPY assets/docker-entrypoint.sh /entrypoint.sh +COPY assets/docker-cron-entrypoint.sh /entrypoint.sh # Safely import Seafile APT key, then install both seafile-cli and supervisord. RUN mkdir -p /etc/apt/sources.list.d/ ;\ diff --git a/Dockerfile.supervisord b/Dockerfile.supervisord index acbcf5c..81dd58e 100644 --- a/Dockerfile.supervisord +++ b/Dockerfile.supervisord @@ -25,7 +25,7 @@ ENV GID=1000 # Copy over the Docker related files. COPY utils/build/import-seafile-apt-key.sh / -COPY assets/docker-entrypoint.sh /entrypoint.sh +COPY assets/docker-supervisord-entrypoint.sh /entrypoint.sh # Safely import Seafile APT key, then install both seafile-cli and supervisord. RUN mkdir -p /etc/apt/sources.list.d/ ;\ From 3e1e7f7b718825a8d97f51341bcca172632382ea Mon Sep 17 00:00:00 2001 From: "flow.gunso" Date: Wed, 24 Apr 2019 11:27:21 +0200 Subject: [PATCH 21/35] Add a Docker image that just run a Bash sub process to keep it alive --- Dockerfile.bash | 56 +++++++++++++++++++++++++++++++ assets/docker-bash-entrypoint.sh | 54 +++++++++++++++++++++++++++++ assets/seafile-bash-entrypoint.sh | 38 +++++++++++++++++++++ 3 files changed, 148 insertions(+) create mode 100644 Dockerfile.bash create mode 100644 assets/docker-bash-entrypoint.sh create mode 100644 assets/seafile-bash-entrypoint.sh diff --git a/Dockerfile.bash b/Dockerfile.bash new file mode 100644 index 0000000..401cde5 --- /dev/null +++ b/Dockerfile.bash @@ -0,0 +1,56 @@ +# 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 . + +FROM debian:jessie-slim + +# Prevent the packages installation to halt. +ENV DEBIAN_FRONTEND noninteractive +# Specify the user running Seafile. +ENV UNAME=seafuser +ENV UID=1000 +ENV GID=1000 + +# Copy over the Docker related files. +COPY utils/build/import-seafile-apt-key.sh / +COPY assets/docker-bash-entrypoint.sh /entrypoint.sh + +# Safely import Seafile APT key, then install both seafile-cli and supervisord. +RUN mkdir -p /etc/apt/sources.list.d/ ;\ + echo "deb http://deb.seadrive.org jessie main" \ + > /etc/apt/sources.list.d/seafile.list ;\ + /bin/bash /import-seafile-apt-key.sh ;\ + apt-get update ;\ + apt-get install \ + -o Dpkg::Options::="--force-confold" \ + -y seafile-cli ;\ + apt-get clean ;\ + apt-get autoclean \ + -o APT::Clean-Installed=true ;\ + rm \ + -f \ + /var/log/fsck/*.log \ + /var/log/apt/*.log \ + /var/cache/debconf/*.dat-old \ + /import-seafile-apt-key.sh ;\ + mkdir /volume ;\ + groupadd -g $GID -o $UNAME ;\ + useradd -m -u $UID -g $GID -o -s /bin/bash $UNAME + +# Copy over the required files for Seafile/SupervisorD. +COPY assets/supervisord.conf assets/infinite-seaf-cli-start.sh /home/seafuser/ +COPY assets/seafile-bash-entrypoint.sh /home/seafuser/entrypoint.sh + +ENTRYPOINT ["/bin/bash", "/entrypoint.sh"] diff --git a/assets/docker-bash-entrypoint.sh b/assets/docker-bash-entrypoint.sh new file mode 100644 index 0000000..c446e0f --- /dev/null +++ b/assets/docker-bash-entrypoint.sh @@ -0,0 +1,54 @@ +#!/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 . + +# Check mandatory Seafile configuration have been properly set. +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 + +# Update the user ID, if the $UID changed. +if [ "$UID" != "1000" ]; then + usermod -u $UID $UNAME + # What if the $UID already exists ? +fi + +# Change the group, if the $GID changed. +if [ "$GID" != "1000" ]; then + getent group | grep ":$GID:" >/dev/null + if [ $? -eq 0 ]; then + usermod -g $GID -G 1000 $UNAME + else + groupmod -g $GID $UNAME + fi +fi + +# Set the files ownership. +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 + 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 diff --git a/assets/seafile-bash-entrypoint.sh b/assets/seafile-bash-entrypoint.sh new file mode 100644 index 0000000..2ceae1a --- /dev/null +++ b/assets/seafile-bash-entrypoint.sh @@ -0,0 +1,38 @@ +#!/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 + +# Prepare the directories. +mkdir ~/.seafile + +# 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 Seafile healthcheck as a disowned process. +(/usr/bin/bash ~/infinite-seaf-cli-start.sh &) \ No newline at end of file From 030111b90c80722c6761154a8e652a82513b4d43 Mon Sep 17 00:00:00 2001 From: "flow.gunso" Date: Wed, 24 Apr 2019 11:27:32 +0200 Subject: [PATCH 22/35] Build the Docker bash image --- utils/publish/feature--cron-or-supervisord.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/utils/publish/feature--cron-or-supervisord.sh b/utils/publish/feature--cron-or-supervisord.sh index 7785594..26f8348 100755 --- a/utils/publish/feature--cron-or-supervisord.sh +++ b/utils/publish/feature--cron-or-supervisord.sh @@ -28,5 +28,7 @@ echo $CI_REGISTRY_BOT_PASSWORD | docker login -u $CI_REGISTRY_BOT_USERNAME docke # Build and push as staging. docker build -t index.docker.io/$CI_REGISTRY_IMAGE:staging-supervisord -f Dockerfile.supervisord . docker build -t index.docker.io/$CI_REGISTRY_IMAGE:staging-cron -f Dockerfile.cron . +docker build -t index.docker.io/$CI_REGISTRY_IMAGE:staging-bash -f Dockerfile.bash . docker push index.docker.io/$CI_REGISTRY_IMAGE:staging-supervisord -docker push index.docker.io/$CI_REGISTRY_IMAGE:staging-cron \ No newline at end of file +docker push index.docker.io/$CI_REGISTRY_IMAGE:staging-cron +docker push index.docker.io/$CI_REGISTRY_IMAGE:staging-bash From 31acb88cdea00d3c03b60e22e08367426712973e Mon Sep 17 00:00:00 2001 From: "flow.gunso" Date: Wed, 24 Apr 2019 11:56:16 +0200 Subject: [PATCH 23/35] Fix path to bash --- assets/seafile-bash-entrypoint.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets/seafile-bash-entrypoint.sh b/assets/seafile-bash-entrypoint.sh index 2ceae1a..228754c 100644 --- a/assets/seafile-bash-entrypoint.sh +++ b/assets/seafile-bash-entrypoint.sh @@ -35,4 +35,4 @@ while [ ! -S $seafile_sock ]; do sleep 1; done /usr/bin/seaf-cli sync -u $SEAF_USERNAME -p $SEAF_PASSWORD -s $SEAF_SERVER_URL -l $SEAF_LIBRARY_UUID -d /volume # Start the Seafile healthcheck as a disowned process. -(/usr/bin/bash ~/infinite-seaf-cli-start.sh &) \ No newline at end of file +(/bin/bash ~/infinite-seaf-cli-start.sh &) \ No newline at end of file From 280b42dc37a32df0238ad7db51578ac8b7698638 Mon Sep 17 00:00:00 2001 From: "flow.gunso" Date: Wed, 24 Apr 2019 11:57:57 +0200 Subject: [PATCH 24/35] Create a pid file for cron --- Dockerfile.cron | 1 + 1 file changed, 1 insertion(+) diff --git a/Dockerfile.cron b/Dockerfile.cron index 3cd88ab..3a5cbb0 100644 --- a/Dockerfile.cron +++ b/Dockerfile.cron @@ -51,6 +51,7 @@ RUN mkdir -p /etc/apt/sources.list.d/ ;\ echo "seafuser" > /etc/cron.allow ;\ echo "*/20 * * * * /bin/bash /home/seafuser/infinite-seaf-cli-start.sh" \ > /var/spool/cron/crontabs/seafuser ;\ + touch /var/run/crond.pid ;\ groupadd -g $GID -o $UNAME ;\ useradd -m -u $UID -g $GID -o -s /bin/bash $UNAME From 00cae794a0b03d97e5ff9ac35ab89469ebd9f9cb Mon Sep 17 00:00:00 2001 From: "flow.gunso" Date: Wed, 24 Apr 2019 11:58:15 +0200 Subject: [PATCH 25/35] Set ownership to the cron.pid file --- assets/docker-cron-entrypoint.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/assets/docker-cron-entrypoint.sh b/assets/docker-cron-entrypoint.sh index c446e0f..4136d61 100644 --- a/assets/docker-cron-entrypoint.sh +++ b/assets/docker-cron-entrypoint.sh @@ -39,9 +39,10 @@ if [ "$GID" != "1000" ]; then fi # Set the files ownership. -chown $UID.$GID -R /home/seafuser/infinite-seaf-cli-start.sh -chown $UID.$GID -R /home/seafuser/entrypoint.sh -chown $UID.$GID -R /volume +chown $UID.$GID /var/run/crond.pid +chown $UID.$GID /home/seafuser/infinite-seaf-cli-start.sh +chown $UID.$GID /home/seafuser/entrypoint.sh +chown $UID.$GID -R /volume # Run the Seafile client as the container user. su - $UNAME << EO From 953b784e92278e4b1daf4b8407397c0e027f22f9 Mon Sep 17 00:00:00 2001 From: "flow.gunso" Date: Wed, 24 Apr 2019 14:23:57 +0200 Subject: [PATCH 26/35] Replace Bash background process with nohup --- assets/seafile-bash-entrypoint.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets/seafile-bash-entrypoint.sh b/assets/seafile-bash-entrypoint.sh index 228754c..d4851ec 100644 --- a/assets/seafile-bash-entrypoint.sh +++ b/assets/seafile-bash-entrypoint.sh @@ -35,4 +35,4 @@ while [ ! -S $seafile_sock ]; do sleep 1; done /usr/bin/seaf-cli sync -u $SEAF_USERNAME -p $SEAF_PASSWORD -s $SEAF_SERVER_URL -l $SEAF_LIBRARY_UUID -d /volume # Start the Seafile healthcheck as a disowned process. -(/bin/bash ~/infinite-seaf-cli-start.sh &) \ No newline at end of file +nohup /bin/bash ~/infinite-seaf-cli-start.sh & \ No newline at end of file From ef1f52560cb5005221f259644ad292b90ffb89f3 Mon Sep 17 00:00:00 2001 From: "flow.gunso" Date: Wed, 24 Apr 2019 14:40:25 +0200 Subject: [PATCH 27/35] Run cron as root --- Dockerfile.cron | 1 - assets/docker-bash-entrypoint.sh | 4 +++- assets/seafile-cron-entrypoint.sh | 5 +---- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/Dockerfile.cron b/Dockerfile.cron index 3a5cbb0..3cd88ab 100644 --- a/Dockerfile.cron +++ b/Dockerfile.cron @@ -51,7 +51,6 @@ RUN mkdir -p /etc/apt/sources.list.d/ ;\ echo "seafuser" > /etc/cron.allow ;\ echo "*/20 * * * * /bin/bash /home/seafuser/infinite-seaf-cli-start.sh" \ > /var/spool/cron/crontabs/seafuser ;\ - touch /var/run/crond.pid ;\ groupadd -g $GID -o $UNAME ;\ useradd -m -u $UID -g $GID -o -s /bin/bash $UNAME diff --git a/assets/docker-bash-entrypoint.sh b/assets/docker-bash-entrypoint.sh index c446e0f..43711a7 100644 --- a/assets/docker-bash-entrypoint.sh +++ b/assets/docker-bash-entrypoint.sh @@ -51,4 +51,6 @@ su - $UNAME << EO export SEAF_LIBRARY_UUID=$SEAF_LIBRARY_UUID export UNAME=$UNAME /bin/bash /home/seafuser/entrypoint.sh -EO \ No newline at end of file +EO + +cron -f \ No newline at end of file diff --git a/assets/seafile-cron-entrypoint.sh b/assets/seafile-cron-entrypoint.sh index 5eda987..7716ba7 100644 --- a/assets/seafile-cron-entrypoint.sh +++ b/assets/seafile-cron-entrypoint.sh @@ -33,7 +33,4 @@ while [ ! -f $seafile_ini ]; do sleep 1; done 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/sbin/cron -f \ No newline at end of file +/usr/bin/seaf-cli sync -u $SEAF_USERNAME -p $SEAF_PASSWORD -s $SEAF_SERVER_URL -l $SEAF_LIBRARY_UUID -d /volume \ No newline at end of file From b8eef1e1613c76f408768d348e75c77ef5a7c823 Mon Sep 17 00:00:00 2001 From: "flow.gunso" Date: Wed, 24 Apr 2019 15:09:30 +0200 Subject: [PATCH 28/35] Use cron where it should be used --- assets/docker-bash-entrypoint.sh | 4 +--- assets/docker-cron-entrypoint.sh | 4 +++- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/assets/docker-bash-entrypoint.sh b/assets/docker-bash-entrypoint.sh index 43711a7..c446e0f 100644 --- a/assets/docker-bash-entrypoint.sh +++ b/assets/docker-bash-entrypoint.sh @@ -51,6 +51,4 @@ su - $UNAME << EO export SEAF_LIBRARY_UUID=$SEAF_LIBRARY_UUID export UNAME=$UNAME /bin/bash /home/seafuser/entrypoint.sh -EO - -cron -f \ No newline at end of file +EO \ No newline at end of file diff --git a/assets/docker-cron-entrypoint.sh b/assets/docker-cron-entrypoint.sh index 4136d61..72b4189 100644 --- a/assets/docker-cron-entrypoint.sh +++ b/assets/docker-cron-entrypoint.sh @@ -52,4 +52,6 @@ su - $UNAME << EO export SEAF_LIBRARY_UUID=$SEAF_LIBRARY_UUID export UNAME=$UNAME /bin/bash /home/seafuser/entrypoint.sh -EO \ No newline at end of file +EO + +cron -f \ No newline at end of file From 76c26f7356f5ad7d7e0cd7fd2ba938f44e083131 Mon Sep 17 00:00:00 2001 From: "flow.gunso" Date: Wed, 24 Apr 2019 17:19:31 +0200 Subject: [PATCH 29/35] Remove the infinite seafile restart process --- assets/seafile-bash-entrypoint.sh | 3 --- 1 file changed, 3 deletions(-) diff --git a/assets/seafile-bash-entrypoint.sh b/assets/seafile-bash-entrypoint.sh index d4851ec..c7e529b 100644 --- a/assets/seafile-bash-entrypoint.sh +++ b/assets/seafile-bash-entrypoint.sh @@ -33,6 +33,3 @@ 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 Seafile healthcheck as a disowned process. -nohup /bin/bash ~/infinite-seaf-cli-start.sh & \ No newline at end of file From ab2c6dc1a7e9c39c16234ac7190f7881990acec2 Mon Sep 17 00:00:00 2001 From: "flow.gunso" Date: Wed, 24 Apr 2019 17:19:49 +0200 Subject: [PATCH 30/35] Add the infinite seafile restart process --- assets/docker-bash-entrypoint.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/assets/docker-bash-entrypoint.sh b/assets/docker-bash-entrypoint.sh index c446e0f..3883532 100644 --- a/assets/docker-bash-entrypoint.sh +++ b/assets/docker-bash-entrypoint.sh @@ -51,4 +51,6 @@ su - $UNAME << EO export SEAF_LIBRARY_UUID=$SEAF_LIBRARY_UUID export UNAME=$UNAME /bin/bash /home/seafuser/entrypoint.sh -EO \ No newline at end of file +EO + +nohup /bin/bash ~/infinite-seaf-cli-start.sh & From 2f465ca270eba23c3ca0c043a0e7a3c68bd1b97e Mon Sep 17 00:00:00 2001 From: "flow.gunso" Date: Wed, 24 Apr 2019 17:20:14 +0200 Subject: [PATCH 31/35] Dont change ownership to crond.pid --- assets/docker-cron-entrypoint.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/assets/docker-cron-entrypoint.sh b/assets/docker-cron-entrypoint.sh index 72b4189..39ea374 100644 --- a/assets/docker-cron-entrypoint.sh +++ b/assets/docker-cron-entrypoint.sh @@ -39,7 +39,6 @@ if [ "$GID" != "1000" ]; then fi # Set the files ownership. -chown $UID.$GID /var/run/crond.pid chown $UID.$GID /home/seafuser/infinite-seaf-cli-start.sh chown $UID.$GID /home/seafuser/entrypoint.sh chown $UID.$GID -R /volume From ee0975a1aa369e9992e2075562294b975654675e Mon Sep 17 00:00:00 2001 From: "flow.gunso" Date: Wed, 24 Apr 2019 18:36:26 +0200 Subject: [PATCH 32/35] Replace nohup with exec --- assets/docker-bash-entrypoint.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets/docker-bash-entrypoint.sh b/assets/docker-bash-entrypoint.sh index 3883532..9a6e098 100644 --- a/assets/docker-bash-entrypoint.sh +++ b/assets/docker-bash-entrypoint.sh @@ -53,4 +53,4 @@ su - $UNAME << EO /bin/bash /home/seafuser/entrypoint.sh EO -nohup /bin/bash ~/infinite-seaf-cli-start.sh & +exec /bin/bash ~/infinite-seaf-cli-start.sh & From 67f09f71b2f8849982a18c3c995e454cd1b40679 Mon Sep 17 00:00:00 2001 From: "flow.gunso" Date: Wed, 24 Apr 2019 20:54:21 +0200 Subject: [PATCH 33/35] Switch the infinite restart to the Seafile entrypoint --- assets/docker-bash-entrypoint.sh | 4 +--- assets/seafile-bash-entrypoint.sh | 3 +++ 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/assets/docker-bash-entrypoint.sh b/assets/docker-bash-entrypoint.sh index 9a6e098..c446e0f 100644 --- a/assets/docker-bash-entrypoint.sh +++ b/assets/docker-bash-entrypoint.sh @@ -51,6 +51,4 @@ su - $UNAME << EO export SEAF_LIBRARY_UUID=$SEAF_LIBRARY_UUID export UNAME=$UNAME /bin/bash /home/seafuser/entrypoint.sh -EO - -exec /bin/bash ~/infinite-seaf-cli-start.sh & +EO \ No newline at end of file diff --git a/assets/seafile-bash-entrypoint.sh b/assets/seafile-bash-entrypoint.sh index c7e529b..fac55c9 100644 --- a/assets/seafile-bash-entrypoint.sh +++ b/assets/seafile-bash-entrypoint.sh @@ -33,3 +33,6 @@ 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 + +# Run the infinite Seafile restart. +/bin/bash ~/infinite-seaf-cli-start.sh & From cf39d73cc552db84ed744a54886b29f0a64521c7 Mon Sep 17 00:00:00 2001 From: "flow.gunso" Date: Thu, 25 Apr 2019 07:51:18 +0200 Subject: [PATCH 34/35] Use source instead of exec --- assets/seafile-bash-entrypoint.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets/seafile-bash-entrypoint.sh b/assets/seafile-bash-entrypoint.sh index fac55c9..5d9eb61 100644 --- a/assets/seafile-bash-entrypoint.sh +++ b/assets/seafile-bash-entrypoint.sh @@ -35,4 +35,4 @@ while [ ! -S $seafile_sock ]; do sleep 1; done /usr/bin/seaf-cli sync -u $SEAF_USERNAME -p $SEAF_PASSWORD -s $SEAF_SERVER_URL -l $SEAF_LIBRARY_UUID -d /volume # Run the infinite Seafile restart. -/bin/bash ~/infinite-seaf-cli-start.sh & +source ~/infinite-seaf-cli-start.sh & From cf2b56d658af911af81a1f4a810be5678c9e456c Mon Sep 17 00:00:00 2001 From: "flow.gunso" Date: Thu, 25 Apr 2019 12:51:36 +0200 Subject: [PATCH 35/35] Remove ampersand to start in the background --- assets/seafile-bash-entrypoint.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets/seafile-bash-entrypoint.sh b/assets/seafile-bash-entrypoint.sh index 5d9eb61..52aa07d 100644 --- a/assets/seafile-bash-entrypoint.sh +++ b/assets/seafile-bash-entrypoint.sh @@ -35,4 +35,4 @@ while [ ! -S $seafile_sock ]; do sleep 1; done /usr/bin/seaf-cli sync -u $SEAF_USERNAME -p $SEAF_PASSWORD -s $SEAF_SERVER_URL -l $SEAF_LIBRARY_UUID -d /volume # Run the infinite Seafile restart. -source ~/infinite-seaf-cli-start.sh & +source ~/infinite-seaf-cli-start.sh