Merge branch 'almet/document-systemd' into 'main'

Put systemd configuration files in the docs.

Closes #3

See merge request framasoft/framaspace/argos!14
This commit is contained in:
Alexis Metaireau 2023-11-24 11:15:47 +00:00
commit e199b4932c
5 changed files with 71 additions and 2 deletions

View file

@ -0,0 +1,21 @@
[Unit]
Description=Argos agent
Documentation=https://framasoft.frama.io/framaspace/argos/
Requires=network.target
After=network.target
[Service]
User=www-data
Environment="ARGOS_AGENT_TOKEN=Secret"
Environment="ARGOS_AGENT_SERVER_URL=http://127.0.0.1:8000"
WorkingDirectory=/var/www/argos/
ExecStart=/var/www/argos/venv/bin/argos agent --max-tasks 20 --wait-time 10 --log-level DEBUG
SyslogIdentifier=argos-agent
[Install]
WantedBy=multi-user.target
# NB: it may be better to
# - use a dedicated user
# - use a EnvironmentFile=/etc/default/argos-agent in order enable configuration
# changes without doing a systemctl daemon-reload

View file

@ -0,0 +1,16 @@
[Unit]
Description=Argos server
Documentation=https://framasoft.frama.io/framaspace/argos/
Requires=network.target postgresql.service
After=network.target postgresql.service
PartOf=postgresql.service
[Service]
User=www-data
WorkingDirectory=/var/www/argos/
ExecStart=/var/www/argos/venv/bin/argos server start
ExecReload=/var/www/argos/venv/bin/argos server reload
SyslogIdentifier=argos-server
[Install]
WantedBy=multi-user.target

View file

@ -0,0 +1,25 @@
# Using systemd
Here are the systemd files that can be used to deploy the server and the agents.
## Agent
```{literalinclude} ../../conf/systemd-agent.service
---
caption: /etc/systemd/system/argos-agent.service
---
```
## Server
```{literalinclude} ../../conf/systemd-server.service
---
caption: /etc/systemd/system/argos-server.service
---
```
Please note that it might be better to use Gunicorn with a Uvicorn worker, [as specified in the Uvicorn docs](https://www.uvicorn.org/#running-with-gunicorn):
```bash
gunicorn example:app -w 4 -k uvicorn.workers.UvicornWorker
```

View file

@ -64,5 +64,12 @@ checks
developer/overview developer/overview
developer/new-check developer/new-check
developer/models developer/models
changelog
``` ```
```{toctree}
:caption: Deployment
:hidden:
deployment/systemd
```

View file

@ -23,7 +23,7 @@ The quickest way to get started is to copy the `config-example.yaml` file and ed
cp config-example.yaml config.yaml cp config-example.yaml config.yaml
``` ```
You can read more about the configuration in the [configuration section](configuration.md). You can read more about the configuration in the [configuration section](../configuration.md).
## Starting the server ## Starting the server