为什么不';t Heroku看到我在部署后创建的文件


Why doesn't Heroku see a file I create after I deploy?

我想像Rails一样在Yii中设置资产编译和缩小。http://www.yiiframework.com/doc-2.0/guide-structure-assets.html

我正在考虑使用PHP迷你程序。我宁愿不必手动编译资产并将其签入Git。然而,即使它有效,Heroku似乎也不会为不在Git中的新文件提供服务器。为什么?

>heroku run bash
Running `bash` attached to terminal... up, run.6857
~ $ cd web
cd web
~/web $ ls
ls
MySample.php  css          images          index.php  robots.txt
assets        favicon.ico  index-test.php  js
~/web $ echo hello > hello.txt
echo hello > hello.txt
~/web $ cat hello.txt
cat hello.txt
hello
~/web $ exit
exit
exit
$ curl -I http://xxxxxx.herokuapp.com/hello.txt
HTTP/1.1 404 Not Found

找不到hello.txt的原因是您的curl-I请求将由应用程序的一个新实例处理。为了演示,我可以在bash中删除我的index.php,但当我使用curl-I检索它时,我会得到200 OK

$ heroku run bash
Running `bash` attached to terminal... up, run.3070
~ $ cd web
~/web $ ls                    
index.php
~/web $ rm index.php      
~/web $ ls
~/web $ curl -I http://xxxxx.herokuapp.com/index.php
HTTP/1.1 200 OK

另一种显示方式是打开两个不同的bash连接,然后运行heroku-ps-

$ heroku ps
=== run: one-off processes
run.3070 (1X): up 2015/04/01 19:30:07 (~ 37m ago): `bash`
run.7783 (1X): up 2015/04/01 19:59:48 (~ 8m ago): `bash`

这两个进程不会共享短暂的内存。