mwanji / essayist

A blogging app for the tent.io protocol
10 stars 2 forks source link

Support deployment on Heroku #69

Open pjesi opened 11 years ago

mwanji commented 11 years ago

What needs to happen to make fix this?

pjesi commented 11 years ago

This is what I had so far:

if(heroku){
      try {
          URI dbUri = new URI(System.getenv("DATABASE_URL"));

          String username = dbUri.getUserInfo().split(":")[0];
          String password = dbUri.getUserInfo().split(":")[1];
          String dbUrl = "jdbc:postgresql://" + dbUri.getHost() + ':' + dbUri.getPort() + "/" + dbUri.getPort();

          poolProperties.setUsername(username);

          poolProperties.setPassword(password);
          poolProperties.setUrl(dbUrl);
          poolProperties.setDriverClassName("org.postgresql.Driver");
      } catch (URISyntaxException e) {
          // ...
      }
  }

This is essentially what they suggest

So, either this can be done cleverly in the ServletContextListener. Or that we have multiple SCL, one for each backend implementation. That would make it easy to add support for various platforms. Then, the current SCP should be split into two, one for web logic, and one for persistance

mwanji commented 11 years ago

Cool. We could have a PoolPropertiesProvider interface, with JDBC and Heroku implementations.

Then, either SCL has an overridable method that returns the jdbc impl by default, or we take a setting from essayist.properties, eg.

essayist.platform=heroku

or

db.poolPropertiesProvider=fully-qualified name

with jdbc as default in both cases.

pjesi commented 11 years ago

Yeah something like that. But I never actually managed to get it working on Heroku though :)

On Fri, Feb 1, 2013 at 8:36 AM, Moandji Ezana notifications@github.comwrote:

Cool. We could have a PoolPropertiesProvider interface, with JDBC and Heroku implementations.

Then, either SCL has an overridable method that returns the jdbc impl by default, or we take a setting from essayist.properties, eg.

essayist.platform=heroku

or

db.poolPropertiesProvider=fully-qualified name

with jdbc as default in both cases.

— Reply to this email directly or view it on GitHubhttps://github.com/mwanji/essayist/issues/69#issuecomment-12985231.