I have Apostrophe 3 CMS hosted on Heroku, but whenever i do deployment for my code changes, the files always clearing and the media image will be broken since the files is no more on the folder. Anyone know how to solve this?
Apostrophe 3 CMS on Heroku always clearing files in uploads/attachments after deploying
43 Views Asked by newDev33 At
1
There are 1 best solutions below
Related Questions in APOSTROPHE-CMS
- i18n Attaching variable in the middle of a string
- ApostropheCMS - how to serve different page in middleware
- How Do I Pass A Schema Value With Units From Apostrophe 3?
- How do I add another attribute to style in a view file (macro) in apostrophe CMS?
- How to add a color separately to text shadow/Box Shadow in apostrophe CMS pallete
- apostrophecms not loging in
- How to override CSS in apostrophe-cms pro in TheAposPallete.vue
- TypeError: Cannot set properties of undefined (setting 'name')
- ApostropheCMS V3 : How to have a Selected item in one widget trigger reactively displayed content in another widget in the same page client-side
- How do I set additional file groups in Apostrophe 3 CMS attachment module?
- Apostrophe 3 CMS on Heroku always clearing files in uploads/attachments after deploying
- Apostrophe 3 CMS not showing the modal when clicking admin bar
- How to use Apostrophe CMS login to add code to user upon login
- Is there a way to embed metadata into an Apostrophe CMS version 3 user type
- add event handler to a textbox apostrophecms
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
I realize this post was a long time ago, but for anyone just reading it now: the Apostrophe documentation includes an article covering Heroku in depth, including a subsection about how to use Amazon S3 for persistent media storage, which is what your question is specifically about.
I won't duplicate the entire article here, but what you need to do is (1) create an AWS S3 bucket, (2) set that bucket to allow public access to files (you will have to override a number of warnings that are meant for people who did not intend to serve anything to the public), and then (3) set the appropriate Heroku environment variables based on your AWS S3 credentials:
Your S3 key and secret can be API credentials associated with your root AWS account, but for security reasons it's better to create an IAM account with access only to S3.
Then redeploy or restart your site on Heroku. The presence of
APOS_S3_BUCKETwill automatically switch Apostrophe's uploadfs storage backend fromlocaltos3.The above is necessary because Heroku doesn't guarantee that your code will always run on the same server. That means the file system accessible to your Node.js code is ephemeral. You can rely on it for the lifetime of a particular HTTP request, e.g. for temporary files, but you can't rely on it beyond that.