I'm new to Rails and Heroku as well.
Following tutorials I succeed to upload my app to Heroku.
My app is enable us to upload csv file to uploads folder in public.
So I can upload file in heroku deployed app and show table as I want.
But after 30 mins or so those files are removed automatically and showing error that no such file in public/uploads folder.
It is properly working on my local which is using sqlite3.
But heroku want to use psql for production mode so I changed production mode to use psql.
So if I upload csv file then it is stored in 'public/uploads' folder.
I think heroku app is automatically update to github repo even I didn't execute 'git push heroku master' command.
In my local repository files are stored but they are run on development mode.
How can I make upload functionality fully working?
Any help would be appreciate.
Ephemeral filesystem is just the way heroku works, as explained in the article - uploaded files will be removed when the instance is restarted.
What you should do is to upload those files for example to S3 (https://devcenter.heroku.com/articles/s3), you can achieve this with CarrierWave gem with Fog gem but there are other possibilities as explained in this thread here: https://www.reddit.com/r/rails/comments/2k9sq4/heroku_any_files_you_upload_will_not_be_saved/
Related
Im using Settingslogic gem as alternative to Environment Variables, and I found it more convenient. But, how to deploy the application to Heroku if my file with configs is out of the repo? I mean, all configs I save in application.yml, which is included in .gitignore file (because there is sensitive data). And when I push it to heroku, server can't find this file and can't complete deploy.
I've tried to create the file from heroku bash, but after git push heroku master command, created file disappears, and deploy failes with the same error.
How can I implement this deploy with one config file, and how can I force heroku to read this file or store it if I have no it in Git? Thanks a lot!
I have a rails app hosted on Heroku. I added a "Audio" folder in Assets. The "Audio" folder is not included into my git pushes. My app generates some audio files that are automatically added to the assets/audio folder. That's why I don't want Heroku to clean the assets inside this particular folder each time I push a modification.
One solution would be to host the generated audio files with AWS S3 but it's quite a lot of work to set up.
I wonder if, instead, there is a way to tell Heroku not to clean the assets in the "Audio" folder?
I searched on the internet but didn't find anything so far...
So far I know Heroku will clean you temporary assets everytime you deploy your application and the build starts.
Check this answer: Store file in directory tmp on heroku Rails
If your application is Rails 5.2 based you can implement your upload to AWS via Active Storage, check: https://evilmartians.com/chronicles/rails-5-2-active-storage-and-beyond
I am having issues with my Rails App on Heroku.
After every push to heroku any images I uploaded with paperclip Gem return a 404 error message.
How I resolve this?
You cannot use the local file system on Heroku to store uploaded files, because you get a new instance each time you deploy. I advise to read about Ephemeral filesystem on Heroku.
To fix your problem you show store uploaded files on an external service like Amazon S3. You might want to follow Heroku's documentation about uploading to S3
I am trying to deploy a rails app to heroku, and I know that their file system is read only, and it only contains the latest code. I am using a git repository, via this guide. I have a config file, holding passwords and other stuff that I don't want to track on git, but I have to upload them to heroku. How can I accomplish that?
Rather than store the confidential info in the app files, set them up as environment variables on heroku using config vars
Ref: https://stackoverflow.com/a/7832040/429758
I'm trying to upload a file using paperclip in a production environment in Heroku and the log files show:
Errno::EACCES (Permission denied - /app/public/system/photos/1/small/081811-2012-honda-cbr1000rr-leaked-003.jpg):
Will I have to use s3 or similar to handle file uploads, or can I configure path permissions to store the files on Heroku?
Yes Heroku does not allows you to add files dynamically to its server.
Though if you need upload feature on a app on heroku you need to configure s3 or other similar services
Refer this for details
http://devcenter.heroku.com/articles/read-only-filesystem
Yes, you must use S3 or another persistent store like Rackspace cloudfiles, Dropbox etc.
Whilst you can write to the tmp on all the stacks, the Cedar stack does let you write to the file system but it's not shared across dynos or dyno stop/restarts.
See http://devcenter.heroku.com/articles/dyno-isolation#ephemeral_filesystem
Yeah, it is true that Heroku does not allow you to upload files directly onto their servers. However, you can shove your files into your database. I used a gem created by Pat Shaughnessy:
http://patshaughnessy.net/2009/2/19/database-storage-for-paperclip
It worked well.