opoloo / lines-engine

Lines is a customizable blog framework for Rails. It aims at making publishing simple and beautiful.
http://lines.opoloo.com
GNU Lesser General Public License v3.0
216 stars 102 forks source link

Images lost after pushing to Heroku #16

Closed thedarkginger closed 5 years ago

thedarkginger commented 7 years ago

I've starting using Lines, and it works very well locally. Unfortunately, after I push my app to Heroku, I am noticing that uploaded images in the LinesPicture table initially work until I push a second subsequent branch to Heroku (so basically, it seems like any new push resets the asset pipeline and messes things up).

In my production.rb file, I have made some updates including:

  # Disable serving static files from the `/public` folder by default since
  # Apache or NGINX already handles this.
  config.serve_static_files = true

  # Do not fallback to assets pipeline if a precompiled asset is missed.
  config.assets.compile = true

Additionally, based on Heroku's documentation, I made sure to have gem 'rails_12factor', group: :production installed as well.

The problem persists. I have run heroku run rails console and checked the LinesPicture table, and the photos remain in the table. Has anyone experienced / found a solution when deploying?

krivitsky commented 6 years ago

I have the same issue: the uploaded images are stores in public/uploads. I guess the right way would be to store them on AWS, not on the local drive. This gem needs to be changed accordingly.

Any plans from the main contributors?

krivitsky commented 6 years ago

This issue can be a duplicate of: https://github.com/opoloo/lines-engine/issues/12

BenoitDK commented 6 years ago

Hi, I have the same problem. May I ask if you found a solution ? Thanks !

thej commented 5 years ago

Set storage: :file to storage: :aws in _config/linesconfig.yml You may have to update your gem Verison to >=1.2.5

jfacoustic commented 5 years ago

I set storage: :file to storage: :aws. Can't get it to work.
I get the error: Unknown storage: aws

adonespitogo commented 5 years ago

@jfacoustic can you post your Gemfile?

jfacoustic commented 5 years ago

@adonespitogo

source 'https://rubygems.org'
git_source(:github) { |repo| "https://github.com/#{repo}.git" }

ruby '2.5.3'

gem 'rails', '~> 5.2.2'

gem "aws-sdk-s3", require: false
gem 'puma', '~> 3.11'
gem 'sass-rails', '~> 5.0'
gem 'uglifier', '>= 1.3.0'
gem 'lines-engine', '>=1.2.5'
gem 'coffee-rails', '~> 4.2'
gem 'turbolinks', '~> 5'
gem 'jbuilder', '~> 2.5'
gem 'bootsnap', '>= 1.1.0', require: false

group :development, :test do
  # Call 'byebug' anywhere in the code to stop execution and get a debugger console
  gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
  # Use sqlite3 as the database for Active Record
  gem 'sqlite3'
end

group :development do
  # Access an interactive console on exception pages or by calling 'console' anywhere in the code.
  gem 'web-console', '>= 3.3.0'
  gem 'listen', '>= 3.0.5', '< 3.2'
  # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
  gem 'spring'
  gem 'spring-watcher-listen', '~> 2.0.0'
end

group :test do
  # Adds support for Capybara system testing and selenium driver
  gem 'capybara', '>= 2.15'
  gem 'selenium-webdriver'
  # Easy installation and use of chromedriver to run system tests with Chrome
  gem 'chromedriver-helper'
end

group :production do
  gem 'pg'
end
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
adonespitogo commented 5 years ago

Try adding these lines:

gem 'carrierwave', '~> 1.0'
gem 'carrierwave-aws'
gem 'aws-sdk-rails'