🔀 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

3
.gitignore vendored
View file

@ -5,4 +5,5 @@ venv
.env
public
*.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 argos import logging
from argos import VERSION
from argos.agent import ArgosAgent
@ -40,6 +41,11 @@ def server():
pass
@cli.command()
def version():
click.echo(VERSION)
@cli.command()
@click.argument("server_url", envvar="ARGOS_AGENT_SERVER_URL")
@click.argument("auth", envvar="ARGOS_AGENT_TOKEN")
@ -111,8 +117,11 @@ def validate_max_results(ctx, param, value):
@click.option(
"--max-lock-seconds",
default=100,
help="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)",
help=(
"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,
)
@coroutine

View file

@ -26,8 +26,9 @@ Options:
--help Show this message and exit.
Commands:
agent Get and run tasks to the provided server.
agent Get and run tasks to the provided server.
server
version
```
<!--[[[end]]]

View file

@ -5,11 +5,12 @@
# -- Project information -----------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information
import argos
project = "Argos"
copyright = "2023, Alexis Métaireau"
author = "Alexis Métaireau"
release = "0.0.1"
copyright = "2023, Alexis Métaireau, Framasoft"
author = "Alexis Métaireau, Framasoft"
release = argos.VERSION
# -- 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.
Here is a list of the useful variables, in the `.env` format:
```{literalinclude} ../.env.example
```{literalinclude} ../conf/.env.example
---
caption: .env
---
@ -34,21 +34,21 @@ ARGOS_DATABASE_URL = "postgresql://argos:argos@localhost/argos"
#### DB_POOL_SIZE
#### 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
DB_POOL_SIZE = 10
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.
Here is a simple configuration file:
```{literalinclude} ../config-example.yaml
```{literalinclude} ../conf/config-example.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:
```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:
```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:
```{literalinclude} ../../.env.example
```{literalinclude} ../../conf/.env.example
---
caption: .env
---

View file

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