问题
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