-
-
Notifications
You must be signed in to change notification settings - Fork 241
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
add Debian package configuration #303
Conversation
@anarcat can you please take a look at the failing travis jobs? |
it's partly stuff that has to do with the path changes, for example:
because it changes the defaults in the Debian environment, it affects basically the entire test suite. i'm not sure how to handle that... |
there's another thing i'm uncertain about: the Debian packages for the *-exporter stuff all use the same prometheus::node_exporter::group: 'prometheus'
prometheus::node_exporter::user: 'prometheus' ... but I haven't done that with the apache exporter, for example. should we sync those up or does it matter? similarly, the debian package already ship a |
service files that come from a package manager should go into |
so how should we do this? the default path is set in the what you seem to be saying is that we should just not write a right now, the user override I did for the node exporter was to avoid creating a user, but the apache exporter would have been broken if we didn't install our own .service file... |
I think that a parameter like |
if i would have a clue of how to do unit tests, i would design a unit test that would:
This is partly why this is WIP: I have no idea how to do this. I've been learning some spec chops in #304 but i'm nowhere near the level where I could do this... |
i have updated the branch to just bite the bullet and disable the .service file when install_method is through a package. no unit tests, but we should make sure things work somehow, i don't know... I also had to cleanup the old files using such a resource in the parent profile: # cleanup old .service file previously deployed by prometheus module
include systemd
file {
'/etc/systemd/system/prometheus.service':
ensure => absent,
notify => Class['systemd::systemctl::daemon_reload'],
} similar structures for the exporter, of course... that feels a little redundant - i wonder if we shouldn't enforce that in the class instead of wrapping the whole systemd thing inside an |
manifests/config.pp
Outdated
content => template('prometheus/prometheus.systemd.erb'), | ||
if $prometheus::server::manage_systemd_unit { | ||
include 'systemd' | ||
systemd::unit_file {'prometheus.service': |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
instead of defining the systemd::unit_file
resoure here, should we only set $ensure = 'present
and pass that to the resource? And if $prometheus::server::manage_systemd_unit
isn't true, set $ensure = 'absent'
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that's what i said earlier:
i wonder if we shouldn't enforce that in the class instead of wrapping the whole systemd thing inside an
if
. but then it would destroy local customizations people might have as well, so maybe it's better to let the users handle the transition since we don't support debian packages officially anyways right now...
i don't mind either way...
what should be my next step here? |
Another problem has come up with this in #310: the way parameters are passed in the Debian service file is through the For now I've used the |
@anarcat Could you please do a rebase? |
@dhoppe done, but i'd still need help and guidance on the next steps to move forward here. there are unresolved conversations and questions above I would love to have feedback on. :) |
683107c
to
4146844
Compare
I have greatly simplified this by ripping out the permissions tweak in a separate PR (#323) since that is probably relevant to all installs, not just Debian. I have also removed the Hiera customization that is associated with the Debian package setup. That is trickier, because it's hard to get right for users. To enable the Debian package, they would need to do this chunk:
... I think you'll agree this is preeeetty annoying and not very practical. I am not sure how best to do this cleanly without flipping the default install method on Debian, to be honest, since we can't have conditionals in YAML (or can we?). Would love to have a better way to do this, but failing that, this will have to do for us for now, because i'd really like to see at least some of this get through. |
1978fb8
to
fe13476
Compare
and some more:
|
fe13476
to
a1d8415
Compare
committed.
committed. |
Dear @anarcat, thanks for the PR! This is Vox Pupuli Tasks, your friendly Vox Pupuli GitHub Bot. I noticed that your pull request contains merge conflict. Can you please rebase? You can find my sourcecode at voxpupuli/vox-pupuli-tasks |
Most of the other exporters have such a setting. It's important to make this work in Debian, where the service name is `prometheus-apache-exporter` and not `apache_exporter`. This was extracted from the larger Debian PR in voxpupuli#303.
dbb8f79
to
f850f89
Compare
Without this change, when the install_method is set to `package`, the various `prometheus::server` settings will never do anything because we stop touching the systemd config file. By default, the Debian systemd.service file has this entry: EnvironmentFile=/etc/default/prometheus ExecStart=/usr/bin/prometheus $ARGS ... which makes it use the ARGS define in the "default" config file. We harmonize our systemd config and init.d files to sync up with that file instead of rewriting the startup file. Closes: voxpupuli#323.
We still need it in our debian voodoo stuff.
f850f89
to
8c2adf9
Compare
Without this change, when the install_method is set to `package` and init_style is set to `none`, the various `prometheus::server` settings will never do anything because we stop touching the systemd config file. By deploying the env_file_path on the server, we allow the "Debian package" setup (install_method=package and init_style=none) to propagate the daemon_flags correctly. By default, the Debian systemd.service file has this entry: EnvironmentFile=/etc/default/prometheus ExecStart=/usr/bin/prometheus $ARGS ... which makes it use the ARGS define in the "default" config file. This is a subset of voxpupuli#303, which should hopefully pass tests and be more manageable. Closes: voxpupuli#323
Without this change, when the install_method is set to `package` and init_style is set to `none`, the various `prometheus::server` settings will never do anything because we stop touching the systemd config file. By deploying the env_file_path on the server, we allow the "Debian package" setup (install_method=package and init_style=none) to propagate the daemon_flags correctly. By default, the Debian systemd.service file has this entry: EnvironmentFile=/etc/default/prometheus ExecStart=/usr/bin/prometheus $ARGS ... which makes it use the ARGS define in the "default" config file. This is a subset of voxpupuli#303, which should hopefully pass tests and be more manageable. Closes: voxpupuli#323
We need the env_vars for the Debian package to work properly. In Debian-land, the systemd `.service` file gets its parameters from the EnvironmentFile, which we deploy through the `env_vars` here. Yes, it's backwards, and no, it's not great because it doesn't actually use the `options` stuff, but at least it works. This is necessary to have those exporters be able to accept options when using init_style=none and install_method=package. This is a split off of voxpupuli#303 which should at least pass tests (/probably/ because the `install_method=package` code path is basically untested).
alright, i split this up in two smaller PRs: #527 and #528. Neither touches the test suite, which means the tests will probably pass, but that's kind of a little white lie: the code they affect (install_method=package and init_style=none) is basically untested anyways. but at least it should be mergeable, and should form a better basis to fix #32 in the long run than this too old and complicated PR. i'll regroup on those and summarize progress in #32 instead of keeping this old thing alive. |
Most of the other exporters have such a setting. It's important to make this work in Debian, where the service name is `prometheus-apache-exporter` and not `apache_exporter`. This was extracted from the larger Debian PR in voxpupuli#303.
Without this change, when the install_method is set to `package` and init_style is set to `none`, the various `prometheus::server` settings will never do anything because we stop touching the systemd config file. By deploying the env_file_path on the server, we allow the "Debian package" setup (install_method=package and init_style=none) to propagate the daemon_flags correctly. By default, the Debian systemd.service file has this entry: EnvironmentFile=/etc/default/prometheus ExecStart=/usr/bin/prometheus $ARGS ... which makes it use the ARGS define in the "default" config file. This is a subset of voxpupuli#303, which should hopefully pass tests and be more manageable. Closes: voxpupuli#323
Pull Request (PR) description
This creates the necessary defaults on Debian to install Prometheus with the right settings from the Debian package.
The only major difference is the systemd unit file is kept in
/etc/systemd/system
: that is outside the scope of this change, as it's part of thesystemd
module.This Pull Request (PR) fixes the following issues
Fixes: #32, #323
Remaining work
I was able to install the node-exporter with this configuration using
standard Debian packages. This is a Work In Progress (WIP) because I
haven't tested the other packages and especially the main prometheus
package. Hopefully it shouldn't be too much work to implement that as
well.
The change is mostly a noop when running on top of node-exporter already installed by hand using normal Debian packages.
Tests and documentation might also need an update.