Installing Roller on Jetty and Postgresql

Roller Weblogger can be installed using postgresql and Jetty (using the JettyPlus extensions) with a little work.

Correcting the code: The first issue is that there is a current bug with Roller (verison 0.9.8.1) that causes it to break when used with Postgres. This is documented here. If you’re happy doing a one-line patch to the code then you’ll be set, otherwise you should consider using MySQL. To fix this download the Roller source, apply the fix in the bug-report, run ant all and the resulting code will be placed in build/roller.

Postgresql configuration: Roller provides a schema to setup postgres, under WEB-INF/dbscripts. Roller then needs to be told that it is using Postgres. Change directory to WEB-INF and copy the file database.xml.postgresql to database.xml.

Jetty configuration: Jetty first needs to be told to use some extra functionality. Edit <jetty-dir>/etc/jetty.xml and change the first <Configure> line to use the server class org.mortbay.jetty.plus.Server.

Next deploy Roller. With the default configuration this can be done by dropping the roller directory into <jetty-dir>/webapps. If you wish to explicitly deploy Roller to a specific context then this can be done by modifying <jetty-dir>/etc/jetty.xml and adding the following:

  <Call name="addWebApplication">
    <Arg>/roller</Arg>
    <Arg>/usr/local/webapps/roller</Arg>
    <Set name="extractWAR">false</Set>
    <Set name="defaultsDescriptor">org/mortbay/jetty/servlet/webdefault.xml</Set>
  </Call>

and modifying appropriately.

Next you need to setup the JDBC login realm. First add the following to the jetty.xml:

  <Call name="addRealm">
    <Arg>
      <New class="org.mortbay.http.JDBCUserRealm">
        <Arg>Roller Realm</Arg>
        <Arg>/usr/local/webapps/roller/jetty/rollerRealm.properties</Arg>
      </New>
    </Arg>
  </Call>

Edit rollerRealm.properties and change to this:

  jdbcdriver = org.postgresql.Driver
  url = jdbc:postgresql://dbhost/roller
  username = youruser
  password = yourpassword
  usertable = rolleruser
  usertablekey = id
  usertableuserfield = username
  usertablepasswordfield = passphrase
  roletable = userrole
  roletablekey = id
  roletablerolefield = rolename
  userroletable = userrole
  userroletablerolekey = id
  userroletableuserkey = userid
  cachetime = 300

Next you need to add a container DB connection pool. GO to jetty.xml and add the following:

  <Call name="addService">
    <Arg>
      <New class="org.mortbay.jetty.plus.JotmService">
        <Set name="Name">TransactionMgr</Set>
        <!-- set up a pooled DataSource -->
        <Call name="addDataSource">
          <Arg>jdbc/rollerdb</Arg>
          <!-- set up the datasource -->
          <Arg>
            <New class="org.enhydra.jdbc.standard.StandardXADataSource">
              <Set name="DriverName">org.postgresql.Driver</Set>
              <Set name="Url">jdbc:postgresql://dbhost/roller</Set>
              <Set name="User">youruser</Set>
              <Set name="Password">yourpassword</Set>
            </New>
          </Arg>
          <!-- set up a pool for the datasource -->
          <Arg>
            <New class="org.enhydra.jdbc.pool.StandardXAPoolDataSource">
              <Arg type="Integer">4</Arg>
              <Set name="MinSize">4</Set>
              <Set name="MaxSize">15</Set>
            </New>
          </Arg>
        </Call>
      </New>
    </Arg>
  </Call>

Running Jetty: As we are running JettyPlus rather than the vanilla jetty we need to have a custom command-line. This looks like this:

  java -Djetty.server=org.mortbay.jetty.plus.Server \
     -Djetty.home=<jetty-dir> \
     -jar start.jar \
     <roller-dir>/jetty.xml

  1. Archives

  2. Categories

  3. Twitter

    • Just got pictures of the earthquake damage from my sister in Kaiapoi. Real "the ground opened up" stuff. 38 minutes ago
    • Ooo, the beta of Angry Birds is out on Android. 18 hours ago
    • Released a new version of my Android Internode widget; fixes the problem with Internode's new SSL cert. 23 hours ago
    • @wangjammer5: Cool, here's something to get you started: http://is.gd/eT33b :) 1 day ago
    • So, if iTune Ping is Apple's social network will the perpetual Apple tweet circle-jerk move there now? 1 day ago
  4. RSS Google Reader Shared Items