OpenShift deployment

549 views
Skip to first unread message

Maarten Mulders

unread,
Mar 25, 2014, 5:30:47 AM3/25/14
to dropwiz...@googlegroups.com
Hi folks,

Using a Do-It-Yourself cartridge, I'm trying to deploy a Dropwizard application to OpenShift. My configuration includes the lines below, which get filled using sed based on some environment variables. $OPENSHIFT_DIY_IP resolves to 127.45.x.y, so it is in the loopback range.

server:
 applicationConnectors:
   - type: http
     bindHost: @OPENSHIFT_DIY_IP@
     port: @OPENSHIFT_DIY_PORT@

However, when I start the application, it throws an Exception and exists. The Exception is this:

Exception in thread "main" java.lang.RuntimeException: java.net.SocketException: Permission denied
at org.eclipse.jetty.setuid.SetUIDListener.lifeCycleStarting(SetUIDListener.java:213)
at org.eclipse.jetty.util.component.AbstractLifeCycle.setStarting(AbstractLifeCycle.java:187)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
at io.dropwizard.cli.ServerCommand.run(ServerCommand.java:43)
at io.dropwizard.cli.EnvironmentCommand.run(EnvironmentCommand.java:43)
at io.dropwizard.cli.ConfiguredCommand.run(ConfiguredCommand.java:76)
at io.dropwizard.cli.Cli.run(Cli.java:70)
at io.dropwizard.Application.run(Application.java:72)
at my.Application.main(Application.java:62)
Caused by: java.net.SocketException: Permission denied
at sun.nio.ch.Net.bind0(Native Method)
at sun.nio.ch.Net.bind(Net.java:444)
at sun.nio.ch.Net.bind(Net.java:436)
at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:214)
at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74)
at org.eclipse.jetty.server.ServerConnector.open(ServerConnector.java:264)
at org.eclipse.jetty.setuid.SetUIDListener.lifeCycleStarting(SetUIDListener.java:200)
... 8 more

When I try it locally with the same config, it runs smoothly. Any thoughts? Am I missing something, or is this a subtle bug in Dropwizard? 

Regards,

Maarten

Maarten Mulders

unread,
Mar 27, 2014, 5:02:53 AM3/27/14
to dropwiz...@googlegroups.com
Well, I managed to fix it. For anyone running into the same issue, here's what went wrong: I forgot to configure the adminConnector, so it was trying to bind to 0.0.0.0, which is not allowed on an OpenShift node.

Cheers,

Maarten

Florent Bonamis

unread,
Aug 30, 2014, 10:55:49 AM8/30/14
to dropwiz...@googlegroups.com
Hi Maarten, How did you configure the adminConnector?

Maarten Mulders

unread,
Aug 31, 2014, 3:32:59 AM8/31/14
to dropwiz...@googlegroups.com
In your configuration file, you need to explicitly define an
adminConnector next to the applicationConnector:

server:
applicationConnectors:
- type: http
bindHost: @OPENSHIFT_DIY_IP@
port: @OPENSHIFT_DIY_PORT@
adminConnectors:
- type: http
bindHost: @OPENSHIFT_DIY_IP@
port: @SOME_OTHER_PORT@

See [1] for a more complete reference.

Regards,

Maarten

[1] https://dropwizard.github.io/dropwizard/manual/configuration.html

On 30-08-14 16:55, Florent Bonamis wrote:
> Hi Maarten, How did you configure the adminConnector?
>
> Le jeudi 27 mars 2014 10:02:53 UTC+1, Maarten Mulders a écrit :
>
> Well, I managed to fix it. For anyone running into the same issue,
> here's what went wrong: I forgot to configure the adminConnector, so
> it was trying to bind to 0.0.0.0, which is not allowed on an
> OpenShift node.
>
> Cheers,
>
> Maarten
>
> On Tuesday, March 25, 2014 10:30:47 AM UTC+1, Maarten Mulders wrote:
>
> Hi folks,
>
> Using a Do-It-Yourself cartridge, I'm trying to deploy a
> Dropwizard application to OpenShift. My configuration includes
> the lines below, which get filled using sed based on some
> environment variables. $OPENSHIFT_DIY_IP resolves to 127.45.x.y,
> so it is in the loopback range.
>
> |
>
> server:
> applicationConnectors:
> -type:http
> --
> You received this message because you are subscribed to a topic in the
> Google Groups "dropwizard-user" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/dropwizard-user/kWC6Ps3oMLA/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> dropwizard-us...@googlegroups.com
> <mailto:dropwizard-us...@googlegroups.com>.
> For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages