Skip to content

Commit

Permalink
SystemD doc moved to /docs
Browse files Browse the repository at this point in the history
  • Loading branch information
MdreW committed Sep 20, 2024
1 parent 8d28b2d commit 120cc4b
Show file tree
Hide file tree
Showing 4 changed files with 78 additions and 56 deletions.
78 changes: 78 additions & 0 deletions docs/systemd.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
## Start a local Satosa-saml2spid istance with a SystemD Service

In this example is provided with this assumption:
* Satosa-saml2spid is installed in `/opt/satosa`
* Satosa-saml2spid is executed from a Python VirtualENV sited in `/opt/satosa/env`
* Satosa-saml2spid is executed from `satosa` user

Create a new SystemD service with the command:
```
sudo systemctl edit --force --full satosa.service
```

copy and personalize this service example:
```
Description=UWSGI server for Satosa Proxy
## Socket
# After=syslog.target
# Requires=satosa.sock
## Network
Requires=network.target
After=network.target
[Service]
# Foreground process
Type=simple
# Preferably configure a non-privileged user
User=satosa
Group=satosa
WorkingDirectory=/opt/satosa
ExecStart=/bin/bash -c 'cd /opt/satosa && source env/bin/activate && uwsgi --ini ./uwsgi_setup/uwsgi.ini --thunder-lock'
Restart=always
KillSignal=SIGQUIT
## socket
# [Install]
# WantedBy=sockets.target
```
Enable the service:
```
sudo systemctl enable satosa.service
```

### Satosa with socket
If you want enable Satosa-saml2spid by socket you should edit the service:
```
sudo systemctl edit --full satosa.service
```
uncomment follow line:
* `After=syslog.target`
* `Requires=satosa.sock`
* `[Install]`
* `WantedBy=sockets.target`

create the socket target:
```
sudo systemctl edit --full --force satosa.sockets
```

Copy and personalize this socket example:
```
[Unit]
Description=Socket for satosa
[Socket]
# Change this to your uwsgi application port or unix socket location
ListenStream=/opt/satosa//tmp/sockets/satosa.sock
SocketMode=0770
[Install]
WantedBy=sockets.target
```

enable il socket:
```
sudo systectl enable satosa.socket
```
22 changes: 0 additions & 22 deletions example/uwsgi_setup/SystemD/README.md

This file was deleted.

24 changes: 0 additions & 24 deletions example/uwsgi_setup/SystemD/satosa.service

This file was deleted.

10 changes: 0 additions & 10 deletions example/uwsgi_setup/SystemD/satosa.socket

This file was deleted.

0 comments on commit 120cc4b

Please sign in to comment.