Open mrrooijen opened 12 years ago
I don't think you can get stasis to work at Heroku. The problem you hare having is probably tied to the fact that heroku rewrites your logging output, but even if you could solve that, you still have to deal with the fact that Heroku has no (usable) write permission for your app. So stasis can never save the generated files.
@JeanMertz I actually decided to use MiddleMan for my static website. It's very similar to stasis in some aspects. I also wrote out a little multi-file gist explaining how to get the static site to run on Heroku.
It actually is possible and Heroku does have a writable filesystem since Celadon Cedar was released months ago. Although it isn't a persistent file system, since processes are moved around, everything you write should be considered "temporary".
This however is no problem. I just tell Heroku to pre-compile the whole static website before booting the Thin app server every time a process (re)starts. I added a little Rack Middleware to serve the pre-compiled static pages afterwards. So you have to run a very small layer of Rack middleware, but it's extremely fast and static pages are cached by Heroku.
See: https://gist.github.com/1718367 (this could also work with Statis, but I keep running in to the above issues)
The key to doing all this lies mainly in using an app server like Thin, plus Rack::TryStatic plus Procfile with Celadon Cedar to customize process boot-behavior.
A config.ru like this should allow you to use stasis-generated sites on Heroku.
use Rack::Static,
:urls => ['/images', '/javascripts', '/stylesheets'],
:root => Dir.pwd
run lambda { |env|
[
200,
{
'Content-Type' => 'text/html',
'Cache-Control' => 'public, max-age=86400'
},
File.open('index.html', File::RDONLY)
]
}
Hi there.
I'm trying to get Stasis to render on Heroku, but am not being very successful. Whenever I run
stasis .
from the Heroku console, it returns this error:Same happens when I manually create a new Stasis object:
I do not have this issue locally and I have no idea why this is happening. Does anyone else?
Thanks!