Skip to content
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

Adding support to set port externally with system property #478

Conversation

cardil
Copy link

@cardil cardil commented Mar 5, 2016

Unfortunately Spark doesn't support setting port from system property. It's sometimes nessesery to give port for example in Heroku https://devcenter.heroku.com/articles/java-faq#what-constraints-should-i-be-aware-of-when-developing-applications-on-heroku:

The web process must listen on one and only one port. The port must be the one specified in the $PORT variable. If your process listens on other ports, it will be shut down by Heroku.

In Spring Boot you can give port from command line like this:

java -Dserver.port=$PORT -jar spring-app-1.0.0.jar

In WildFly Swarm you also can give port like this:

java -Dswarm.http.port=$PORT -jar swarm-app-1.0.0.jar

I'm proposing to solve this by using the same property name as in Spring Boot server.port for easier migration between those two.

This PR will also makes posible my feature for Gasper: wavesoftware/java-gasper#1

I tested those changes with test application.

@jkwatson
Copy link
Contributor

jkwatson commented Mar 5, 2016

I've run spark apps on heroku a lot, and it's never been an issue to grab the PORT environment variable as a part of the Main method that you start your app with, and initialize Spark with it.

@cardil
Copy link
Author

cardil commented Mar 6, 2016

@jkwatson You apps are using Heroku convention then. I'ts vendor locking. I'm proposing to use library solution, like Spring and Swarm have done.

@tipsy
Copy link
Contributor

tipsy commented Feb 28, 2017

@cardil Can you update this?

@tipsy
Copy link
Contributor

tipsy commented Apr 8, 2017

I'll close this then. Feel free to re-open if you want this added after all.

@tipsy tipsy closed this Apr 8, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants