Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement waiting for remote parent directory #197

Merged
merged 3 commits into from
Jul 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions webdav-rclone-sidecar/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,20 @@ Using environment:
* WEBDAV\_VENDOR: WebDAV vendor (default: *other*)
* MOUNT\_OPTS: space separated additional arguments for *rclone mount* command
* MOUNT\_PATH: mount path (default: */mnt*)
* MOUNT\_WAIT: wait time for mountpoint in /proc/mounts (default: *20*)
* MOUNT\_WAIT\_POINT: mountpoint regular expression to wait for (default: (empty))
* VFS\_CACHE\_MODE: value for rclone VFS cache mode (off, minimal, writes, full) (default: *full*)

Examples:

docker run --privileged -it --rm --name oidcmount -v /tmp/webdav:/mnt:shared
docker run --privileged -it --rm --name oidcmount -v /tmp/webdav:/mnt:shared \
-e WEBDAV_URL="$WEBDAV_URL" \
-e WEBDAV_TOKEN="$(oidc-token my-issuer)" \
webdav-rclone-sidecar" &

echo "$(oidc-token my-issuer)" >/tmp/token
docker run --privileged -it --rm --name oidcmount -v /tmp/webdav:/mnt:shared -v /tmp/token:/tmp/token
docker run --privileged -it --rm --name oidcmount -v /tmp/webdav:/mnt:shared -v /tmp/token:/tmp/token \
-e MOUNT_PATH="/mnt/subpath" \
-e MOUNT_WAIT_POINT="webdav-fs: /mnt fuse.rclone " \
-e WEBDAV_URL="$WEBDAV_URL" \
webdav-rclone-sidecar bearer_token_command="cat /tmp/token" &
11 changes: 11 additions & 0 deletions webdav-rclone-sidecar/mount.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,21 @@
MOUNT_OPTS=${MOUNT_OPTS:-}
# where to mount
MOUNT_PATH=${MOUNT_PATH:-/mnt/}
MOUNT_WAIT=${MOUNT_WAIT:-20}
JOVYAN_UID=${JOVYAN_UID:-1000}
JOVYAN_GRP=${JOVYAN_GRP:-100}
VFS_CACHE_MODE=${VFS_CACHE_MODE:-full}

if [ -n "$MOUNT_WAIT_POINT" ]; then
i=0
echo "Checking $MOUNT_WAIT_POINT ($MOUNT_PATH)..."
while ! grep "^$MOUNT_WAIT_POINT" /proc/mounts && test $i -lt $((2 * MOUNT_WAIT)); do
echo "Waiting for $MOUNT_WAIT_POINT..."
sleep 0.5
i=$((i + 1))
done
fi

if [ ! -d "$MOUNT_PATH" ]; then
mkdir -p "$MOUNT_PATH"
chown "$JOVYAN_UID:$JOVYAN_GRP" "$MOUNT_PATH"
Expand Down