Skip to content
This repository has been archived by the owner on Jul 15, 2021. It is now read-only.

rpki-validator seems to use a hardcoded path conf/log4j.xml #1

Closed
ghost opened this issue Oct 25, 2013 · 7 comments
Closed

rpki-validator seems to use a hardcoded path conf/log4j.xml #1

ghost opened this issue Oct 25, 2013 · 7 comments
Assignees

Comments

@ghost
Copy link

ghost commented Oct 25, 2013

Hi,

I'm trying to realize a package with rpki-validator. In order to realize a good integration of this app on my system, I tried to modify CONF_DIR in order to be able to move the ./conf into /etc/rpki-validator/conf

But when I start rpki-validator.sh, I only get the following message:

/etc/init.d/rpki-validator.sh start

[ info ] Starting rpki-validator...
[ info ] writing logs under log directory
[ info ] Web user interface is available on port 8080
[ info ] Routers can connect on port 8282
[ info ] Writing PID 22630 to /var/run/rpki-validator.pid
Exception in thread "main" java.lang.IllegalArgumentException: requirement failed: Configuration file 'conf/log4j.xml' was not found.
at scala.Predef$.require(Predef.scala:233)
at net.ripe.rpki.validator.config.Main$.configureLogging(Main.scala:86)
at net.ripe.rpki.validator.config.Main$.main(Main.scala:75)
at net.ripe.rpki.validator.config.Main.main(Main.scala)

I just discovered the source code on Github and read that conf/log4j.xml seems hardcoded directly in the source code. Would it be possible to find a way in order it is not hardcoded ? Maybe by putting a path into the .sh or in a conf file ? Or maybe I'm missing something?

Thanks,
Carl Chenet

@timbru
Copy link

timbru commented Oct 28, 2013

Hi Carl

The path is hard coded because that allows us to 'watch' this file for changes, so that one can reconfigure the log level without restarting the app. In theory it's possible of course to optionally pass in a path for an alternative location of this file, but that adds complexity.

So before we take this any further can you elaborate a bit more on why this current setup is causing issues for you?

Cheers

Tim

@ghost
Copy link
Author

ghost commented Oct 29, 2013

On 28/10/2013 20:51, Tim Bruijnzeels wrote:

Hi Carl

The path is hard coded because that allows us to 'watch' this file for changes, so that one can reconfigure the log level without restarting the app. In theory it's possible of course to optionally pass in a path for an alternative location of this file, but that adds complexity.

So before we take this any further can you elaborate a bit more on why this current setup is causing issues for you?

Cheers

Tim


Reply to this email directly or view it on GitHub:
#1 (comment)

Hi Tim,

Thanks for your answer.

I currently write a Debian package for rpki-validator because our
deployment infrastructure only authorizes Debian packages. Moreover this
package could be the official Debian package of rpki-validator (I'm an
official Debian developer).

In order to make it I need to comply with some standards when my
package is installing and deploying files and directories on the
systems, as:

  • file configurations must be in /etc/rpki-validator
  • jar files must be in /usr/share/rpki-validator
  • exe files must be in /usr/bin
  • pid files go to /var/run

I was able to perform this different tasks and rpki-validator.sh starts
successfully, but I do have the following error message:

[ info ] Starting rpki-validator...
[ info ] writing logs under log directory
[ info ] Web user interface is available on port 8080
[ info ] Routers can connect on port 8282
[ info ] Writing PID 22630 to /var/run/rpki-validator.pid
Exception in thread "main" java.lang.IllegalArgumentException:
requirement failed: Configuration file 'conf/log4j.xml' was not found.
at scala.Predef$.require(Predef.scala:233)
at net.ripe.rpki.validator.config.Main$.configureLogging(Main.scala:86)
at net.ripe.rpki.validator.config.Main$.main(Main.scala:75)
at net.ripe.rpki.validator.config.Main.main(Main.scala)

After this error, rpki-validator.sh crashes. As I said above, my file
log4j.xml is in the directory /etc/rpki-validator/conf/log4j.xml and it
seems rpki-validator is just looking for a file conf/log4j.xml from a
relative path. It could be nice to to add a parameter at the java start
command in order to indicate the path for the configuration file
something like --conf-path=/whatever/users/want/conf

Or maybe I'm missing something here. Let me know.

Regards

Carl Chenet

Blog : https://carlchenet.com
https://identi.ca/carlchenet | https://twitter.com/carl_chenet
Contributions to FOSS : http://www.ohloh.net/accounts/chaica

@timbru
Copy link

timbru commented Oct 29, 2013

Hi Carl,

Great, having an official debian package would be really cool.

We will look into this, and get back to you when we have some work done. I realised there are more hardcoded relative paths used by the validator, but following the gist of your reply I will make them configurable as well. I don't expect this to be very hard, but I am currently traveling so it may be a few days before I get back to you with a version to try.

A side comment that my colleague Miklos raised: While most of us here use Oracle JDK7, Miklos uses OpenJDK 7 and has been for some time, and we're confident that we can support this as well. So, you will probably want the package to depend on "openjdk-7-jre" rather than having to download the Oracle version that has to be distributed differently because of its license. Note that openjdk 6 is not an option.

Tim

@timbru
Copy link

timbru commented Nov 1, 2013

Hi Carl,

I made a version that allows overriding the default paths for files and resources. Can you please try it out before we decide to release this? You can download it here:

https://certification.ripe.net/content/static/validator/rpki-validator-app-616-dist.tar.gz

(616 is the build number)

I am not sure if you're wrapping our existing startup script, but if you are, then you can use these environment variables to change the defaults:

RPKI_VALIDATOR_CONF_DIR Application expects log4j.xml here
RPKI_VALIDATOR_LIB_DIR Application jar and libraries, added to java class path
RPKI_VALIDATOR_DATA_DIR Data storage (in app data and settings)
RPKI_VALIDATOR_TAL_DIR Directory containing TAL files
RPKI_VALIDATOR_WORK_DIR Working directory used to cache and download objects using rsync
RPKI_VALIDATOR_ACCESS_LOG HTTP access log location

If you change the location of the log4j.xml config file, please be aware, there are hard coded paths to the validator.log and rtr.log file defined here. You will need to update these.

On a related note I am more and more inclined to change this whole set up and use a simple configuration file for all these settings rather than passing everything in as command arguments. That would essentially just leave one option: to override the location of that config file. To me that seems more consistent with how daemon applications are normally run. That said, I am not sure when we will have the cycles to do this. It's a non-trivial change, so we can only really justify working on that if there is a good indication that users would see it as an improvement.

Please let me know what you think. Does the current version work for you, or do you see a need to do things differently?

Cheers
Tim

@ghost
Copy link
Author

ghost commented Nov 5, 2013

On 01/11/2013 21:18, Tim Bruijnzeels wrote:

Hi Carl,

I made a version that allows overriding the default paths for files and resources. Can you please try it out before we decide to release this? You can download it here:

https://certification.ripe.net/content/static/validator/rpki-validator-app-616-dist.tar.gz

(616 is the build number)

I am not sure if you're wrapping our existing startup script, but if you are, then you can use these environment variables to change the defaults:

RPKI_VALIDATOR_CONF_DIR Application expects log4j.xml here
RPKI_VALIDATOR_LIB_DIR Application jar and libraries, added to java class path
RPKI_VALIDATOR_DATA_DIR Data storage (in app data and settings)
RPKI_VALIDATOR_TAL_DIR Directory containing TAL files
RPKI_VALIDATOR_WORK_DIR Working directory used to cache and download objects using rsync
RPKI_VALIDATOR_ACCESS_LOG HTTP access log location

If you change the location of the log4j.xml config file, please be aware, there are hard coded paths to the validator.log and rtr.log file defined here. You will need to update these.

On a related note I am more and more inclined to change this whole set up and use a simple configuration file for all these settings rather than passing everything in as command arguments. That would essentially just leave one option: to override the location of that config file. To me that seems more consistent with how daemon applications are normally run. That said, I am not sure when we will have the cycles to do this. It's a non-trivial change, so we can only really justify working on that if there is a good indication that users would see it as an improvement.

Please let me know what you think. Does the current version work for you, or do you see a need to do things differently?

Cheers
Tim


Reply to this email directly or view it on GitHub:
#1 (comment)

Hi Tim,

Thanks a lot for your work. With this new version I was able to run the
rpki-validator without errors while specifying my own locations, like:

export RPKI_VALIDATOR_CONF_DIR=/etc/rpki-validator

export RPKI_VALIDATOR_CONF_DIR=/etc/rpki-validator/conf

export RPKI_VALIDATOR_LIB_DIR=/usr/share/rpki-validator

export RPKI_VALIDATOR_DATA_DIR=/usr/share/rpki-validator

export RPKI_VALIDATOR_TAL_DIR=/etc/rpki-validator/conf/tal

export RPKI_VALIDATOR_WORK_DIR=/tmp

export RPKI_ACCESS_LOG=/var/log/rpki-validator

/etc/init.d/rpki-validator.sh start

[ info ] Starting rpki-validator...
[ info ] writing logs under log directory
[ info ] Web user interface is available on port 8080
[ info ] Routers can connect on port 8282
[ info ] Writing PID 4091 to rpki-validator.pid

So it is ok for me. I guess using a simple configuration file for all
these settings would be more flexible solution but it is a nice
improvement already.

Thanks again,

Carl Chenet

Blog : https://carlchenet.com
https://identi.ca/carlchenet | https://twitter.com/carl_chenet
Contributions to FOSS : http://www.ohloh.net/accounts/chaica

@ghost ghost assigned timbru Nov 6, 2013
@timbru
Copy link

timbru commented Nov 15, 2013

Hi Carl,

We have been working on a version that uses a config file for all settings.

Could you please give it a try? We'd like to include this in the next release.

We are still working on a small feature before this release (monitoring problems for each configured trust anchor), but I expect this will be done early next week.

You can download a binary here:
https://certification.ripe.net/content/static/validator/rpki-validator-app-config-files-dist.tar.gz

Thanks
Tim

@timbru
Copy link

timbru commented Nov 29, 2017

We had no feedback otherwise, so assume this addressed the issue.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant