🔀 Merge branch 'almet/document-release' into 'fix-11'

Document the release process

See merge request framasoft/framaspace/argos!42
This commit is contained in:
Luc Didry 2024-04-08 06:39:00 +00:00
commit 9af28a511d
12 changed files with 131 additions and 23 deletions

1
.gitignore vendored
View file

@ -6,3 +6,4 @@ venv
public public
*.swp *.swp
config.yaml config.yaml
dist

View file

@ -0,0 +1 @@
VERSION = "0.1.0"

View file

@ -9,6 +9,7 @@ from alembic import command
from alembic.config import Config from alembic.config import Config
from argos import logging from argos import logging
from argos import VERSION
from argos.agent import ArgosAgent from argos.agent import ArgosAgent
@ -40,6 +41,11 @@ def server():
pass pass
@cli.command()
def version():
click.echo(VERSION)
@cli.command() @cli.command()
@click.argument("server_url", envvar="ARGOS_AGENT_SERVER_URL") @click.argument("server_url", envvar="ARGOS_AGENT_SERVER_URL")
@click.argument("auth", envvar="ARGOS_AGENT_TOKEN") @click.argument("auth", envvar="ARGOS_AGENT_TOKEN")
@ -111,8 +117,11 @@ def validate_max_results(ctx, param, value):
@click.option( @click.option(
"--max-lock-seconds", "--max-lock-seconds",
default=100, default=100,
help="The number of seconds after which a lock is considered stale, must be higher than 60 " help=(
"(the checks have a timeout value of 60 seconds)", "The number of seconds after which a lock is "
"considered stale, must be higher than 60 "
"(the checks have a timeout value of 60 seconds)"
),
callback=validate_max_lock_seconds, callback=validate_max_lock_seconds,
) )
@coroutine @coroutine

View file

@ -28,6 +28,7 @@ Options:
Commands: Commands:
agent Get and run tasks to the provided server. agent Get and run tasks to the provided server.
server server
version
``` ```
<!--[[[end]]] <!--[[[end]]]

View file

@ -5,11 +5,12 @@
# -- Project information ----------------------------------------------------- # -- Project information -----------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information # https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information
import argos
project = "Argos" project = "Argos"
copyright = "2023, Alexis Métaireau" copyright = "2023, Alexis Métaireau, Framasoft"
author = "Alexis Métaireau" author = "Alexis Métaireau, Framasoft"
release = "0.0.1" release = argos.VERSION
# -- General configuration --------------------------------------------------- # -- General configuration ---------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration # https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration

View file

@ -7,7 +7,7 @@ There are actually two configuration files: one for the service and one for the
The server configuration is done using environment variables. You can put them in a `.env` file at the root of the project. The server configuration is done using environment variables. You can put them in a `.env` file at the root of the project.
Here is a list of the useful variables, in the `.env` format: Here is a list of the useful variables, in the `.env` format:
```{literalinclude} ../.env.example ```{literalinclude} ../conf/.env.example
--- ---
caption: .env caption: .env
--- ---
@ -34,21 +34,21 @@ ARGOS_DATABASE_URL = "postgresql://argos:argos@localhost/argos"
#### DB_POOL_SIZE #### DB_POOL_SIZE
#### DB_MAX_OVERFLOW #### DB_MAX_OVERFLOW
These two help you configure the size of the pool, and the max overflow (until when do we accept a new connection ?) 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
``` ```
## Checks configuration ## Argos "checks" configuration
Argos uses a YAML configuration file to define the websites to monitor and the checks to run on these websites. Argos uses a YAML configuration file to define the websites to monitor and the checks to run on these websites.
Here is a simple configuration file: Here is a simple configuration file:
```{literalinclude} ../config-example.yaml ```{literalinclude} ../conf/config-example.yaml
--- ---
caption: config.yaml caption: config.yaml
--- ---

82
docs/developer/release.md Normal file
View file

@ -0,0 +1,82 @@
# Releasing guide
Once in a while, we release this package. Here is how.
## Pre-requesites
You need to be in a working environment, with the dev dependencies installed. You can check it's the case by typing:
```bash
pip install -e ".[dev]"
```
You'll need to get an account on [PyPI](https://pypi.org), where the packages will be uploaded.
## The steps
Here is the quick version. If you need more details, some parts are explained in more details in the next sections.
```bash
# Ensure the tests run correctly
make test
# Bump the version, according to semantic versionning
hatch version minor # or `hatch version major`
# Create a tag on the git repository and push it
git tag "$(hatch version)" && git push
# Build the project
hatch build --clean
# Upload the project to PyPI
hatch publish
```
Aditionnaly, ensure it works well in a new environment.
## Bumping the version number
We follow semantic versionning conventions, and the version is specified in the `argos.__init__.py` file.
`hatch` provide commands to help with this:
```bash
hatch version minor
hatch version major
```
## Publishing
`hatch` will ask you for some credentials. Don't provide them the full credentials to you account, but instead you can [create a (scoped) token](https://pypi.org/manage/account/token/).
When asked for credentials, enter:
- `__token__` as the login
- the token as the value.
## Verifying it worked
Once published, you can test it works properly, by using pip, ideally in a new venv. Here's how:
```bash
python -m venv /tmp/argos
source /tmp/argos/bin/activate
pip install argos-monitoring
argos version # should output the proper version
```
## Using the test server
When running `hatch publish` the main PyPI instance will be used, which is not ideal for testing that it's doing what you want.
If you're still experimenting, you can use the [Test PyPI](https://test.pypi.org) server.
```bash
# Publishing on test PyPI
hatch build -r test
# Installing from test PyPI
pip install --index-url https://test.pypi.org/simple/ argos-monitoring
```

View file

@ -48,14 +48,14 @@ pip install -e .
The quickest way to get started is to copy the `config-example.yaml` file and edit it: The quickest way to get started is to copy the `config-example.yaml` file and edit it:
```bash ```bash
cp config-example.yaml config.yaml cp conf/config-example.yaml config.yaml
``` ```
<!-- <!--
The quickest way to get started is to get the `config-example.yaml` file from our repository and edit it: The quickest way to get started is to get the `config-example.yaml` file from our repository and edit it:
```bash ```bash
wget https://framagit.org/framasoft/framaspace/argos/-/raw/main/config-example.yaml -O config.yaml wget https://framagit.org/framasoft/framaspace/argos/-/raw/main/conf/config-example.yaml -O config.yaml
``` ```
--> -->
@ -65,7 +65,7 @@ You can read more about the configuration in the [configuration section](../conf
Environment variables are used to configure the server. You can also put them in an `.env` file: Environment variables are used to configure the server. You can also put them in an `.env` file:
```{literalinclude} ../../.env.example ```{literalinclude} ../../conf/.env.example
--- ---
caption: .env caption: .env
--- ---

View file

@ -1,10 +1,10 @@
[build-system] [build-system]
requires = ["setuptools", "setuptools-scm"] requires = ["hatchling"]
build-backend = "setuptools.build_meta" build-backend = "hatchling.build"
[project] [project]
name = "argos-monitoring" name = "argos-monitoring"
version = "0.1.0" dynamic = ["version"]
description = "Distributed supervision tool for HTTP." description = "Distributed supervision tool for HTTP."
authors = [ authors = [
{ name = "Alexis Métaireau", email = "alexis@notmyidea.org" }, { name = "Alexis Métaireau", email = "alexis@notmyidea.org" },
@ -13,9 +13,11 @@ authors = [
readme = "README.md" readme = "README.md"
classifiers = [ classifiers = [
"Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Topic :: Internet :: WWW/HTTP", "Topic :: Internet :: WWW/HTTP",
"Topic :: Internet :: WWW/HTTP :: WSGI :: Application", "Topic :: Internet :: WWW/HTTP :: WSGI :: Application",
"License :: OSI Approved :: GNU Affero General Public License v3 or later (AGPLv3+)", "License :: OSI Approved :: GNU Affero General Public License v3 or later (AGPLv3+)",
"Intended Audience :: System Administrators",
] ]
dependencies = [ dependencies = [
@ -49,7 +51,7 @@ dev = [
"respx>=0.20,<1", "respx>=0.20,<1",
"ruff==0.1.5,<1", "ruff==0.1.5,<1",
"sphinx-autobuild", "sphinx-autobuild",
"build>=1.2.1" "hatch==1.9.4",
] ]
docs = [ docs = [
"cogapp", "cogapp",
@ -66,9 +68,20 @@ repository = "https://framagit.org/framasoft/framaspace/argos"
"Funding" = "https://framasoft.org/en/#support" "Funding" = "https://framasoft.org/en/#support"
"Tracker" = "https://framagit.org/framasoft/framaspace/argos/-/issues" "Tracker" = "https://framagit.org/framasoft/framaspace/argos/-/issues"
[tool.setuptools] [tool.hatch.build.targets.sdist]
include = [
"/argos",
"/docs",
"/tests",
]
[tool.hatch.build.targets.wheel]
packages = ["argos"] packages = ["argos"]
[tool.hatch.version]
path = "argos/__init__.py"
[project.scripts] [project.scripts]
argos = "argos.commands:cli" argos = "argos.commands:cli"