Rescue Alpine-era uploads before public volume wipe#875
Open
zsdonny wants to merge 1 commit intoinvoiceninja:debianfrom
Open
Rescue Alpine-era uploads before public volume wipe#875zsdonny wants to merge 1 commit intoinvoiceninja:debianfrom
zsdonny wants to merge 1 commit intoinvoiceninja:debianfrom
Conversation
…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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:linkand never setsFILESYSTEM_DISK, so Laravel auto-createspublic/storage/as a real directory on the public volume and writes all uploads there. Debian'sinit.shthen runsrm -rf /var/www/html/public/*on startup, wiping those uploads before the user has any chance to act.Fix
Before the
rm -rf, detect ifpublic/storageis a real directory (not a symlink). If it is, copy its contents tostorage/app/public/(the correct Debian location) first.On a normal Debian deployment
public/storageis a symlink, so this block is skipped entirely — no impact to existing deployments.Closes #874