Skip to content

Commit 6c6339f

Browse files
pluehnelarsxschneider
authored andcommitted
Switch updater to systemd system service (#72)
This makes the systemd system service a user service. There are two reasons that motivated this change. First, user services require an active session of the specified user. This has the drawback that the updater would not be triggered after reboots if no SSH connection to the GitHub Enterprise appliance was made. Second, user services cannot depend on system services. Because of that, the updater service could not reliably wait for the rest of GitHub Enterprise to start.
1 parent f16f3de commit 6c6339f

File tree

4 files changed

+17
-10
lines changed

4 files changed

+17
-10
lines changed

updater/README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,12 @@ The updater may be run in two modes:
3434
1. Create a config file in `/opt/autodesk/hubble-enterprise/config.py` (based on `[config.py.example](config.py.example)`).
3535
1. Enable and start the **periodic** updater process (persistently, survives reboots):
3636
```sh
37-
systemctl --user enable hubble-enterprise.timer
38-
systemctl --user start hubble-enterprise.timer
37+
sudo systemctl enable hubble-enterprise.timer
38+
sudo systemctl start hubble-enterprise.timer
3939
```
4040
1. Optionally, you may **trigger** the updater process (just once):
4141
```sh
42-
systemctl --user start hubble-enterprise.service
42+
sudo systemctl start hubble-enterprise.service
4343
```
4444

4545
#### Upgrading
@@ -54,14 +54,14 @@ The updater may be run in two modes:
5454
```
5555
1. If the `systemd` files (the service or timer file) have changed, let systemd adapt to the changes:
5656
```sh
57-
systemctl --user daemon-reexec
57+
sudo systemctl daemon-reexec
5858
```
5959

6060
#### Uninstallation
6161

6262
1. Disable the **periodic** updater process:
6363
```sh
64-
systemctl --user disable hubble-enterprise.timer
64+
sudo systemctl disable hubble-enterprise.timer
6565
```
6666
1. Remove the package:
6767
```sh
@@ -72,7 +72,7 @@ The updater may be run in two modes:
7272

7373
The updater’s log is accessible as follows:
7474
```sh
75-
journalctl -f --user-unit hubble-enterprise.service
75+
journalctl -fu hubble-enterprise.service
7676
```
7777

7878
#### Debian Packaging

updater/packaging/debian/templates/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ all: # nothing to build
22

33
PKGNAME = hubble-enterprise
44
INSTALLDIR = $(DESTDIR)/opt/autodesk/$(PKGNAME)
5-
SYSTEMDDIR = $(DESTDIR)/home/admin/.local/share/systemd/user
5+
SYSTEMDDIR = $(DESTDIR)/usr/lib/systemd/system
66
BASEDIR=../../../..
77

88
install:
Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
11
[Unit]
22
Description=Hubble Enterprise updater
3-
After=mysql.service
3+
Requires=github-enterprise.target
4+
After=github-enterprise.target
45

56
[Service]
67
Type=simple
78
ExecStart=/usr/bin/python3 /opt/autodesk/hubble-enterprise/update-stats.py
89
WorkingDirectory=/opt/autodesk/hubble-enterprise/
10+
User=admin
11+
Group=admin
12+
13+
[Install]
14+
WantedBy=github-enterprise.target
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
[Unit]
22
Description=Runs Hubble Enterprise updater periodically
3+
Requires=github-enterprise.target
4+
After=github-enterprise.target
35

46
[Timer]
57
OnCalendar=7:30
68
Persistent=true
7-
Unit=hubble-enterprise.service
89

910
[Install]
10-
WantedBy=default.target
11+
WantedBy=github-enterprise.target

0 commit comments

Comments
 (0)