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

Fix service settings when installing from archive #92

Merged
merged 1 commit into from
Mar 7, 2017

Conversation

antyale
Copy link
Contributor

@antyale antyale commented Mar 7, 2017

I found some issues when installing from archive and using the managed systemd service. Part of the configuration is generated for the CDH RPM and it is not valid when installing from tarball.

  1. In the environment file, the CLASSPATH uses the RPM references. In principle, it is not needed because the service file has already the right CLASSPATH. Maybe another option could be to leave the correct CLASSPATH in the environment file and remove the CLASSPATH from systemd?
  2. In the service file, the zookeeper jar file has the version number as suffix when installing from tarball (e.g. zookeeper-3.4.9.jar instead of zookeeper.jar)

@@ -11,7 +11,7 @@ After=<%= scope.lookupvar("zookeeper::systemd_unit_after") %>
<% end -%>

[Service]
ExecStart=/bin/sh -c 'set -x; . <%= scope.lookupvar("zookeeper::cfg_dir") %>/<%= scope.lookupvar("zookeeper::environment_file") %>; CLASSPATH="<%= @_zoo_dir %>/zookeeper.jar:<%= @_zoo_dir %>/lib/*:$CLASSPATH"; CLASSPATH="$(. <%= scope.lookupvar("zookeeper::service::_zoo_dir") %>/bin/zkEnv.sh ; echo $CLASSPATH)"; mkdir -p <%= scope.lookupvar("zookeeper::log_dir") %>; $JAVA "-Dzookeeper.log.dir=<%= scope.lookupvar("zookeeper::log_dir") %>" "-Dzookeeper.root.logger=$ZOO_LOG4J_PROP" -cp "$CLASSPATH" $JAVA_OPTS "$ZOOMAIN" "$ZOOCFG"'
ExecStart=/bin/sh -c 'set -x; . <%= scope.lookupvar("zookeeper::cfg_dir") %>/<%= scope.lookupvar("zookeeper::environment_file") %>; CLASSPATH="<%= @_zoo_dir %>/zookeeper<% if scope.lookupvar('zookeeper::install_method') == 'archive' -%>-<%= scope.lookupvar("zookeeper::archive_version") %><% end -%>.jar:<%= @_zoo_dir %>/lib/*:$CLASSPATH"; CLASSPATH="$(. <%= scope.lookupvar("zookeeper::service::_zoo_dir") %>/bin/zkEnv.sh ; echo $CLASSPATH)"; mkdir -p <%= scope.lookupvar("zookeeper::log_dir") %>; $JAVA "-Dzookeeper.log.dir=<%= scope.lookupvar("zookeeper::log_dir") %>" "-Dzookeeper.root.logger=$ZOO_LOG4J_PROP" -cp "$CLASSPATH" $JAVA_OPTS "$ZOOMAIN" "$ZOOCFG"'
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be possible to split this line? Maybe something like:

Environment="CLASSPATH=..."

just to make the code a bit more readable.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure, it will be much better. I send an update when it is done, Thanks!

@deric
Copy link
Owner

deric commented Mar 7, 2017

Thanks a lot, it looks good. Just the systemd one-line-code is becoming unmanageable.

@antyale
Copy link
Contributor Author

antyale commented Mar 7, 2017

I realized that using the Environment=CLASSPATH=... in the service file could break the service in some systems because the ExecStart modifies the CLASSPATH value in several commands.

I have split the ExecStart in multiple lines, this is not very elegant but maybe is enough to make it readable... what do you think?

@deric
Copy link
Owner

deric commented Mar 7, 2017

Great, that's much better.

@deric deric merged commit 2dea5ce into deric:master Mar 7, 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.

2 participants