mirror of
https://framagit.org/framasoft/framaspace/argos.git
synced 2025-04-28 18:02:41 +02:00
🔀 Merge remote-tracking branch 'origin/fix-36' into develop
This commit is contained in:
commit
2380c9be7d
8 changed files with 49 additions and 29 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -5,5 +5,6 @@ venv
|
||||||
.env
|
.env
|
||||||
public
|
public
|
||||||
*.swp
|
*.swp
|
||||||
|
argos-config.yaml
|
||||||
config.yaml
|
config.yaml
|
||||||
dist
|
dist
|
||||||
|
|
|
@ -8,6 +8,7 @@
|
||||||
- ✨ — Add command to generate example configuration (fix #38)
|
- ✨ — Add command to generate example configuration (fix #38)
|
||||||
- 📝 — Improve documentation
|
- 📝 — Improve documentation
|
||||||
- ✨ — Add command to warn if it’s been long since last viewing an agent (fix #49)
|
- ✨ — Add command to warn if it’s been long since last viewing an agent (fix #49)
|
||||||
|
- 💥 — Change default config file path to argos-config.yaml (fix #36)
|
||||||
|
|
||||||
## 0.1.1
|
## 0.1.1
|
||||||
|
|
||||||
|
|
|
@ -34,14 +34,22 @@ def coroutine(f):
|
||||||
|
|
||||||
|
|
||||||
def validate_config_access(ctx, param, value):
|
def validate_config_access(ctx, param, value):
|
||||||
path = Path(value)
|
for file in set(value, "argos-config.yaml", "/etc/argos/config.yaml"):
|
||||||
if path.is_file() and os.access(path, os.R_OK):
|
path = Path(file)
|
||||||
return value
|
|
||||||
|
|
||||||
if path.is_file():
|
if path.is_file() and os.access(path, os.R_OK):
|
||||||
raise click.BadParameter(f"the file {value} is not readabale.")
|
return file
|
||||||
|
|
||||||
raise click.BadParameter(f"the file {value} does not exists or is not reachable.")
|
if value == "argos-config.yaml":
|
||||||
|
raise click.BadParameter(
|
||||||
|
f"the file {value} does not exists or is not reachable, "
|
||||||
|
"nor does /etc/argos/config.yaml."
|
||||||
|
)
|
||||||
|
|
||||||
|
raise click.BadParameter(
|
||||||
|
f"the file {value} does not exists or is not reachable, "
|
||||||
|
"nor does argos-config.yaml or /etc/argos/config.yaml."
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
@click.group()
|
@click.group()
|
||||||
|
@ -102,9 +110,10 @@ def agent(server_url, auth, max_tasks, wait_time, log_level):
|
||||||
@click.option("--port", default=8000, type=int, help="Port to bind")
|
@click.option("--port", default=8000, type=int, help="Port to bind")
|
||||||
@click.option(
|
@click.option(
|
||||||
"--config",
|
"--config",
|
||||||
default="config.yaml",
|
default="argos-config.yaml",
|
||||||
help="Path of the configuration file. "
|
help="Path of the configuration file. "
|
||||||
"If ARGOS_YAML_FILE environment variable is set, its value will be used instead.",
|
"If ARGOS_YAML_FILE environment variable is set, its value will be used instead. "
|
||||||
|
"Default value: argos-config.yaml and /etc/argos/config.yaml as fallback.",
|
||||||
envvar="ARGOS_YAML_FILE",
|
envvar="ARGOS_YAML_FILE",
|
||||||
callback=validate_config_access,
|
callback=validate_config_access,
|
||||||
)
|
)
|
||||||
|
@ -150,9 +159,10 @@ def validate_max_results(ctx, param, value):
|
||||||
)
|
)
|
||||||
@click.option(
|
@click.option(
|
||||||
"--config",
|
"--config",
|
||||||
default="config.yaml",
|
default="argos-config.yaml",
|
||||||
help="Path of the configuration file. "
|
help="Path of the configuration file. "
|
||||||
"If ARGOS_YAML_FILE environment variable is set, its value will be used instead.",
|
"If ARGOS_YAML_FILE environment variable is set, its value will be used instead. "
|
||||||
|
"Default value: argos-config.yaml and /etc/argos/config.yaml as fallback.",
|
||||||
envvar="ARGOS_YAML_FILE",
|
envvar="ARGOS_YAML_FILE",
|
||||||
callback=validate_config_access,
|
callback=validate_config_access,
|
||||||
)
|
)
|
||||||
|
@ -216,9 +226,10 @@ async def watch_agents(time_without_agent, config):
|
||||||
@server.command(short_help="Load or reload tasks’ configuration")
|
@server.command(short_help="Load or reload tasks’ configuration")
|
||||||
@click.option(
|
@click.option(
|
||||||
"--config",
|
"--config",
|
||||||
default="config.yaml",
|
default="argos-config.yaml",
|
||||||
help="Path of the configuration file. "
|
help="Path of the configuration file. "
|
||||||
"If ARGOS_YAML_FILE environment variable is set, its value will be used instead.",
|
"If ARGOS_YAML_FILE environment variable is set, its value will be used instead. "
|
||||||
|
"Default value: argos-config.yaml and /etc/argos/config.yaml as fallback.",
|
||||||
envvar="ARGOS_YAML_FILE",
|
envvar="ARGOS_YAML_FILE",
|
||||||
callback=validate_config_access,
|
callback=validate_config_access,
|
||||||
)
|
)
|
||||||
|
@ -247,9 +258,10 @@ async def reload_config(config):
|
||||||
@server.command()
|
@server.command()
|
||||||
@click.option(
|
@click.option(
|
||||||
"--config",
|
"--config",
|
||||||
default="config.yaml",
|
default="argos-config.yaml",
|
||||||
help="Path of the configuration file. "
|
help="Path of the configuration file. "
|
||||||
"If ARGOS_YAML_FILE environment variable is set, its value will be used instead.",
|
"If ARGOS_YAML_FILE environment variable is set, its value will be used instead. "
|
||||||
|
"Default value: argos-config.yaml and /etc/argos/config.yaml as fallback.",
|
||||||
envvar="ARGOS_YAML_FILE",
|
envvar="ARGOS_YAML_FILE",
|
||||||
callback=validate_config_access,
|
callback=validate_config_access,
|
||||||
)
|
)
|
||||||
|
|
|
@ -23,11 +23,10 @@ class Settings(BaseSettings):
|
||||||
class DevSettings(Settings):
|
class DevSettings(Settings):
|
||||||
"""Settings for dev environment.
|
"""Settings for dev environment.
|
||||||
|
|
||||||
Uses config.yaml as config file.
|
Uses argos-config.yaml as config file.
|
||||||
Uses a SQLite database."""
|
Uses a SQLite database."""
|
||||||
|
|
||||||
app_env: str = "dev"
|
app_env: str = "dev"
|
||||||
yaml_file: str = "config.yaml"
|
|
||||||
db_pool_size: Optional[int] = None
|
db_pool_size: Optional[int] = None
|
||||||
db_max_overflow: Optional[int] = None
|
db_max_overflow: Optional[int] = None
|
||||||
database_url: str = "sqlite:////tmp/argos.db"
|
database_url: str = "sqlite:////tmp/argos.db"
|
||||||
|
|
|
@ -13,7 +13,7 @@ These checks are the most basic ones. They simply check that the response from t
|
||||||
|
|
||||||
```{code-block} yaml
|
```{code-block} yaml
|
||||||
---
|
---
|
||||||
caption: config.yaml
|
caption: argos-config.yaml
|
||||||
---
|
---
|
||||||
- domain: "https://example.org"
|
- domain: "https://example.org"
|
||||||
paths:
|
paths:
|
||||||
|
@ -30,7 +30,7 @@ caption: config.yaml
|
||||||
|
|
||||||
```{code-block} yaml
|
```{code-block} yaml
|
||||||
---
|
---
|
||||||
caption: config.yaml
|
caption: argos-config.yaml
|
||||||
---
|
---
|
||||||
ssl:
|
ssl:
|
||||||
thresholds:
|
thresholds:
|
||||||
|
@ -42,4 +42,4 @@ ssl:
|
||||||
- path: "/"
|
- path: "/"
|
||||||
checks:
|
checks:
|
||||||
- ssl-certificate-expiration: "on-check"
|
- ssl-certificate-expiration: "on-check"
|
||||||
```
|
```
|
||||||
|
|
13
docs/cli.md
13
docs/cli.md
|
@ -107,7 +107,9 @@ Options:
|
||||||
--host TEXT Host to bind
|
--host TEXT Host to bind
|
||||||
--port INTEGER Port to bind
|
--port INTEGER Port to bind
|
||||||
--config TEXT Path of the configuration file. If ARGOS_YAML_FILE environment
|
--config TEXT Path of the configuration file. If ARGOS_YAML_FILE environment
|
||||||
variable is set, its value will be used instead.
|
variable is set, its value will be used instead. Default
|
||||||
|
value: argos-config.yaml and /etc/argos/config.yaml as
|
||||||
|
fallback.
|
||||||
--reload Enable hot reloading
|
--reload Enable hot reloading
|
||||||
--help Show this message and exit.
|
--help Show this message and exit.
|
||||||
```
|
```
|
||||||
|
@ -129,7 +131,8 @@ Usage: argos server migrate [OPTIONS]
|
||||||
|
|
||||||
Options:
|
Options:
|
||||||
--config TEXT Path of the configuration file. If ARGOS_YAML_FILE environment
|
--config TEXT Path of the configuration file. If ARGOS_YAML_FILE environment
|
||||||
variable is set, its value will be used instead.
|
variable is set, its value will be used instead. Default value:
|
||||||
|
argos-config.yaml and /etc/argos/config.yaml as fallback.
|
||||||
--help Show this message and exit.
|
--help Show this message and exit.
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -158,7 +161,8 @@ Options:
|
||||||
checks have a timeout value of 60 seconds)
|
checks have a timeout value of 60 seconds)
|
||||||
--config TEXT Path of the configuration file. If ARGOS_YAML_FILE
|
--config TEXT Path of the configuration file. If ARGOS_YAML_FILE
|
||||||
environment variable is set, its value will be
|
environment variable is set, its value will be
|
||||||
used instead.
|
used instead. Default value: argos-config.yaml and
|
||||||
|
/etc/argos/config.yaml as fallback.
|
||||||
--help Show this message and exit.
|
--help Show this message and exit.
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -208,7 +212,8 @@ Usage: argos server reload-config [OPTIONS]
|
||||||
|
|
||||||
Options:
|
Options:
|
||||||
--config TEXT Path of the configuration file. If ARGOS_YAML_FILE environment
|
--config TEXT Path of the configuration file. If ARGOS_YAML_FILE environment
|
||||||
variable is set, its value will be used instead.
|
variable is set, its value will be used instead. Default value:
|
||||||
|
argos-config.yaml and /etc/argos/config.yaml as fallback.
|
||||||
--help Show this message and exit.
|
--help Show this message and exit.
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
@ -21,6 +21,8 @@ Here are the environment variables you can define to configure how the service w
|
||||||
|
|
||||||
The path to the yaml configuration file, defining the checks.
|
The path to the yaml configuration file, defining the checks.
|
||||||
|
|
||||||
|
If you do not provide the environment variable, Argos will try to read `argos-config.yaml` in the current directory, then `/etc/config/argos.yaml`.
|
||||||
|
|
||||||
#### ARGOS_DATABASE_URL
|
#### ARGOS_DATABASE_URL
|
||||||
|
|
||||||
The database url, as defined [in SQLAlchemy docs](https://docs.sqlalchemy.org/en/20/core/engines.html#database-urls).
|
The database url, as defined [in SQLAlchemy docs](https://docs.sqlalchemy.org/en/20/core/engines.html#database-urls).
|
||||||
|
@ -28,7 +30,7 @@ The database url, as defined [in SQLAlchemy docs](https://docs.sqlalchemy.org/en
|
||||||
For instance, to connect to a postgres database on localhost with user, pass and dbname "argos":
|
For instance, to connect to a postgres database on localhost with user, pass and dbname "argos":
|
||||||
|
|
||||||
```
|
```
|
||||||
ARGOS_DATABASE_URL = "postgresql://argos:argos@localhost/argos"
|
ARGOS_DATABASE_URL="postgresql://argos:argos@localhost/argos"
|
||||||
```
|
```
|
||||||
|
|
||||||
#### DB_POOL_SIZE
|
#### DB_POOL_SIZE
|
||||||
|
@ -37,8 +39,8 @@ ARGOS_DATABASE_URL = "postgresql://argos:argos@localhost/argos"
|
||||||
You configure the size of the database pool of connection, and the max overflow (until when new connections are accepted ?) These are documented [in the SQLAlchemy docs in greater details](https://docs.sqlalchemy.org/en/20/core/pooling.html#sqlalchemy.pool.QueuePool.params.pool_size)
|
You configure the size of the database pool of connection, and the max overflow (until when new connections are accepted ?) These are documented [in the SQLAlchemy docs in greater details](https://docs.sqlalchemy.org/en/20/core/pooling.html#sqlalchemy.pool.QueuePool.params.pool_size)
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
DB_POOL_SIZE = 10
|
DB_POOL_SIZE=10
|
||||||
DB_MAX_OVERFLOW = 20
|
DB_MAX_OVERFLOW=20
|
||||||
```
|
```
|
||||||
|
|
||||||
## Argos "checks" configuration
|
## Argos "checks" configuration
|
||||||
|
@ -50,7 +52,7 @@ Here is a simple configuration file:
|
||||||
|
|
||||||
```{literalinclude} ../conf/config-example.yaml
|
```{literalinclude} ../conf/config-example.yaml
|
||||||
---
|
---
|
||||||
caption: config.yaml
|
caption: argos-config.yaml
|
||||||
---
|
---
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
|
@ -42,7 +42,7 @@ pip install -e .
|
||||||
The quickest way to get started is to generate the configuration file from argos and edit it:
|
The quickest way to get started is to generate the configuration file from argos and edit it:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
argos server generate-config > config.yaml
|
argos server generate-config > argos-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).
|
||||||
|
|
Loading…
Reference in a new issue