Openshift Scaling Tomcat7 with Stored Files and Images - tomcat7

If I have a Gear which contains Files and Images uploaded by Users, will the directory be Shared across all Gears? or will it be synced after every User upload?
If not, is there any workaround?
Can I manually sync all Gears after every user upload/delete/change in the upload directory?

The files that are uploaded by users into your $OPENSHIFT_DATA_DIR will not be synced in a scalable application. The resolution for this issue is to use a third party file hosting service such as Amazon S3.

Related

Upload image on AWS server and take backup

I created a spring boot application when users uploads images I just create the folder at the project level and add an image to it using Rest API.
At the local host create the folder and the image save successfully.
Now it's time to deploy on the AWS server. But when I need a backup of the project-level image folder. is it possible? and How?

Directus images disappear after a while

I created a Next.js project that is deployed on Vercel and uses a MySQL database. I then deployed a Directus instance on Heroku that is tied to that same database. In my Next.js project I want to fetch and render images that I uploaded to Directus. At first this works, but after a while all the images disappear in the Directus media library. The folders and references to the images are still there, but I don't see the pictures anymore, I get to see a JPG logo instead. When I try to fetch the images I get a 502 "Bad Gateway" error. I don't know what causes the images to disappear and how to fix this.
By default, Directus stores uploaded files locally on disk.
All Heroku applications run in a collection of lightweight Linux containers called dynos. Be aware that Heroku dyno's filesystem is ephemeral.
It means if your Heroku app doesn't receive any traffic for 30 minutes or is being deployed, the VM it lives on is destroyed, and its filesystem goes along with it. So, this filesystem should not be used for any permanent storage (Directus storage in your case).
You can configure Directus to use S3, Google Cloud Storage, Azure, or Cloudinary.
For more details check the File Storage Directus docs.

Save images not properly display on heroku

i'm using Rails 3.2.6 and using carrierwave to upload images.When i upload image it is display fine and its image url also working well. But when i push next git commit on heroku.
git push staging master
than all images that i had already upload not display and its image path are not working
why?
Please anyone can tell what's the problem is running.
Thnaks
Whilst your uploads will work - the moment you push new code, or your application is restarted you will loose any uploads.
Heroku uses an Ephemeral file system, in that each dyno receives a separate copy (slug) of the originally deployed code so uploads would only exist on the dyno that handled the upload (https://devcenter.heroku.com/articles/dynos#ephemeral-filesystem).
You need to use an external persistant data store like Amazon S3, Rackspace Files etc - fortunately with Carrierwave it's trivial to update it to use it as it supports it out of the box.
Did you setup carrierwave with s3 (https://github.com/jnicklas/carrierwave#using-amazon-s3)?
Heroku has a read only file system (https://devcenter.heroku.com/articles/s3).

how to migrate heroku file storage to S3

I am an idiot, and very new to Heroku. I used the heroku file system to store paperclip attached files to my models.
Have I lost these files? And can I unload them to S3 somehow and have better access?
Its a low traffic site but its causing problems as it should for me to have it setup to store locally on the server.
You can assume you've lost the files - if the app has been restarted/scaled/deployed to then they'll have gone.
You'll want to get it setup to save the files to S3 in the future.

How to upload images on heroku server using attachment_fu plugin

I have an app in Heroku, I need simple file storage for uploaded images for this I
used send_data using attachment_fu plugin.
After that I have used the tmp/ directory to write this file and want to display on browser, But these files are not displayed in browser.
How can I display these images on browser?
What is the alternate solution to store and retrieve images?
Thanks!
You cannot store uploaded files on Heroku.
You must use an alternative strategy. A couple alternative strategies:
Store uploaded files in your database on Heroku. Because database systems are not specifically optimized for storing files, you should test out how well your application performs under load before you use this strategy.
Store uploaded files in an external storage service. Amazon S3 is a popular cloud storage service that anyone can use, and it has pay-as-you-go pricing just like Heroku. (In fact, Heroku itself runs on top of another of Amazon's cloud services, EC2.)

Resources