Simple webhook service to update and deploy sites and do other maintenance and automatic tasks
Project description
webhaak is a simple webhook service to update and deploy sites and do other maintenance without having to ssh to a node.
webhaak supports git push hooks from GitHub, BitBucket, gitea, and gogs; for these it can automatically update checkouts. It also recognises Sentry notifications, and of course regular calls.
Installation
From PyPI
Assuming you already are inside a virtualenv:
pip install webhaak
From Git
Create a new virtualenv (if you are not already in one) and install the necessary packages:
git clone https://github.com/aquatix/webhaak.git
cd webhaak
mkvirtualenv webhaak # or whatever project you are working on
pip install -r requirements.txt
Usage
Copy example.yaml from example_config to a directory you will use for configuration and configure to your needs. This is a yaml file with the projects to serve (see next section).
Run webhaak as a service under nginx or apache and call the appropriate url’s when wanted (e.g., on push to repository).
webhaak can also be run from the command line: uvicorn webhaak:app --reload
Be sure to export/set the SECRETKEY environment variable before running, it’s needed for some management URI’s.
Run gunicorn -k uvicorn.workers.UvicornWorker for production. For an example of how to set up a server see this article with configuration for nginx, uvicorn, systemd, security and such.
The RQ background worker can be run from the command line: rq worker --with-scheduler
Url’s are of the form https://hook.example.com/app/<appkey>/<triggerkey>
API documentation is auto-generated, and can be browsed at https://hook.example.com/docs
Example configuration
See the example hook settings for syntax of how to configure repositories, commands and directories.
Call webhaak on its endpoint /admin/SECRETKEY/get_app_key to generate a random new key for usage in the projects yaml file (so, for example https://hook.example.com/admin/abc123/get_app_key)
By default, webhaak clones projects in a directory under its REPOS_CACHE_DIR directory, but there is support for a per-repo parent dir settings with repoparent in the yaml.
This means that webhaak then doesn’t clone this repo into its default cache dir, but in a subdirectory of the directory configured in repoparent, so <repoparent>/reponame (e.g., /srv/customparent/myproject).
Server configuration
supervisord RQ worker which uses the RQ config
systemd for webhaak API which uses the gunicorn config
What’s new?
See the Changelog.
Developing
Running in PyCharm: tbd :)
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file webhaak-0.5.2.tar.gz
.
File metadata
- Download URL: webhaak-0.5.2.tar.gz
- Upload date:
- Size: 35.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | de37eb41a9d601c4b9fab04c8477b745ecfe2dc6b07583ba6c38968afa504b3d |
|
MD5 | 1f3d4165b9dd8872910b1e31f718e16e |
|
BLAKE2b-256 | c8c1dfbcb6340fef0e62e54cb6a002cc875d99444df6a2a9ebf3bba5105bdc24 |
Provenance
File details
Details for the file webhaak-0.5.2-py3-none-any.whl
.
File metadata
- Download URL: webhaak-0.5.2-py3-none-any.whl
- Upload date:
- Size: 18.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 82a9dcaf3bb140c583a53fb0168982d5c6996e5dcf5c714fff0328f196e69974 |
|
MD5 | a936358f75fd5dbbc17ba7cb22950de1 |
|
BLAKE2b-256 | c4aeb398b33b0f9f763b83a31609e0173a34f9386472b38e7f9cd1e1c98c8784 |