rails images remove on each deployment

February 17, 2019 304 views
DigitalOcean Debian

I deployed rails app completely following
Deploying a Rails App on Ubuntu 14.04 with Capistrano, Nginx, and Puma
everything working fine but on each deployment it removes images from public/system when I run

cap production deploy

What the issue here?

2 comments
1 Answer

digital ocean support response:

This is because when a new version of your app is deployed, the directory is empty.
Fortunately, you can resolve this by creating a symlink to a shared directory.
You can do this by editing the deploy.rb file, changing the following line

set :linked_dirs, %w{bin log tmp/pids tmp/cache tmp/sockets vendor/bundle public/system}

to:
set :linked_dirs, %w{bin log tmp/pids tmp/cache tmp/sockets vendor/bundle public/system

and its working now

  • I don't see any difference between them, but good to got it sorted out.

    • my bad, it was commented like

      set :linked_dirs, %w{bin log tmp/pids tmp/cache tmp/sockets vendor/bundle public/system}

      so just uncommented it like
      set :linked_dirs, %w{bin log tmp/pids tmp/cache tmp/sockets vendor/bundle public/system}

Have another answer? Share your knowledge.