I have a laravel 8.75 project that is already online. I use symbolic links to change versions. Until now it works fine (several changes with success). I made a bash script to changes versions :
if [ "$#" -ne 2 ]; then
echo "Command: ./update_version old_version new_version"
else
echo "0 - Updating version '$1' to version '$2'"
cd ~
cd laravel/
echo "1/9 - Unlink current..."
if unlink current ; then
echo "1/9 - Done"
echo "2/9 - Creation of new current symbolic link..."
if ln -s /home/x/laravel/releases/$2 /home/x/laravel/current ; then
echo "2/9 - Done"
echo "3/9 - Creation of .env symbolic link..."
if ln -s /home/x/laravel/.env /home/x/laravel/releases/$2/.env ; then
echo "3/9 - Done"
echo "4/9 - Copy .htaccess file..."
if cp /home/x/laravel/releases/$1/public/.htaccess /home/x/laravel/releases/$2/public ; then
echo "4/9 - Done"
echo "5/9 - Copy storage folder..."
if cp -r /home/x/laravel/releases/$1/storage/app/public /home/x/laravel/releases/$2/storage/app/ ; then
echo "5/9 - Done"
echo "6/9 - Move matomo folder..."
if mv /home/x/laravel/releases/$1/public/matomo /home/x/laravel/releases/$2/public/ ; then
echo "6/9 - Done"
echo "7/9 - Creation of storage files symbolic link"
if ln -s /home/x/laravel/releases/$2/storage/app/public /home/x/laravel/releases/$2/public/storage ; then
echo "7/9 - Done"
cd /home/x/laravel/releases/$2
echo "8/9 - Composer install..."
composer install
echo "8/9 - Done"
# Executer les migrations
echo "9/9 - Run migrations..."
if php artisan migrate ; then
echo "9/9 - Done"
echo "Update is successful!"
else
echo "9/9 - Failed to run migrations"
fi
else
echo "7/9 - Failed to create symbolic link for storage files"
fi
else
echo "6/9 - Failed to copy matomo folder"
fi
else
echo "5/9 - Failed to copy storage folder"
fi
else
echo "4/9 - Failed to copy .htaccess"
fi
else
echo "3/9 - Failed to create symbolic link to .env"
fi
else
echo "2/9 - Failed to create new current link"
fi
else
echo " 1/9 - Failed to destroy the current link"
fi
fi
Today I have to change version (new css file, new routes, javascript modifications...).
As always I run ./update-version old-version new-version
and it works (nothing failed and the symbolic link is ok), it's my new version online (I know it because js modifications are displayed).
But for some reasons, my new routes and the new css files are not served.
In the inspector I can see that the css file on "Network" is the old one.
I run php artisan optimize:clear
into the new release but it doens't change anything...
On my production server files modifications are there but not on browsers (window and inspector).
If I upload the new css file into the old release and change the stylesheet url it works.
So it has to be the files in new release which cause this but I don't know which ones...
Has anyone ever encountered this? Or does anyone have an idea where the problem could be?
Answer
-> Can you please follow step below to check CSS files are not being served after updating your Laravel website
-> To troubleshoot the issue, you can try above steps:
-> I think this will help you to solve the issue. If you still getting the error then check Laravel error log to understand the exact issue.