Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Images lost after pushing to Heroku #16

Closed
thedarkginger opened this issue Aug 20, 2017 · 8 comments
Closed

Images lost after pushing to Heroku #16

thedarkginger opened this issue Aug 20, 2017 · 8 comments

Comments

@thedarkginger
Copy link

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
Copy link

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
Copy link

krivitsky commented Dec 20, 2017

This issue can be a duplicate of: #12

@BenoitDK
Copy link

BenoitDK commented Jul 8, 2018

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

@thej
Copy link
Member

thej commented Nov 27, 2018

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

@jfacoustic
Copy link

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

@adonespitogo
Copy link
Contributor

@jfacoustic can you post your Gemfile?

@jfacoustic
Copy link

jfacoustic commented Jan 22, 2019

@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
Copy link
Contributor

Try adding these lines:

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants