0

I use Capistrano 3 and its plugin capistrano/symfony to deploy my Symfony application on a webserver. This server uses Nginx under Debian 8.

When I run cap prod deploy, the script works. I can see my new release on /var/www/myapp/releases. /var/www/myapp/current is a symbolic link that points to my latest release.

But when I access to my app, it stills serving the old release. I tried to restart nginx, but the issue stills the same.

The only "solution" I found is to delete /var/www/myapp/current and /var/www/myapp/releases before running the Capistrano deployment.

Have you got an idea of where it can come from ?

maxime
  • 1,993
  • 3
  • 28
  • 57

1 Answers1

2

This is not nginx issue usually, but PHP caches (opcache, realpath, etc). So you can delete old folders manually (boring), write clear-all-php-caches script (results may vary) OR add php restart task into Capistrano 3 deploy process (my example for CentOS 7 with php-fpm):

namespace :deploy do
...
  desc 'Restart application'
  task :restart do
    on roles(:app), in: :sequence, wait: 5 do
        sudo 'service php-fpm restart'
    end
  end
...
end
Aleksey Deryagin
  • 2,575
  • 2
  • 20
  • 18
  • Restarting php-fpm module in the end of deploy solved the problem ! It seems that cache modules have the habit to store the hard link, so they do not refresh the realpath to the current symlink. Good to know, thank you ! – maxime Feb 24 '16 at 16:35