@girish & @jdelon02
I believe LAMP app supports cron, in that case use the following script to auto-pull from a git repo whenever an update is pushed to that repo:
Put in /app/data/updateGit
#!/bin/sh
## CD to the path where the app is installed.
cd /app/data/public
UPSTREAM=${1:-'@{u}'}
LOCAL=$(git rev-parse @)
REMOTE=$(git rev-parse "$UPSTREAM")
BASE=$(git merge-base @ "$UPSTREAM")
if [ $LOCAL = $REMOTE ]; then
echo "Up-to-date"
elif [ $LOCAL = $BASE ]; then
echo "Need to pull"
git pull
elif [ $REMOTE = $BASE ]; then
echo "Need to push? Some files changed / commited here, this should not have happened."
else
echo "Diverged?? Help!"
fi
Then in /app/data/crontab:
*/5 * * * * bash /app/data/updateGit 2>&1
## Or if you wanna avoid filling logs:
*/5 * * * * bash /app/data/updateGit 2>&1 > /dev/null
This will check if a pull is needed from a repo every 5 minutes. (Re: https://crontab.guru/every-5-minutes)
You can also modify the bash script to rebuild, npm install, composer install, etc when needed too.