try to fix permits upload restore/merge upon deployment
This commit is contained in:
@ -27,11 +27,16 @@ if [ "$UPDATE_CODE_FROM_GIT" = "true" ]; then
|
||||
|
||||
|
||||
########################################################################################
|
||||
# Backup permits folder if it exists
|
||||
mkdir -p /tmp/content
|
||||
if [ -d "/app/public/content/permits" ]; then
|
||||
mv /app/public/content/permits /tmp/content/permits
|
||||
echo "Backing up permits folder..." | tee -a /app/logs/deploy.txt
|
||||
cp -r /app/public/content/permits /tmp/content/
|
||||
echo "Permits folder backed up successfully." | tee -a /app/logs/deploy.txt
|
||||
ls -la /tmp/content/permits >> /app/logs/deploy.txt 2>&1
|
||||
else
|
||||
echo "Permits folder not found, skipping backup." | tee -a /app/logs/deploy.txt
|
||||
echo "Permits folder not found, will create it after deployment." | tee -a /app/logs/deploy.txt
|
||||
mkdir -p /tmp/content/permits
|
||||
fi
|
||||
|
||||
# Run rsync with verbose output and itemize-changes
|
||||
@ -55,13 +60,16 @@ if [ "$UPDATE_CODE_FROM_GIT" = "true" ]; then
|
||||
|
||||
# Restore permits folder
|
||||
echo "Restoring permits folder..." | tee -a /app/logs/deploy.txt
|
||||
# Always ensure the destination directory exists
|
||||
mkdir -p /app/public/content
|
||||
# Make sure the backed up permits exist before copying
|
||||
if [ -d "/tmp/content/permits" ]; then
|
||||
# Ensure the destination directory exists
|
||||
mkdir -p /app/public/content
|
||||
mv /tmp/content/permits /app/public/content/permits
|
||||
cp -r /tmp/content/permits /app/public/content/
|
||||
echo "Permits folder restored successfully." | tee -a /app/logs/deploy.txt
|
||||
ls -la /app/public/content/permits >> /app/logs/deploy.txt 2>&1
|
||||
else
|
||||
echo "No permits folder to restore." | tee -a /app/logs/deploy.txt
|
||||
echo "ERROR: Backup permits folder not found. Creating empty directory." | tee -a /app/logs/deploy.txt
|
||||
mkdir -p /app/public/content/permits
|
||||
fi
|
||||
|
||||
# Check contents after restoration
|
||||
|
Reference in New Issue
Block a user