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

Issue in template #606

Closed
gauravchaudhary999 opened this issue Jun 18, 2015 · 4 comments
Closed

Issue in template #606

gauravchaudhary999 opened this issue Jun 18, 2015 · 4 comments
Labels

Comments

@gauravchaudhary999
Copy link

We are running play application and using 'sbt-native-packager' generated the rpm installer.
When we install rpm on centos-7 it started the application.
we can verify it by running /etc/init.d/<app_name> status command, But we noticed the application was not running, And when we checked the logs at /var/log/<app_name>/daemon.log is says

Exception in thread "main" java.io.FileNotFoundException: /usr/share/<app_name>/RUNNING_PID (Permission denied)
at java.io.FileOutputStream.open0(Native Method)
at java.io.FileOutputStream.open(FileOutputStream.java:270)
at java.io.FileOutputStream.(FileOutputStream.java:213)
at java.io.FileOutputStream.(FileOutputStream.java:162)

So, the problem was, it tried to find the RUNNING_PID at the application home, but in the startup script /etc/init.d/<app_name> the pidfile value was /var/run/<app_name>/running.pid.

After some investigation, we are able to run the application, but that need one change in /etc/default/<app_name> script. The change we made was uncommenting this line

JAVA_OPTS="-Dpidfile.path=/var/run/<app_name>/play.pid $JAVA_OPTS"

We went further and fork the sbt-native-packager repo and made the fix in the template etc-default-template. and verified it by using following steps:

Change the version to end with -SNAPSHOT
run sbt publishLocal
Change the plugin version with *-SNAPSHOT version in our application

And now when we installed the application rpm on fresh centos-7, application runs successfully.

Can we send the pull request for the issue? we haven't tested it on other platform.

@kardapoltsev
Copy link
Member

Take a look at #602. This is happens because Play itself tries to create pid file in CWD. When you aren't using play app you don't need to pass JAVA_OPTS="-Dpidfile.path=/var/run/qokoon/play.pid $JAVA_OPTS.

@gauravchaudhary999
Copy link
Author

Is it not preferable that the plugin accept a value for JAVA_OPTS configured in the build and use the same instead of the template for /etc/default using the commented line. This will ensure that users of the plugin can specify a value or choose not to use one.

@gauravchaudhary999
Copy link
Author

Apologies, as we had not looked through all of the documentation and now we know how to supply an override for files (such as /etc/default/).

At the moment, we are still trying to figure out what the issue is when a JAVA_OPTS is not supplied. Any pointers?

You may go ahead and close the issue.

@muuki88 muuki88 added the rpm label Jun 19, 2015
@muuki88
Copy link
Contributor

muuki88 commented Jun 19, 2015

As @kardapoltsev pointed out, play creates the PID file itself. If you use SystemV, which is the default for rpm-builds, the start-rpm-template needs to know where the PID is located. That's the reason you have to provide the PID file.

see #541 for the code details

@muuki88 muuki88 closed this as completed Jun 19, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants