When i try to deploy my new application, everything went smooth. But i used to had the problem that my posts in my db disappear after a capistrano deploy. I found out, that this has to do with my Sqlite3 DB and that i have to add the shared path for production in my database.yml. Thats why i added:
production:
adapter: sqlite3
database: /home/deploy/apps/Blogapp/releases/shared/db/production.sqlite3
now my posts stay also after a cap deploy, but my images arent showing of anymore. I guess i have to put them, or link them somehow to that folder aswell but iam not sure how. My shrine.rb looks like that:
require 'shrine'
require 'shrine/storage/file_system'
Shrine.storages = {
# temporary storage
cache: Shrine::Storage::FileSystem.new('public', prefix: 'uploads/cache'),
enter code here
# permanent storage
store: Shrine::Storage::FileSystem.new('public', prefix: 'uploads/store'),
}
Shrine.plugin :activerecord
Shrine.plugin :cached_attachment_data # for forms
changing uploads/cache to /home/deploy/apps/Blogapp/releases/shared/uploads/cache
and uploads/store to
/home/deploy/apps/Blogapp/releases/shared/uploads/store
doesnt seem to fix the problem ... Any ideas ?
Go to
/home/deploy/apps/Blogapp/current/public
and check withls -l
if you have a link to/home/deploy/apps/Blogapp/releases/shared/uploads
.When you add custom folders to a /shared, you have to tell capistrano to symlink them, but you need a little change.
First, change the paths to
/shared/public
Now, add this to your deploy.rb
Now, after a deploy, capistrano will create a symlink from
current/public/uploads
toshared/public/uploads
.