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 systemd startup #1541

Merged
merged 3 commits into from
Aug 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions autoinstallation/package/agama-auto.changes
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
-------------------------------------------------------------------
Thu Aug 15 08:35:31 UTC 2024 - Josef Reidinger <[email protected]>

- change agama-auto systemd service depedencies to reflect changes
in agama CLI communication and ensure that it runs when
agama-auto runs
(gh#openSUSE/agama#1539)

-------------------------------------------------------------------
Wed Jul 3 15:24:48 UTC 2024 - Imobach Gonzalez Sosa <[email protected]>

Expand Down
8 changes: 3 additions & 5 deletions autoinstallation/systemd/agama-auto.service
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
[Unit]
Description=Agama automatic profile runner
# it needs to D-Bus, so it has access to Agama D-Bus interface
After=dbus.socket
# it needs to NetworkManager, so it has access to it
After=NetworkManager.service
# it needs agama, of course
# it needs agama web service as it calls CLI which uses its API
# other dependencies are transitive
After=agama-web-server.service
BindsTo=agama-web-server.service

[Service]
ExecStart=/usr/bin/agama-auto
Expand Down
7 changes: 7 additions & 0 deletions rust/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions rust/agama-server/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ pam = "0.8.0"
serde_with = "3.6.1"
pin-project = "1.1.5"
openssl = "0.10.64"
sd-notify = "0.4.2"
hyper = "1.2.0"
hyper-util = "0.1.3"
tokio-openssl = "0.6.4"
Expand Down
6 changes: 6 additions & 0 deletions rust/agama-server/src/agama-web-server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,12 @@ async fn serve_command(args: ServeArgs) -> anyhow::Result<()> {
})
.collect();

// notify systemd that web server start serving
if let Ok(true) = sd_notify::booted() {
sd_notify::notify(true, &[sd_notify::NotifyState::Ready])
.context("Failed to notify systemd")?;
}

futures_util::future::join_all(servers).await;

Ok(())
Expand Down
9 changes: 9 additions & 0 deletions rust/package/agama.changes
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
-------------------------------------------------------------------
Thu Aug 15 08:33:02 UTC 2024 - Josef Reidinger <[email protected]>

- Use sd_notify for starting agama-web-service to notify systemd
when service is ready. It helps with race condition in agama-auto
(gh#openSUSE/agama#1539)
- improve systemd dependencies of agama-web-service to ensure that
agama service runs

-------------------------------------------------------------------
Fri Aug 9 08:50:31 UTC 2024 - Martin Vidner <[email protected]>

Expand Down
4 changes: 2 additions & 2 deletions rust/share/agama-web-server.service
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ Description=Agama Web Server
# agama-hostname might change the host name which is used when creating
# a self signed certificate, run it before the web server
After=network-online.target agama.service agama-hostname.service
PartOf=agama.service
BindsTo=agama.service

[Service]
Type=simple
Type=notify
ExecStart=/usr/bin/agama-web-server serve --address :::80 --address2 :::443
PIDFile=/run/agama/web.pid
User=root
Expand Down