It seems that your deployment process is missing a step to clear the cache. The commands you listed (artisan:view:cache, artisan:config:cache, and artisan:optimize) are for caching the views, configuration, and optimizing the framework for better performance, respectively. However, to ensure that the cache is cleared and rebuilt, you should include the artisan:cache:clear command in your deployment process.
Here's how you can modify your deploy.yml file to include the cache clearing step:
tasks:
deploy:
- deploy:prepare
- deploy:vendors
- artisan:storage:link
- artisan:cache:clear # Add this line to clear the cache
- artisan:view:cache
- artisan:config:cache
- artisan:optimize
- artisan:migrate
- artisan:queue:restart
- artisan:horizon:terminate
- deploy:publish
By adding the artisan:cache:clear command, you ensure that the application's cache is cleared on each deployment. This should resolve the issue of the cache not being updated.
Additionally, if you are using Laravel's cache tags or driver-specific features, make sure that the cache driver you are using supports those features. For example, the file cache driver does not support cache tags.
If you continue to experience issues, you may want to verify the permissions of the cache directory to ensure that the ploi user has the necessary permissions to write to and delete files within ~/staging.site.com/shared/storage/framework/cache/. You can check and fix the permissions with the following commands:
# Navigate to the shared storage directory
cd ~/staging.site.com/shared/storage
# Recursively set the correct permissions for the framework cache directory
sudo chown -R ploi:ploi framework/cache
sudo chmod -R u+rwX,go+rX,go-w framework/cache
Replace ploi:ploi with the appropriate user and group for your server environment if different. The chmod command sets read and write permissions for the user, and read permissions for the group and others, while ensuring that directories are executable (which is necessary for directory access).
After making these changes, try deploying again and check if the cache is properly cleared and rebuilt.