Deploying to OPENSHIFT Express - WIP
  • These are a series of steps to get booktype up and running on Red Hat's cloud "OpenShift" Express account. It is a work in progress, and while this should help you get booktype deployed, there are still some issues to be worked out. I'm posting this since I figured a community effort might make short work of the issues. 

    First register for an account here if you don't already have one. 

    Local Setup:

    You can follow the quickstart guide here:

    But the gist of it is:
    1. Install ruby gems
    2. Install rhc gem 
    3. rhc app create -a <somename> -t python-2.6          (in some directory you have write access to) 

    Checkout Booki:

    So you can either checkout my public git repo or checkout straight from Booktype's git repo and move things around. If you go with the second option, you'll need to run the createbooki script and copy the directory it creates to <openshift-app-dir>/wsgi/ and modify things like the application file, the action_hooks etc. The second option is undoubtedly more complicated and is probably only for people who are more familiar with django. 

    1. cd into your newly created app directory

    My Repo:
    2a. git remote add upstream -m master git://
    3a. git pull -s recursive -X theirs upstream master

    Official Booktype Repo:
    2b. git remote add upstream -m master git://
    3b. git pull -s recursive -X theirs upstream master

    Steps from here on out are assuming you did my repo.

    Prep Postgres Instance / Settings:
    1. rhc app cartridge add -a <app-name> -c postgresql-8.4
    2. After entering your account password it should return details on your postgres instance. Write these down somewhere.
    3. edit <app-dir>/wsgi/mybooktype/ and plug-in the postgres dbname (same as your app-name).
    4. git commit -a -m "configured postgres access"

    Redis Setup:
    Since openshift doesn't have a redis service at this time you'll need to procure access to one. Populate appropriate REDIS_* vars in the wsgi/mybooktype/ Here are some service providers:
    If you're cheap like me and have broadband and the ability to forward ports, you can easily run this off a home computer. I've defaulted to doing this atm since I don't feel a 20mb cache with limited connections will handle the traffic I intend to generate and I can't justify $25/mo for a service like this.

    If you want to publish your works you'll need access to an objavi service. I'm currently looking into how difficult it would be to deploy this to OPENSHIFT / GAE / etc.. Otherwise you may need to run this locally too.

    Add newly cloned directories for Openshifts git
    1. From app-root: git add wsgi data libs .openshift
    2. git commit -a -m "adding booktype dirs"

    Push your app to the cloud:
    1. git push (in another window you may want to run rhc app tail -a <yourapp> to tail for deploy errors)

    I'm sure this has holes in it since I didn't check out from my own setup repo and did alot of these things ad-hoc so if you have questions or issues, feel free to post.

    Outstanding issues:
    • Unable to create chapters or sections (this has something to do w/redis. not very familiar w/redis so looking into that).
    • Need to update the to use environment variables on the cloud side for sensitive info.

    Post edited by Andrew Replogle at 2012-03-19 19:01:16
  • 12 Comments sorted by
  • Ok so the chapter / section creation issue is a non-issue. I just didn't understand what redis was / what it was being used for. 

    Does anyone know to what extent it's used for? Is it just meta-data or actual content that passes through redis?

    I've voted up memcached / redis support on Openshift here.

    In the meantime I've signed up for a small free redis hosted service. Took the info and plugged it into the wsgi/mybooktype/ under the REDIS info. 
  • As far as I know Redis is used for all of the message channels going through Sputnik.

    Like the chat channel in editor page and all of the microblogging channels.

  • Ok. I think it's also used for chapter and section data since I couldn't create without that. I'm guessing if I'll have a lot of editors and collaborative activity I'll need a beefier redis resource.

    Thanks Tomi =]
  • At least the messaging system sends messages about events in the editor. I don't know if it also does something else that might cause trouble with the editor.
  • That makes sense now. Since it couldn't connect to redis to publish the event of a new chapter creation it couldn't create the chapter.
  • Looking into whether I can make a Redis DIY cartridge following this guide in the event that OpenShift goes in another direction for in memory caching. 

    I don't think an objavi rendering server will be possible as an openshift app due to the large number of dependencies like openoffice and other lower level components like xvfb.
  • Vote Up0Vote Down adamadam
    Posts: 88Member
    hows it all going? getting somewhere with it?
  • I apologize, I've been occupied by other work. 

    The DIY Redis cartridge probably isn't going to work without modifications to booktype since any DIY cartridge requires the service to talk HTTP. So we'd have to do some protocol wrapping and then have the redis client talk HTTP.

    I haven't spent any additional time in the objavi server but in theory (besides maybe the openoffice formats) that should work fine in openshift since its HTTP. 

    I'll try to look into these some more in the next few weeks and post an update.

    FYI, the authoring portion is working great for me currently on openshift using the process above. Granted it's a little slow since it's calling a redis server on my home system. 
  • I've created new quickstart with local redis instance:-

    This require me to patch lib/sputnik/ though and remove the bundled redis client to use latest client that support unix_socket_path parameter.
  • Great job! I've wanted to create something similar also using the virtual environment stuff to create an easy install script for Booktype and Objavi in the same instance the way most Django based packages do it these days so that you can quickly set up an instance of both on any new server. I hope we'll get there eventually.
  • Yes, absolutely. A compact install process for virtual environments would be really useful. I use Mezzanine for my main website, and they have managed to get the install process down to two lines. It seems that many Django projects are moving in this direction, and it would be great to see Booktype/Objavi do so as well.
  • Yes it would be good to have it. Booktype has one line install for couple of months in beta now. You can check it here - and the devel docs and github wiki page does mention it and has instructions for virtual environments.