Skip to content

Rescue Alpine-era uploads before public volume wipe#875

Open
zsdonny wants to merge 1 commit intoinvoiceninja:debianfrom
zsdonny:fix/alpine-to-debian-migration-data-loss
Open

Rescue Alpine-era uploads before public volume wipe#875
zsdonny wants to merge 1 commit intoinvoiceninja:debianfrom
zsdonny:fix/alpine-to-debian-migration-data-loss

Conversation

@zsdonny
Copy link
Copy Markdown

@zsdonny zsdonny commented Apr 6, 2026

Problem

When migrating from the Alpine image to the Debian image by swapping the image in docker-compose while reusing the same named volumes, all uploaded documents are silently destroyed on first start.

Why: Alpine never calls storage:link and never sets FILESYSTEM_DISK, so Laravel auto-creates public/storage/ as a real directory on the public volume and writes all uploads there. Debian's init.sh then runs rm -rf /var/www/html/public/* on startup, wiping those uploads before the user has any chance to act.

Fix

Before the rm -rf, detect if public/storage is a real directory (not a symlink). If it is, copy its contents to storage/app/public/ (the correct Debian location) first.

On a normal Debian deployment public/storage is a symlink, so this block is skipped entirely — no impact to existing deployments.

Closes #874

…ceninja#874)

When migrating from the Alpine image to the Debian image, uploads stored
under public/storage (a real directory on the public volume) were silently
destroyed by the rm -rf in the update block.

Before wiping, check if public/storage is a real directory (not a symlink).
If so, copy its contents to storage/app/public/ first, which is the correct
location for the Debian image. On normal Debian deployments public/storage
is a symlink, so this migration block is skipped entirely.
@zsdonny zsdonny changed the title fix: rescue Alpine-era uploads before public volume wipe (fixes #874) Rescue Alpine-era uploads before public volume wipe Apr 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Alpine → Debian migration silently destroys uploaded documents due to init.sh and storage path mismatch

1 participant