【问题标题】:Files not being created on Heroku未在 Heroku 上创建文件
【发布时间】:2014-01-02 08:34:37
【问题描述】:

我将Jekyll-based blog (github code) 托管在 Heroku 雪松堆栈上。

我通过my Rakefile构建jekyll文件:

namespace :assets do
  desc 'Precompile assets'
  task :precompile do
    sh "bundle exec sass --update _scss:_css --style compressed"
    sh "bundle exec jekyll"
  end
end

这会将文件输出到_site 目录,Rack 将从该目录提供文件。

这已经运行了一年多,并且在我的博客的当前实时版本(两周前发布)上运行良好:

$ heroku run ls _site                                                                                                 
Running `ls _site` attached to terminal... up, run.9360
2012  404  apple-touch-icon.png  back-end  css          front-end  index.html  politics    public-domain.txt  rss.xml
2013  410  assets                config    favicon.ico  go.sh      personal    postsbytag  robots.txt         sitemap.xml

但是,每当我现在尝试发布任何内容,或将相同版本的代码发布到 new app 时,似乎都不会创建 _site 目录:

$ git push git push git@heroku.com:robinwinslow-dev.git
...
http://robinwinslow-dev.herokuapp.com deployed to Heroku
...
$ heroku run ls _site --app robinwinslow-dev
Running `ls _site` attached to terminal... up, run.2577
ls: cannot access _site: No such file or directory

还有site shows

Internal Server Error
No such file or directory - _site/404/index.html

有人知道为什么会改变吗? Heroku 有什么变化吗?还是我突然做了什么蠢事?

【问题讨论】:

    标签: ruby heroku rake rack cedar


    【解决方案1】:

    我不知道为什么这首先会起作用,因为Heroku has a read-only file system。解决方案是在本地编译您的站点,包括所有资产,将它们签入 Git,然后将完整的 _site 目录推送到 Heroku。

    【讨论】:

    • 那篇文章在顶部说:“这篇文章适用于 Bamboo 堆栈上的应用程序。对于最新的堆栈 Cedar,请参阅关于临时可写文件系统的注释。”。我正在使用 Cedar 堆栈,所以文件系统应该是短暂的 - 只要 Rake 在 dyno 启动时运行(应该是),文件就应该在那里。
    • "在 dyno 的生命周期中,它的运行进程可以将文件系统用作临时暂存器,但是任何其他 dyno 中的进程都看不到写入的文件,并且写入的任何文件都将在 dyno 的那一刻被丢弃已停止或重新启动。”
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-12-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多