0

I am trying to deploy a dancer based application on openshift. I am unable to workaround teh following issues.

  • How do I get dancer to use the openshift environment variables e.g. OPENSHIFT_MYSQL_DB_HOST or OPENSHIFT_DATA_DIR. Putting them in the config.yml files is not working i tried $OPENSHIFT_DATA_DIR and $ENV{OPENSHIFT_DATA_DIR} overriding them in the application code is not working...
  • Does openshift store the console log somewhere? rhc tail does not provide the complete output...
  • Is it possible to run the app on the server from a ssh shell? I tried it but am getting a permission denied error

Dancer is a perl based web framework. see https://metacpan.org/pod/Dancer::Cookbook

szabgab
  • 6,202
  • 11
  • 50
  • 64
vijayvithal
  • 551
  • 1
  • 5
  • 13

1 Answers1

0

I am not sure what a dancer application is, but for a java application with a mysql db on openshift, you access it with the following code

Import the following:

import javax.naming.Context;
import javax.naming.InitialContext;
import javax.sql.DataSource;

then use the following as your connection string:

InitialContext ic = new InitialContext();
Context initialContext = (Context) ic.lookup("java:comp/env");
DataSource dataSource = (DataSource) initialContext.lookup("jdbc/MysqlDS");

Connection connection = dataSource.getConnection();

I hope this helps.

Joseph
  • 1