The script now prints the chown command needed after pushing data, since uploaded files are owned by admin and the web server can't write to them. Updated docs to match. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
32 lines
849 B
Bash
Executable File
32 lines
849 B
Bash
Executable File
#!/bin/sh
|
|
USER=admin
|
|
HOST=social
|
|
DIR=/var/www/my_webapp__2/www
|
|
|
|
# Deploy code files
|
|
rsync -avz --no-t --no-p --delete \
|
|
--exclude 'data/' \
|
|
index.html api.php containers.json categories.json og-image.png ${HOST}:${DIR}
|
|
|
|
# Deploy data directory protection
|
|
scp data/index.php ${HOST}:${DIR}/data/index.php 2>/dev/null || true
|
|
|
|
# Handle data files
|
|
if [ "$1" = "--reset-data" ]; then
|
|
echo "Pushing local data to server..."
|
|
rsync -avz --no-t --no-p \
|
|
data/ ${HOST}:${DIR}/data/
|
|
echo ""
|
|
echo "*** Data pushed. Fix ownership so the web server can write: ***"
|
|
echo " ssh ${HOST} \"sudo chown -R my_webapp__2:my_webapp__2 ${DIR}/data/\""
|
|
echo ""
|
|
else
|
|
echo "Pulling data from server..."
|
|
mkdir -p data
|
|
rsync -avz --no-t --no-p \
|
|
--exclude 'pin.txt' \
|
|
${HOST}:${DIR}/data/ data/
|
|
fi
|
|
|
|
exit 0
|