fix: Mount SMB root and create subdirectories automatically
- Mount /mnt/smb-ame as /smb-share in container - Entrypoint creates watch/output/logs subdirectories if missing - Creates bind-mounts from /smb-share/watch to /watch, etc. - Graceful fallback if SMB share not mounted on host - Works without pre-existing subdirectories on SMB server Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
1c61d953fd
commit
ba39da5098
2 changed files with 36 additions and 10 deletions
|
|
@ -34,9 +34,8 @@ services:
|
||||||
# Mount SMB share from host — pre-mount at host level with:
|
# Mount SMB share from host — pre-mount at host level with:
|
||||||
# sudo mount -t cifs //172.18.210.5/ame /mnt/smb-ame \
|
# sudo mount -t cifs //172.18.210.5/ame /mnt/smb-ame \
|
||||||
# -o username=smb,password=Production2020!,uid=1000,gid=1000,file_mode=0755,dir_mode=0755,vers=3.0
|
# -o username=smb,password=Production2020!,uid=1000,gid=1000,file_mode=0755,dir_mode=0755,vers=3.0
|
||||||
- /mnt/smb-ame/watch:/watch
|
# The container will create watch/output/logs subdirectories if they don't exist
|
||||||
- /mnt/smb-ame/output:/output
|
- /mnt/smb-ame:/smb-share
|
||||||
- /mnt/smb-ame/logs:/ame-logs
|
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
app_data:
|
app_data:
|
||||||
|
|
|
||||||
|
|
@ -3,14 +3,41 @@ set -e
|
||||||
|
|
||||||
echo "=== AME Remote Job Manager — Entrypoint ==="
|
echo "=== AME Remote Job Manager — Entrypoint ==="
|
||||||
|
|
||||||
# Verify mount points are accessible (mounted by host via docker-compose.yml bind-mounts)
|
# Mount points from docker-compose.yml bind-mounts
|
||||||
echo "Checking mount points..."
|
SMB_SHARE="/smb-share"
|
||||||
for mount_point in /watch /output /ame-logs; do
|
WATCH_DIR="/watch"
|
||||||
if [ -d "$mount_point" ]; then
|
OUTPUT_DIR="/output"
|
||||||
echo "✓ $mount_point is accessible"
|
LOGS_DIR="/ame-logs"
|
||||||
|
|
||||||
|
# Check if SMB share is mounted
|
||||||
|
if [ ! -d "$SMB_SHARE" ]; then
|
||||||
|
echo "⚠ SMB share not mounted at $SMB_SHARE"
|
||||||
|
echo " Ensure the host has mounted: sudo mount -t cifs //172.18.210.5/ame /mnt/smb-ame"
|
||||||
|
mkdir -p "$WATCH_DIR" "$OUTPUT_DIR" "$LOGS_DIR"
|
||||||
|
echo "Created fallback local directories"
|
||||||
|
else
|
||||||
|
echo "✓ SMB share mounted at $SMB_SHARE"
|
||||||
|
|
||||||
|
# Create subdirectories if they don't exist
|
||||||
|
mkdir -p "$SMB_SHARE/watch" "$SMB_SHARE/output" "$SMB_SHARE/logs"
|
||||||
|
|
||||||
|
# Bind-mount SMB subdirectories to container paths
|
||||||
|
mkdir -p "$WATCH_DIR" "$OUTPUT_DIR" "$LOGS_DIR"
|
||||||
|
|
||||||
|
mount --bind "$SMB_SHARE/watch" "$WATCH_DIR" 2>/dev/null || echo "⚠ Could not bind watch folder"
|
||||||
|
mount --bind "$SMB_SHARE/output" "$OUTPUT_DIR" 2>/dev/null || echo "⚠ Could not bind output folder"
|
||||||
|
mount --bind "$SMB_SHARE/logs" "$LOGS_DIR" 2>/dev/null || echo "⚠ Could not bind logs folder"
|
||||||
|
|
||||||
|
echo "✓ Mount points configured"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Verify paths exist
|
||||||
|
echo "Verifying mount points..."
|
||||||
|
for dir in "$WATCH_DIR" "$OUTPUT_DIR" "$LOGS_DIR"; do
|
||||||
|
if [ -d "$dir" ]; then
|
||||||
|
echo "✓ $dir is accessible"
|
||||||
else
|
else
|
||||||
echo "⚠ $mount_point not found — ensure SMB share is mounted on host"
|
echo "⚠ $dir not accessible"
|
||||||
mkdir -p "$mount_point"
|
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue