From db1a26c46a69e319899ab41942d49d22ebdc8a68 Mon Sep 17 00:00:00 2001 From: Jake Nabasny Date: Sun, 7 Apr 2024 09:11:37 -0400 Subject: [PATCH] Update systemd config and docs --- README.md | 16 ++++++++-------- bureau.yaml.example | 2 +- main.go | 3 ++- systemd/bureau.service | 4 +++- systemd/bureau.timer | 13 ------------- 5 files changed, 14 insertions(+), 24 deletions(-) delete mode 100644 systemd/bureau.timer diff --git a/README.md b/README.md index 51fe218..aa99a04 100644 --- a/README.md +++ b/README.md @@ -23,13 +23,14 @@ override_hostname: **Location** The bureau configuration is looked for in these locations in order of precedence: +- same directory as the binary - ~/.bureau.yaml - ~/.config/bureau/bureau.yaml - /etc/bureau/bureau.yaml **Daemon Mode** -`daemon` mode will run the bureau binary as a service. Only use this mode if you are not using an init system like `systemd`. `update_interval` specifies the number of seconds between each LDAP search for new config files when running in daemon mode. (For systemd, update the bureau.timer unit file.) +`daemon` mode will run the bureau binary as a service. This mode is the default in order to benefit from bureau's in-memory tracking of LDAP changes, which will only pull entire entries if they have a more recent `modifyTimestamp` than the previous time it was checked. It is recommended to use daemon mode in addition to the systemd service. `update_interval` specifies the number of seconds between each LDAP search for new config files. **Host Specific Entries** @@ -64,18 +65,16 @@ EOF 4. Start bureau in daemon mode or with systemd: ``` ./bureau & # daemon -systemctl enable --now bureau.timer # systemd +systemctl enable --now bureau.service # systemd ``` -Systemd will generate files owned by `root:root`. If you want to use bureau for user files, you can copy the systemd unit files to the user-specific directory: +Systemd will generate files owned by `root:root`. If you want to use bureau for user files, you can copy the systemd unit file to the user-specific directory: ``` -cp /etc/systemd/system/bureau.* ~/.config/systemd/user/ +cp /etc/systemd/system/bureau.service ~/.config/systemd/user/ systemctl --user daemon-reload -systemctl --user --now bureau.timer bureau.service +systemctl enable --user --now bureau.service ``` -The `bureau.timer` unit file runs every 5 minutes by default. - 5. The new file should be available instantly: ``` $ cat /tmp/bureau-test.txt @@ -91,8 +90,9 @@ Hello World! - keepalivedVRRPInstanceConfig # v1.0 Roadmap -- [ ] Additional schemas (ssh, systemd, sssd) +- [ ] Additional schemas - [ ] Kubernetes (configMap) support +- [ ] LXD instance config support - [ ] Secrets management Raise an issue to request any other services you want to see supported. diff --git a/bureau.yaml.example b/bureau.yaml.example index 9541f93..c201d0d 100644 --- a/bureau.yaml.example +++ b/bureau.yaml.example @@ -1,4 +1,4 @@ -debug: true +debug: false daemon: true update_interval: 600 restart_service_on_change: true diff --git a/main.go b/main.go index 0292877..1837145 100644 --- a/main.go +++ b/main.go @@ -282,7 +282,8 @@ func findConfig() ([]byte, error) { var conf string home, err := os.UserHomeDir() - locations := []string{home + "/.bureau.yaml", + locations := []string{"bureau.yaml", + home + "/.bureau.yaml", home + "/.config/bureau/bureau.yaml", "/etc/bureau/bureau.yaml"} diff --git a/systemd/bureau.service b/systemd/bureau.service index b612a4f..59c4c9d 100644 --- a/systemd/bureau.service +++ b/systemd/bureau.service @@ -3,7 +3,9 @@ Description=bureau configuration agent After=network.target [Service] -Type=oneshot +Type=simple +Restart=always +RestartSec=1 ExecStart=/usr/bin/bureau [Install] diff --git a/systemd/bureau.timer b/systemd/bureau.timer deleted file mode 100644 index 5f11860..0000000 --- a/systemd/bureau.timer +++ /dev/null @@ -1,13 +0,0 @@ -[Unit] -Description=bureau timer -RefuseManualStart=no -RefuseManualStop=no - -[Timer] -Persistent=true -OnBootSec=120 -OnUnitActiveSec=600 -Unit=bureau.service - -[Install] -WantedBy=timers.target