4

I'm diving into web development and I built my personal website using Ruby on Rails 3.1 and I'd like to add a blog to it. Octopress sounds really awesome, and it's written in Ruby, but I can't find a single resource online that discusses integrating Octopress into a Rails app. I know that's not what it was designed for, but I'm amazed there's no discussion on it considering the popularity of these two technologies. The only resources I can find are discussions on using Octopress to create a stand-alone blog website. How can I integrate Octopress into my existing Rails 3.1 app? Can I set it up as a stand-alone website and integrate it as a sub-domain? Other suggestions?

Thanks so much in advance for your wisdom!

BeachRunnerFred
  • 18,070
  • 35
  • 139
  • 238
  • I don't really see the two integrating together: the content for an Octopress blog is Markdown files whereas Rails takes its content from the DB. An Octopress site is generated and compiled and stays the same for each commit whereas Rails serves each request independently. You might still be able to hack something together though. What are you mainly trying to achieve by integrating the two together? – Jonathan Allard Dec 08 '12 at 17:54
  • Thanks, @jonallard. I just want to have my blog built into my personal website, that's all. I'm just trying to keep everything together. – BeachRunnerFred Dec 08 '12 at 18:21

1 Answers1

4

A little late, I know. But you can mount any Rack app--in short, an application with a config.ru file--inside another Rack app. Both Rails and Octopress are Rack, so I don't think there's any reason why you couldn't. You'll have some challenges sharing assets between the two of them if you're not willing to get your hands a little dirty (read: mounting Sprockets as a separate Rack app), but you shouldn't need to find Octopress-specific instructions for doing this if you don't mind the two apps being fairly isolated. Just google mounting rack apps in rails and read through that literature.

I suggest looking into foreman if you're going to be doing this.

EDIT: Instead of breaking everything down into a series of parallel Rack engines rigged together in a root config.ru, it looks like Rails 3 can mount any Sinatra app such as Octopress right in its routes. Check this out for more..

Chris Keele
  • 3,364
  • 3
  • 30
  • 52
  • Can you clarify how Octopress is a rack app? I believe that it creates static files for deployment. – justingordon May 12 '13 at 09:17
  • It does, and then serves them through a clean Sinatra rack app packaged with it. The giveaway is the config.ru file in the root of the Octopress app; it's the core rack runner. In Octopress [it looks like this](https://gist.github.com/christhekeele/5566019). – Chris Keele May 13 '13 at 03:37
  • Thanks. I had been using pow and github.io, so I forgot about the sinatra app. – justingordon May 13 '13 at 08:58