Parse- Server Transferring files hosted on Heroku to AWS S3 bucket - heroku

I have parse-server running on Heroku. When I first created this app, I didn't specify a files adapter in index.js, so all uploaded files have been getting stored on Heroku.
So I have now run out of room and I have set up an AWS S3 bucket to store my files on. This is working fine expect for the fact that any files which were originally stored on Heroku can no longer be accessed through the application.
At the moment I am thinking about looping through all objects which have a relation to a file stored on heroku, then uploading that file to S3 bucket. Just hoping that there may be some tool out there or that someone has an easier process for doing this.
thanks

There are migration guides for migrating parse server itself but I don't see anything in the documentation for migrating hosted files unfortunately.
I did find one migration tool but it appears to still utilize the previous file adapter (on your heroku instance) and then stores anything new on the new adapter (s3 storage).
parse-server-migrating-adapter

Related

heroku and nuxt file uploader not working

I have a PWA made with NuxtJS correctly deployed and working on Heroku.
I would like to implement a file uploader and manager so that I can manage some files in a directory (~/static/files) from my front-end through some APIs.
On localhost, it works fine so I have my directory and when I add or delete the file, it deletes or creates it from the file system (as it should).
My question is: why can't I do the same on Heroku? I mean, I tried by uploading a file and deleting it and it works but the problem comes when I restart the app (through heroku ps:restart -a appname) because when I do so it deletes the file as if it was saved in RAM and not onto the file system.
If I try to see the files in the directory where they should be through heroku run bash -a appname and then down to the directory, no file is showed.
How can I fix this?
The Heroku filesystem is ephemeral - that means that any changes to the filesystem whilst the dyno is running only last until that dyno is shut down or restarted. Each dyno boots with a clean copy of the filesystem from the most recent deploy. This is similar to how many container based systems, such as Docker, operate.
In addition, under normal operations dynos will restart every day in a process known as "Cycling".
These two facts mean that the filesystem on Heroku is not suitable for persistent storage of data. In cases where you need to store data we recommend using a database addon such as Postgres (for data) or a dedicated file storage service such as AWS S3 (for static files).

Strapi deployed to Heroku but media files give 404 error

I've deployed Strapi on Heroku and have set up the content fine. When I uploaded images and videos to Strapi using the cms interface and saved the update. it saved successfully but the file url returns 404. has anyone experienced this before? Am I missing something?
Thanks guys.
https://strapi.io/documentation/3.0.0-beta.x/guides/deployment.html#file-uploads
File Uploads
Like with project updates on Heroku, the file system doesn't support local uploading of files as they will be wiped when Heroku "Cycles" the dyno. This type of file system is called ephemeral, which means the file system only lasts until the dyno is restarted (with Heroku this happens any time you redeploy or during their regular restart which can happen every few hours or every day).
Due to Heroku's filesystem you will need to use an upload provider such as AWS S3, Cloudinary, or Rackspace. You can view the documentation for installing providers here and you can see a list of providers from both Strapi and the community on npmjs.com.

How to persist Bluemix files between app restarts

I am using a rails 4 application on Bluemix, attaching files using paperclip gem. As we all know, Paperclip is saving a reference to that file in the actual db, saving the physical file into a /public location.
I am submitting a file to this db which is getting saved here
/home/vcap/app/public/files/submissions/files/140/original/Successful_Submission.pdf
and then the file retrieval is working perfectly fine. Once I restart my app, I get:
Errno::ENOENT (No such file or directory # rb_file_s_lstat - /home/vcap/app/public/files/submissions/files/140/original/Successful_Submission.pdf):
And this is because Bluemix is not persisting this information. How can I get hold of those files between app restarts?
Bluemix is built on top of Cloud Foundry and it has an ephemeral filesystem, i.e., once your application stops the platform will claim back that filesystem and creates a brand new one once you restart your application.
Writing to the local filesystem is not recommended for cloud applications and you may need to redesign your application to work with Bluemix. One solution is to save your files in your database and not only the reference.
You can find more details on this link.
Each application instance on Bluemix (which is based on Cloud Foundry) has ephemeral storage. This storage is only available for the lifetime of that particular instance. When you redeploy your app then you'll get a new app instance and any data on the previous app instance will be inaccessible.
There's a good explanation of why it's best to avoid writing to the local file system when designing an application for Bluemix / Cloud Foundry.
You may want to take a look at a gem like CarrierWave to store the files on Amazon S3 or another persistent store. There's also Paperclip which offers similar functionality.

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