webhook¶
webhook is a lightweight incoming webhook server to run shell commands. It is used to trigger scripts automatically, for example, to update the reprepro repository when a new package is available.
Installation¶
The webhook binary can be downloaded directly from the project's GitHub releases.
Install
Config¶
webhook is configured using a hooks.yaml file that defines the webhooks and the commands they execute. It is typically run as a systemd service to ensure it's always available.
Service¶
/etc/systemd/system/webhook.service
Enable service
Hooks¶
The hooks file defines the endpoints and the commands to be executed. This example shows a hook that triggers the reprepro update script.
Usage¶
Trigger¶
To trigger a hook, send an HTTP request to the webhook URL from any machine on your network.
Trigger hook
Logs¶
Logs for the webhook service and the scripts it executes are available through journalctl. It's helpful to distinguish between the logs from the webhook server itself and the output from the scripts it triggers.
Webhook Service Logs¶
These logs show the activity of the webhook server, such as incoming HTTP requests and hook matching. They are useful for debugging triggering issues.
Script Execution Logs¶
Thanks to the logger command in the hook configuration, the output of the update-reprepro-service.sh script is sent to the journal with a specific tag.
Task List¶
task: Available tasks for this project:
* create-template: Create template from existing .env file
* decrypt: Decrypt sensitive configuration files using SOPS.
* default: List all available tasks.
* enable: Enable the application's systemd service.
* encrypt: Encrypt sensitive configuration files using SOPS.
* export: Export the task list to `task-list.txt`.
* follow: Follow the logs
* init: Initialize the application's environment and configuration files.
* install-service: Install the application's systemd service.
* mklinks: Create symbolic links for configuration files.
* reload: Reload the application's systemd service.
* restart: Restart the application's systemd service.
* start: Start the application's systemd service.
* status: Check the status of the application's systemd service.
* stop: Stop the application's systemd service.
* update: Update the application or its running containers.
* upgrade: Upgrade the application by pulling the latest changes and updating.
* watch: Watch the logs