Deploy Script issue with tmp/fpmlock and Isolation Mode
I have been using a server without issue on Digital Ocean for months. This past weekend I added a site in isolation mode on the same server. Well when I ran a deployment on a non-isolation site it would error: tmp/fpmlock error. It seems creating an isolation mode site changes the user/group of tmp/fpmlock. I went and changed it back to forge/forge and now it works again. But the isolation site won't deploy. Do I have to create a fpmlock folder for each isolation account with the appropriate user/group for each site? Seems this should be something that Forge should manage? Am I missing something?
/home/forge/.forge/provision-11158855.sh: line 32: /tmp/fpmlock: Permission denied
Although these solutions seemed to work initially for me, I've had ongoing issues with it. One thing that seemed to help for a while was modify the script to explicitly change permissions on the lock file to ensure everyone has write access - ie:
( flock -w 10 9 || exit 1
sudo -S service php8.2-fpm reload ) 9>/tmp/fpmlock
chmod 666 /tmp/fpmlock 2>/dev/null # Allow anyone to delete/modify the lock file
...but in some cases even this didn't do the trick. It's not ideal... but my latest attempt to solve the issue is to use directory locking instead of file locking - ie:
if mkdir /tmp/fpmlockdir 2>/dev/null; then
sudo -S service php8.2-fpm reload
rmdir /tmp/fpmlockdir
else
echo "Failed to acquire lock for php8.2-fpm. Skipping..."
exit 1
fi