Skip to content

Instantly share code, notes, and snippets.

@depuits
Created November 30, 2020 17:01
Show Gist options
  • Save depuits/115b35515f753e9d634e1457307f0d66 to your computer and use it in GitHub Desktop.
Save depuits/115b35515f753e9d634e1457307f0d66 to your computer and use it in GitHub Desktop.
script for updating last-watch-ai
#!/bin/bash
# stop the current app
cd last-watch-ai
sudo docker-compose down
cd ..
# move old install
mv last-watch-ai last-watch-ai-old
# download new version
echo "Downloading new version"
curl -s https://api.github.com/repos/akmolina28/last-watch-ai/releases/latest \
| grep "browser_download_url" \
| cut -d : -f 2,3 \
| tr -d \" \
| wget -qi - -O - > last-watch-ai-latest.zip
unzip -q last-watch-ai-latest.zip -d .
# copy previous config file
cp last-watch-ai-old/.env last-watch-ai/.env
# copy sql data
sudo cp -R last-watch-ai-old/mysql last-watch-ai/mysql
echo "Running migration"
cd last-watch-ai
# linux temp fix stuff (https://github.com/akmolina28/last-watch-ai/issues/2)
sudo chown -R www-data:www-data src
sudo find src -type f -exec chmod 644 {} \;
sudo find src -type d -exec chmod 755 {} \;
# run migration
sudo docker-compose run --rm artisan migrate
#start the program
sudo docker-compose up -d --build site
# more linux fixes
sudo docker exec -it lw_php rm /var/www/app/public/storage
sudo docker exec -it lw_php php artisan storage:link
sudo rm -rf ../last-watch-ai-old
echo "Update complete"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment