Laravel deployment cache before server restart

When I applied the Laravel 4.2.9 application to Ubuntu 14.04 server using Capistrano, it looks like all my php files are cached by PHP, Laravel or Nginx. I have to manually restart the server to close the cache and see any of my changes.

Capistrano creates a new release directory on the server and runs it git checkoutinternally to get the latest tagged version. When the deployment is complete, the "current" symbolic link will be updated to point to the new release directory. The only shared files are the directory of my downloads and the environment settings file.

Things I tried:

  • php artisan cache:clear
  • composer dump-autoload

Only restarting the manual server after deployment will result in a cache failure that has downtime (also for other sites hosted on this server) and additional risks.

Anyone have a suggestion, could it be Nginx, PHP or Laravel?

0
source share
1 answer

I had a similar problem when deploying my Laravel 5 application and it looks like he solved it by adding the following to the end of Capistrano deploy.rb:

namespace :deploy do
    desc "Build"
    after :updated, :build do
        on roles(:web) do
            within release_path  do
                execute :composer, "install --no-dev --quiet"
                execute :php, "artisan clear-compiled"
                execute :php, "artisan cache:clear"
                execute :php, "artisan view:clear"
                execute :php, "artisan twig:clean" # For use with TwigBridge
                execute :php, "artisan route:cache"
                execute :php, "artisan config:cache"
            end
        end
    end
end

(If you are not using TwigBridge , be sure to delete the line twig:clean.)

Edited to include strings clear-compiledand view:clearsince they seem to solve additional problems with deploying Laravel applications using Capistrano.

+2
source

Source: https://habr.com/ru/post/1692502/


All Articles