Harden API uptime with systemd ownership guard and watchdog
This commit is contained in:
parent
ab6ad85db7
commit
b089dc1639
10 changed files with 93 additions and 7 deletions
|
|
@ -13,6 +13,7 @@ Install:
|
|||
```bash
|
||||
sudo apt update
|
||||
sudo apt install -y python3 nginx
|
||||
sudo useradd --system --create-home --shell /usr/sbin/nologin staysense || true
|
||||
```
|
||||
|
||||
## 2. Code bereitstellen
|
||||
|
|
@ -21,6 +22,9 @@ sudo apt install -y python3 nginx
|
|||
sudo mkdir -p /opt/staysense
|
||||
sudo chown -R $USER:$USER /opt/staysense
|
||||
git clone <REPO_URL> /opt/staysense
|
||||
sudo mkdir -p /opt/staysense/data
|
||||
sudo chown -R staysense:staysense /opt/staysense/data
|
||||
sudo chmod 2775 /opt/staysense/data
|
||||
```
|
||||
|
||||
## 3. Initialisierung
|
||||
|
|
@ -60,8 +64,11 @@ sudo systemctl status staysense-api.service
|
|||
```bash
|
||||
sudo cp /opt/staysense/deploy/systemd/staysense-import.service /etc/systemd/system/
|
||||
sudo cp /opt/staysense/deploy/systemd/staysense-import.timer /etc/systemd/system/
|
||||
sudo cp /opt/staysense/deploy/systemd/staysense-watchdog.service /etc/systemd/system/
|
||||
sudo cp /opt/staysense/deploy/systemd/staysense-watchdog.timer /etc/systemd/system/
|
||||
sudo systemctl daemon-reload
|
||||
sudo systemctl enable --now staysense-import.timer
|
||||
sudo systemctl enable --now staysense-watchdog.timer
|
||||
sudo systemctl list-timers | grep staysense
|
||||
```
|
||||
|
||||
|
|
@ -99,4 +106,5 @@ sudo certbot --nginx -d staysense.example.com
|
|||
curl -s http://127.0.0.1:8787/health
|
||||
sudo journalctl -u staysense-api.service -f
|
||||
sudo journalctl -u staysense-import.service -n 100
|
||||
sudo journalctl -u staysense-watchdog.service -n 50
|
||||
```
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue