Skip to content

whatifrussian/api

Repository files navigation

chtoes.li feedback API

Small Flask API used by the feedback form on chtoes.li. It validates reader submissions and creates issues in whatifrussian/website through an installed GitHub App using PyGithub.

Development

Python 3.12 is the supported runtime.

python -m venv .venv
. .venv/bin/activate
pip install -r requirements-dev.txt
pytest

Private GitHub App configuration belongs in shadow/config.json. The directory is ignored by Git. It overrides top-level values from app/config.json and must provide the complete github object:

{
  "github": {
    "integration_id": 123,
    "installation_id": 456,
    "secret_key_file": "shadow/github-app.private-key.pem"
  }
}

The private key path may be absolute or relative to the repository root. Set CHTOES_CONFIG to use a configuration file at another location.

Container

Build and test the image locally:

docker build -t chtoes-api .
docker run --rm -p 127.0.0.1:8000:8000 \
  -v "$PWD/shadow:/app/shadow:ro" chtoes-api
curl http://127.0.0.1:8000/healthz

compose.prod.yml runs the published GHCR image on 127.0.0.1:8090. It mounts the server's existing private configuration read-only, uses a read-only root filesystem, drops root, and enables automatic restart.

The nginx proxy snippet and production rollback notes live in deploy/.

Release

Pull requests and pushes to master run Python tests and build the image. Tags matching v* publish multi-architecture images to ghcr.io/whatifrussian/api with version and latest tags.

License

Public domain. See LICENSE.

About

Simple flask application for chtoes.li API

Resources

License

Stars

0 stars

Watchers

2 watching

Forks

Packages

 
 
 

Contributors