New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ServerConfig.address should be configurable via environment variable and system property #1032

Closed
JonasHavers opened this Issue Jul 24, 2016 · 3 comments

Comments

Projects
None yet
2 participants
@JonasHavers
Contributor

JonasHavers commented Jul 24, 2016

In addition to the environment variables RATPACK_PORT, RATPACK_PUBLIC_ADDRESS, RATPACK_DEVELOPMENT it would be helpful if we could provide the inet address to bind the ratpack server to.

For example, hosting a DYI cartridge at Openshift requires the application to bind to a specific (dynamic) IP address ($OPENSHIFT_DIY_IP). Providing a general solution to configure the inet address externally, it will be possible to deploy an unmodified fat-jar to multiple cartridges.

To stay consistent with the ratpack.server.ServerConfig#address naming, I suggest the environment variable name RATPACK_ADDRESS and the system property name ratpack.address. This may be added to ratpack.server.internal.ServerEnvironment in ratpack-core.

@ldaley

This comment has been minimized.

Show comment
Hide comment
@ldaley

ldaley Jul 25, 2016

Member

Makes sense, and plan sounds good.

Member

ldaley commented Jul 25, 2016

Makes sense, and plan sounds good.

@ldaley ldaley added this to the release-1.5.0 milestone Jul 25, 2016

@ldaley

This comment has been minimized.

Show comment
Hide comment
@ldaley

ldaley Jul 25, 2016

Member

FYI, if you enable the env var config source, you can use «prefix»SERVER__ADDRESS to set this with released versions.

Member

ldaley commented Jul 25, 2016

FYI, if you enable the env var config source, you can use «prefix»SERVER__ADDRESS to set this with released versions.

@JonasHavers

This comment has been minimized.

Show comment
Hide comment
@JonasHavers

JonasHavers Jul 25, 2016

Contributor

Thanks for your quick response, Luke. Enabling the env var config source does the job for now. For the sake of documentation it is done this way:

ratpack {
  serverConfig {
    env()
  }
}

So my starter script ("start action_hook") at Openshift looks like this now:

export JAVA_HOME=/etc/alternatives/java_sdk_1.8.0
export PATH=$JAVA_HOME/bin:$PATH
export RATPACK_SERVER__ADDRESS=$OPENSHIFT_DIY_IP
export RATPACK_SERVER__PORT=$OPENSHIFT_DIY_PORT
nohup java -jar $OPENSHIFT_REPO_DIR/<MY_DIR>/<MY_JAR>.jar |& /usr/bin/logshifter -tag ratpack &

I will write a blog post on deploying a ratpack application to a DIY cartridge on Openshift. Before that, I will provide a pull request for this issue.

Contributor

JonasHavers commented Jul 25, 2016

Thanks for your quick response, Luke. Enabling the env var config source does the job for now. For the sake of documentation it is done this way:

ratpack {
  serverConfig {
    env()
  }
}

So my starter script ("start action_hook") at Openshift looks like this now:

export JAVA_HOME=/etc/alternatives/java_sdk_1.8.0
export PATH=$JAVA_HOME/bin:$PATH
export RATPACK_SERVER__ADDRESS=$OPENSHIFT_DIY_IP
export RATPACK_SERVER__PORT=$OPENSHIFT_DIY_PORT
nohup java -jar $OPENSHIFT_REPO_DIR/<MY_DIR>/<MY_JAR>.jar |& /usr/bin/logshifter -tag ratpack &

I will write a blog post on deploying a ratpack application to a DIY cartridge on Openshift. Before that, I will provide a pull request for this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment