6 ms·
Static Sites on Heroku
- damian2000 14y agoNice, but what about a mail server on your custom domain? I think its not that easy according to this post anyway ... http://xtargets.com/2010/10/04/using-gmail-for-email-on-a-heroku-managed-domain/ http://xtargets.com/2010/10/04/using-gmail-for-email-on-a-he...
- mnutt 14y agoAdding MX records for gmail and adding A records / CNAMEs for Heroku are pretty much orthogonal. They shouldn't conflict with each other.
- johtso 14y agoThis is a much cleaner way of serving static sites on Heroku: http://kennethreitz.com/static-sites-on-heroku-cedar.html http://kennethreitz.com/static-sites-on-heroku-cedar.html Using this technique you can even use .htaccess files.
- TazeTSchnitzel 14y agoHeroku for a static site? Sounds like overkill. On my VPS I just do this: 1. Have public git repo, clone on server 2. Run nginx pointing to htdocs folder in git repo 3. When I want to deploy, ssh in and git pull Works just fine. Sure, it's a public site on GitHub, but I could just as easily run a git server.
- deleted 14y ago[deleted]
- icebraining 14y agoI just git push to the server from my laptop over SSH. No need for a git server (or Github, for that matter).
- TazeTSchnitzel 14y agoI should really try that... thanks! Edit: Oh wow, I didn't realise I could just do this: git push ssh://example.com/git/repo
- chrisrhoden 14y agoSSH is the transport you're using when you use github. git@github.com:git/repo.git tells git to SSH using the 'git' user.
- kcbanner 14y agoThis is what I do. Works great!
- g3orge 14y agocan you explain more about the nginx thing? Since it's a GitHub repo, why you need a web server?
- TazeTSchnitzel 14y agoOh, I guess I could use GitHub hosting, but I wanted to host it on my own server. (I actually have a good reason to - I needed to access a WebSocket server on the same origin)
- Sivart13 14y agoI think the big advantage for people wanting to host a site on Heroku is they explicitly DON'T need their "own server".
- TazeTSchnitzel 14y agoI don't see the advantage of that. For small static sites I don't think it's much more hassle to put CloudFlare in front of your server. The advantage of such services is scaling up dynamic sites easily.
- darkxanthos 14y agoDoing it with Sinatra w/ no routes and just using the public folder seems easier IMO but the php method another commenter mentioned sounds like the best! I'll be doing that from now on methinks.
- programminggeek 14y agoYou know, static hosting works really great on Amazon S3, as long as you don't need a .htaccess file. On all of my jekyll sites I use S3 now and there's even a jekyll-s3 gem that makes pushing your site up to S3 painless. The nice thing about using S3 is you don't have to wait for Heroku instance start up if it's not a high traffic site.
- tomwalker 14y agoI am using S3 also and it is surprisingly easy. For a small site the cost is close to nothing.
- akh 14y agoWe also host our static site on S3, it costs us $0.12/month. Here's how we do it: http://blog.shopforcloud.com/2012/04/how-to-host-your-site-on-s3-for.html http://blog.shopforcloud.com/2012/04/how-to-host-your-site-o...
- damian2000 14y agoFound some more info here: http://docs.amazonwebservices.com/AmazonS3/latest/dev/WebsiteHosting.html http://docs.amazonwebservices.com/AmazonS3/latest/dev/Websit...
- jvc26 14y agoThe only issue with S3 I've found is the lack of naked domain support, so you need another service for redirects to your *.domain.tld.
- ejdyksen 14y agoIf you register your domain through NameCheap and use their DNS hosting, HTTP redirects from naked domains are included.
- tuananh 14y agoI use toto to host my blog on heroku.
- waxjar 14y agoIt's exactly what is in Heroku's documentation: https://devcenter.heroku.com/articles/static-sites-on-heroku https://devcenter.heroku.com/articles/static-sites-on-heroku.
- philipp-spiess 14y agoThere is a more easy way: Just name your index.html to index.php and you can use a full featured Apache Webserver.
- MattRogish 14y agoAnother option is Github pages. I host my blog there for free and have had posts featured on HN front page - served with nary a slowdown or github sending me a bill. It's awesome. Github pages support a point-and-click interface (which is not likely what you want) but with a tiny amount of setup supports Jekyll https://help.github.com/articles/using-jekyll-with-pages https://help.github.com/articles/using-jekyll-with-pages / Octopress (what I use) http://octopress.org/docs/deploying/github/ http://octopress.org/docs/deploying/github/
- bfcapell 14y agoTwo weeks ago I was looking for this. This is the easiest way I found to do it: heroku create myproject --stack cedar --buildpack https://github.com/pearkes/heroku-buildpack-static https://github.com/pearkes/heroku-buildpack-static
- pearkes 14y agoHa! I never thought anyone would use that. It's basically a simple fork of their PHP buildpack that stops caring if it's PHP and just serves off of Apache. Perhaps I should clean it up. I was also experimenting with a Pelican buildpack (a python Jekyll): https://github.com/pearkes/heroku-buildpack-pelican https://github.com/pearkes/heroku-buildpack-pelican You deploy you markdown files and it generates your html in the deploy process.
- bfcapell 14y agoI tried a few other buildpacks like the nginx ones, in the end this was the only one that didn't force me to configure or adapt anything, just worked, so thanks a lot! :)
- pearkes 14y agoNo worries! I fixed it all up so it should be much more concise then it was. Still no configuration!
- jenius 14y agoThere's an even easier way to do static sites on heroku and have them compiled for you - use stasis (http://stasis.me http://stasis.me) - I've built a framework on top of stasis and have been using it for months, as part of very large production sites, and it's been extremely stable and super easy to use. All you need to do to get them working on heroku is include a super basic config.ru file, and you're all set. The files compile into a public folder which heroku uses to serve them.
- g3orge 14y agoWhat's the difference in using nanoc to do that?
- winton 14y agoI am the creator of Stasis. Compare the sheer length of docs for nanoc (http://nanoc.stoneship.org/docs http://nanoc.stoneship.org/docs) to those of Stasis (http://stasis.me http://stasis.me), and keep in mind that Stasis can do anything that Nanoc does.
- jaspervdj 14y agoThis is not the case, not by far. nanoc is aimed at building complex sites and hence has a lot more features than Stasis. Some examples: - Items can contain arbitrary metadata in nanoc - You can trivially build multiple representations of a single item in nanoc (e.g. a PDF/txt/html representation of a single markdown file) - Dependency tracking in nanoc is fully automatic (no need to specify priorities) - Nanoc is easily extensible using custom filters, custom deployers, custom helpers and more Statis and nanoc have a different audience. To me, Stasis seems to be aimed at simpler, smaller sites, while nanoc is aimed at much more featureful sites. It is a good thing to have a lot of documentation (nanoc is frequently cited as a good example of how documentation should be handled).
- tantalor 14y agoLoading the entire file into memory first seems like an antipattern. Doesn't Rack support lazy evaluation?
- mixonic 14y agoI'm required by bootstrapper law to mention a project I'm working to get out of beta now: http://spintoapp.com http://spintoapp.com Spinto is Git-based, like Heroku, and uses Jekyll with pre-processors for Sass/Scss (and Compass, Bourbon), Less & CoffeeScript. I agree with Brandon that FTP is hopelessly out of date and frustrating. Even more than that, I think there is madness in the idea that you need a database backend for your website to let somebody else change a comma, or an image (sometimes you need full-blown-CMS, but not always). I'm trying to make a static websites easier for us to create, deploy, and collaborate on. Feedback _always_ appreciated.
- smarx 14y agoDisclaimer: I'm a founder of Site44. Like some of the commenters here, I looked around for simple static website hosting when I was trying to find a new home for my blog. I considered Heroku, GitHub Pages, and S3. Heroku didn't seem particularly optimized for static hosting (e.g., dyno spin-up time), and GitHub Pages lacked some flexibility (like custom mime types for my extension-less URLs). S3 doesn't handle things like sending gzipped content to only browsers that support it. Ultimately, my cofounder and I decided to build our own solution based on Dropbox: http://www.site44.com http://www.site44.com. Site44 is in a private beta now, but we're hoping to move to a public beta very soon. I'd love to get some feedback from HN. The basic idea is that when you create a site (<foo>.site44.com or a custom domain), we create a folder for you in Dropbox, and then you publish by just modifying the contents of that folder.
- whichdan 14y agoIsn't Heroku a mediocre option for a static site unless you're paying? If the site isn't accessed for a while they spin down your EC2 instance, and it takes a few seconds to get it back online.
- zachrose 14y agoMy thought exactly. The 5-10 second lag involved in waking up a Heroku instance is a total drag for low-volume sites.
- melvinram 14y ago$35/month for a static site? seems like overkill, no?
- sunkencity 14y agoSounds like an anti-pattern to me. That said, I do host some static sites on heroku.
- shykes 14y agoAnother option is dotCloud's static service: http://docs.dotcloud.com/services/static/ http://docs.dotcloud.com/services/static/ $ cat >>dotcloud.yml <<eof www: type: static $ dotcloud push myapp $ dotcloud url myapp.www