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 Archlinux acceptance test #719

Merged
merged 1 commit into from
May 18, 2024
Merged

Conversation

TheMeier
Copy link
Collaborator

@TheMeier TheMeier commented May 5, 2024

This fixes the Archlinux tests. Most notably the default for install_method is reset to the default for Archlinux. This is because most exporters actually don't have a package for Archlinux. The changes are somwhat backwards incompatible, but I would argue that previously the module was broken for Archlinux. So I consider this a bugfix instead.

@TheMeier TheMeier force-pushed the fix_arch_acceptance_test branch 4 times, most recently from 3e46104 to 0cac5c7 Compare May 5, 2024 09:46
@TheMeier TheMeier added the enhancement New feature or request label May 5, 2024
@TheMeier TheMeier marked this pull request as ready for review May 5, 2024 10:01
@TheMeier TheMeier force-pushed the fix_arch_acceptance_test branch from 0cac5c7 to 4e5c6ff Compare May 5, 2024 10:03
@TheMeier TheMeier force-pushed the fix_arch_acceptance_test branch 3 times, most recently from 4bcf954 to 8115478 Compare May 5, 2024 10:42
@TheMeier TheMeier requested a review from bastelfreak May 5, 2024 10:57
@binford2k
Copy link
Member

Hallo! Fill out this form if you'd like to claim your May the Source Be With You sticker! https://forms.office.com/r/Cn55uJmWMH

@TheMeier TheMeier force-pushed the fix_arch_acceptance_test branch from 8115478 to aea810b Compare May 18, 2024 17:51
This commit fixes the Archlinux tests. Most notably the default for
`install_method` is reset to the default for Archlinux. This is because
most exporters actually don't have a package for Archlinux. The changes
are somwhat backwards incompatible, but I would argue that previously the
module was broken for Archlinux. So I consider this a bugfix instead.
@TheMeier TheMeier force-pushed the fix_arch_acceptance_test branch from aea810b to 8a142e2 Compare May 18, 2024 17:52
@TheMeier TheMeier requested a review from bastelfreak May 18, 2024 18:12
@bastelfreak bastelfreak merged commit aff27e1 into master May 18, 2024
33 checks passed
@bastelfreak bastelfreak deleted the fix_arch_acceptance_test branch May 18, 2024 21:50
@TheMeier TheMeier added this to the v15.0.0 milestone Jun 2, 2024
@TheMeier TheMeier changed the title Fix arch acceptance test Fix Archlinux acceptance test Jun 13, 2024
@hashworks
Copy link
Member

hashworks commented Jul 12, 2024

EDIT: Nevermind, I had an error on my side.

@hashworks
Copy link
Member

hashworks commented Jul 12, 2024

One thing doesn't seem to work though: Arch Prometheus expects the WorkingDirectory to be /usr/share/prometheus, otherwise it can't load the frontend assets.

Error opening React index.html: open static/react/index.html: no such file or directory

https://gitlab.archlinux.org/archlinux/packaging/packages/prometheus/-/blob/main/prometheus.service?ref_type=heads#L12

@TheMeier
Copy link
Collaborator Author

IIRC this PR did not touch anything related here. Can you try to set it yourself using prometheus::systemd_service_options

@hashworks
Copy link
Member

This PR sets prometheus::server::manage_init_file to true on Arch, which overrides the service file provided by the package manager. The service file of this module does not set WorkingDirectory.

Of course, I can fix this by setting systemd_service_options, but this shouldn't be the expected solution.

@TheMeier
Copy link
Collaborator Author

I see. Part of the issue is that this is the only target where prometheus::server::install_method is set to package. That is also the reason why the tests have been broken for such a long time.

Ideally install_method would be set to package for all components and exporters for all targets that provide packages, but that would be a massive undertaking. This is also one of the reasons why I advocate for splitting up this module.

I will have a look at it and see if I can provide a fix. Or if you would like to have a go at it pull requests are always welcome.

In the meantime could you please file a new issue for this?

@TheMeier
Copy link
Collaborator Author

I have made quick test in a vagrant box. adding WorkingDirectory=/usr/share/prometheus fixes at least the error you reported @hashworks. I will check if we could just revert prometheus::server::install_method for archlinux or if we need to do something else.

This is the full diff between the package unit file and the module generated one:

--- /usr/lib/systemd/system/prometheus.service	2024-07-10 13:36:16.000000000 +0000
+++ prometheus.service	2024-07-14 17:56:55.905550700 +0000
@@ -1,19 +1,19 @@
+# Deployed with puppet
+#
+
 [Unit]
-Description=Prometheus service
-Documentation=https://prometheus.io/docs/prometheus
-Requires=network-online.target
-After=network-online.target nss-lookup.target
-Wants=network-online.target nss-lookup.target
+Description=Prometheus Monitoring framework
+Wants=basic.target
+After=basic.target
+After=network.target
 
 [Service]
 User=prometheus
 Group=prometheus
-Restart=on-failure
-WorkingDirectory=/usr/share/prometheus
-EnvironmentFile=-/etc/conf.d/prometheus
-ExecStart=/usr/bin/prometheus --config.file=/etc/prometheus/prometheus.yml --storage.tsdb.path=/var/lib/prometheus/data $PROMETHEUS_ARGS
+ExecStart=/usr/bin/prometheus --config.file=/etc/prometheus/prometheus.yml --web.console.templates=/usr/local/share/prometheus/consoles --web.console.libraries=/usr/local/share/prometheus/console_libraries --storage.tsdb.path=/var/lib/prometheus --storage.tsdb.retention.time=360h
 ExecReload=/bin/kill -HUP $MAINPID
-LimitNOFILE=65535
+KillMode=process
+Restart=always
 NoNewPrivileges=true
 ProtectHome=true
 ProtectSystem=full
@@ -22,11 +22,12 @@
 ProtectKernelModules=true
 ProtectKernelTunables=true
 LockPersonality=true
-RestrictRealtime=yes
-RestrictNamespaces=yes
-MemoryDenyWriteExecute=yes
-PrivateDevices=yes
+RestrictRealtime=true
+RestrictNamespaces=true
+MemoryDenyWriteExecute=true
+PrivateDevices=true
 CapabilityBoundingSet=
 
 [Install]
 WantedBy=multi-user.target

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants