From 01ffcc2d28192cd1d1c47515f708dd7ec1b6b49b Mon Sep 17 00:00:00 2001 From: Luc Didry Date: Mon, 27 May 2024 08:44:43 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=93=9D=20=E2=80=94=20TL;DR=20documentatio?= =?UTF-8?q?n=20(fix=20#43=20and=20#52)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 1 + conf/default-argos-agent | 5 + conf/default-argos-server | 6 ++ conf/systemd-agent.service | 16 ++- conf/systemd-server.service | 23 ++-- docs/cli.md | 11 +- docs/deployment/systemd.md | 12 +++ docs/faq.md | 2 +- docs/index.md | 1 + docs/installation/getting-started.md | 2 + docs/installation/tl-dr.md | 155 +++++++++++++++++++++++++++ 11 files changed, 206 insertions(+), 28 deletions(-) create mode 100644 conf/default-argos-agent create mode 100644 conf/default-argos-server create mode 100644 docs/installation/tl-dr.md diff --git a/CHANGELOG.md b/CHANGELOG.md index 6db89ab..602fa74 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ - 🔊 — Add level of log before the log message — 🔊 — Add a warning messages in the logs if there is no tasks in database. (fix #41) - ✨ — Add command to generate example configuration (fix #38) +- 📝 — Improve documentation ## 0.1.1 diff --git a/conf/default-argos-agent b/conf/default-argos-agent new file mode 100644 index 0000000..dcd5af7 --- /dev/null +++ b/conf/default-argos-agent @@ -0,0 +1,5 @@ +ARGOS_AGENT_TOKEN=Secret +ARGOS_AGENT_SERVER_URL=http://127.0.0.1:8000 +ARGOS_AGENT_LOGLEVEL=WARNING +ARGOS_AGENT_MAX_TASKS=20 +ARGOS_AGENT_WAIT_TIME=10 diff --git a/conf/default-argos-server b/conf/default-argos-server new file mode 100644 index 0000000..6411fc6 --- /dev/null +++ b/conf/default-argos-server @@ -0,0 +1,6 @@ +ARGOS_YAML_FILE="/etc/argos/config.yaml" +ARGOS_DATABASE_URL="postgresql://argos:THE_DB_PASSWORD@localhost/argos" +ARGOS_SERVER_WORKERS=4 +ARGOS_SERVER_SOCKET=127.0.0.1:8000 +# Comma separated list of IP addresses of the web proxy (usually Nginx) +ARGOS_SERVER_FORWARDED_ALLOW_IPS=127.0.0.1 diff --git a/conf/systemd-agent.service b/conf/systemd-agent.service index 93e7e9f..9050e9a 100644 --- a/conf/systemd-agent.service +++ b/conf/systemd-agent.service @@ -5,17 +5,13 @@ 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 +User=argos +EnvironmentFile=/etc/default/argos-agent +WorkingDirectory=/opt/argos/ +ExecStart=/opt/argos/venv/bin/argos agent --max-tasks $ARGOS_AGENT_MAX_TASKS \ + --wait-time $ARGOS_AGENT_WAIT_TIME \ + --log-level $ARGOS_AGENT_LOGLEVEL 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 to enable configuration -# changes without doing a systemctl daemon-reload diff --git a/conf/systemd-server.service b/conf/systemd-server.service index 9326b39..b0c4fe4 100644 --- a/conf/systemd-server.service +++ b/conf/systemd-server.service @@ -6,19 +6,18 @@ After=network.target postgresql.service PartOf=postgresql.service [Service] -User=www-data -WorkingDirectory=/var/www/argos/ -Environment="ARGOS_SERVER_WORKERS=4" -Environment="ARGOS_SERVER_SOCKET=127.0.0.1:8000" -ExecStartPre=/var/www/argos/venv/bin/argos server migrate -ExecStartPre=/var/www/argos/venv/bin/argos server reload-config -ExecStart=/var/www/argos/venv/bin/gunicorn "argos.server.main:get_application()" -w $ARGOS_SERVER_WORKERS -k uvicorn.workers.UvicornWorker -b $ARGOS_SERVER_SOCKET -ExecReload=/var/www/argos/venv/bin/argos server reload +User=argos +WorkingDirectory=/opt/argos/ +EnvironmentFile=/etc/default/argos-server +ExecStartPre=/opt/argos/venv/bin/argos server migrate +ExecStartPre=/opt/argos/venv/bin/argos server reload-config +ExecStart=/opt/argos/venv/bin/gunicorn "argos.server.main:get_application()" \ + --workers $ARGOS_SERVER_WORKERS \ + --worker-class uvicorn.workers.UvicornWorker \ + --bind $ARGOS_SERVER_SOCKET \ + --forwarded-allow-ips $ARGOS_SERVER_FORWARDED_ALLOW_IPS +ExecReload=/opt/argos/venv/bin/argos server reload-config SyslogIdentifier=argos-server [Install] WantedBy=multi-user.target - -# NB: it may be better to -# - use a EnvironmentFile=/etc/default/argos-server in order to enable configuration -# changes without doing a systemctl daemon-reload diff --git a/docs/cli.md b/docs/cli.md index be7b0ec..16057bc 100644 --- a/docs/cli.md +++ b/docs/cli.md @@ -77,11 +77,12 @@ Options: --help Show this message and exit. Commands: - cleandb Clean the database (to run routinely) - generate-token Generate a token for agents - migrate Run database migrations - reload-config Load or reload tasks’ configuration - start Starts the server (use only for testing or development!) + cleandb Clean the database (to run routinely) + generate-config Output an example config file. + generate-token Generate a token for agents + migrate Run database migrations + reload-config Load or reload tasks’ configuration + start Starts the server (use only for testing or development!) ```