Can't create files Heroku Cedar-14

瘦欲@ 提交于 2019-12-25 05:34:10

问题


So I have an application

  + Application Folder
  |
   --- index.php
   --- folder 1
   --- folder 2

I want to create a data folder outside this 'Application folder'.

Problem: If I go 1 up in the tree and try to do a git push, heroku doesn't let me

+ 1 up from application folder
  |
  + --- Application Folder
  + --- Data folder

And I can't ssh into the box and create a folder because it tells me it's a read only file system.

FYI: The dashboard app settings say it's on cedar 14. And I'm running on a free account.


回答1:


Even if you SSH in somewhere, that would be an isolated instance. Imagine scaling from 1 to 100 dynos and then making a filesystem modification on one of them, how should that work in terms of syncing etc?

I assume you want to add files outside of where index.php lives, so you basically want to change the document root for the project to a subdirectory.

Your "+1 up from application folder" is then the Git project root, and your application folder is the document root. Create a Procfile as instructed here to set the document root to your application folder: https://devcenter.heroku.com/articles/custom-php-settings#setting-the-document-root

You do realize however that anything you write into the data folder on a dyno will not be available on your local computer, right? You can't "download" it, it's a Git repo. The data you write on one dyno also will not be available on other dynos (e.g. when you heroku ps:scale web=10 to have ten dynos), and every time you scale up or down, git push, or just after around 24 hours (when dynos auto restart), any changes to the local filesystem will be gone.



来源:https://stackoverflow.com/questions/28081725/cant-create-files-heroku-cedar-14

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!