{"id":17209321,"url":"https://github.com/de-vri-es/webhook-httpd","last_synced_at":"2025-04-13T22:31:17.319Z","repository":{"id":37083976,"uuid":"321782582","full_name":"de-vri-es/webhook-httpd","owner":"de-vri-es","description":"simple HTTP(S) server for receiving webhooks and running commands","archived":false,"fork":false,"pushed_at":"2025-02-04T09:49:19.000Z","size":195,"stargazers_count":13,"open_issues_count":1,"forks_count":5,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-27T12:52:32.778Z","etag":null,"topics":["continuous-integration","hacktoberfest","http-server","webhooks"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/de-vri-es.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-12-15T20:34:19.000Z","updated_at":"2025-02-04T09:49:19.000Z","dependencies_parsed_at":"2024-10-15T02:51:21.407Z","dependency_job_id":null,"html_url":"https://github.com/de-vri-es/webhook-httpd","commit_stats":{"total_commits":46,"total_committers":2,"mean_commits":23.0,"dds":"0.13043478260869568","last_synced_commit":"d1f1e14d6aed2512b90ee578903af885a6209696"},"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/de-vri-es%2Fwebhook-httpd","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/de-vri-es%2Fwebhook-httpd/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/de-vri-es%2Fwebhook-httpd/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/de-vri-es%2Fwebhook-httpd/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/de-vri-es","download_url":"https://codeload.github.com/de-vri-es/webhook-httpd/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248231702,"owners_count":21069379,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["continuous-integration","hacktoberfest","http-server","webhooks"],"created_at":"2024-10-15T02:51:18.784Z","updated_at":"2025-04-13T22:31:17.054Z","avatar_url":"https://github.com/de-vri-es.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# webhook-httpd [![tests](https://github.com/de-vri-es/webhook-httpd/workflows/tests/badge.svg)](https://github.com/de-vri-es/webhook-httpd/actions?query=workflow%3Atests)\n\n`webhook-httpd` is a simple HTTP(S) server to receive webhooks, written in Rust.\n\nFeatures:\n * Run commands on POST requests based on the request URL.\n * Optionally verify the `X-Hub-Signature-256` header.\n * Optionally limit job concurrency per hook.\n * Supports TLS with OpenSSL.\n\nHooks are configured as a sequence of commands to execute when a POST request is made for a certain URL.\nA hook can run an arbitrary number of commands, and you can configure any number of hooks for different URLs.\nFor each command run by a hook, you can configure if it should receive the request body on standard input.\n\n## Scheduling\nThe server supports limiting the number of concurrently running jobs per hook.\nWhen the concurrency limit is reached, jobs can be put in a first-in-first-out or last-in-first out queue.\nEach hook can have a different concurrency limit, queue type and maximum queue size.\n\nBy default, a hook will run only one job concurrently, and will queue at most one job in a LIFO queue (meaning older jobs are dropped when the queue is full).\nThis is a good configuration for hooks that just want to update things based on the latest request,\nbut all parameters can be changed individually per hook.\n\n## Command environment\nEach command is executed with some environment variables set.\nThe variables provide some information about the HTTP request that was made:\n* `URL_PATH`: The path portion of the request URL.\n* `URL_QUERY`: The query portion of the request URL.\n* `REMOTE_ADDR`: The IP address of the remote peer.\n* `REMOTE_PORT`: The port number of the remote peer.\n\nYou can also configure a command to receive the request body on its standard input.\nIn that case, some additional environment variables are set:\n* `CONTENT_TYPE`: The value of the `Content-Type` header.\n* `CONTENT_LENGTH`: The size of the request body in bytes.\n\n## Example configuration\nA small configuration is shown below.\nFor a more detailed example with comments, see [`example-config.yaml`](example-config.yaml) or run `webhook-httpd --print-example-config`.\n\n```yaml\nport: 8091\ntls:\n  private-key: /etc/letsencrypt/live/example.com/privkey.pem\n  certificate-chain: /etc/letsencrypt/live/example.com/fullchain.pem\n\nhooks:\n  - url: \"/make-release-tarball\"\n    commands:\n      - cmd: [\"make-release-tarball\"]\n        stdin: request-body\n    working-dir: \"/path/to/repository/\"\n    max-concurrent: 1\n    queue-size: unlimited\n    queue-type: fifo\n    secret: \"some-randomly-generated-secret\"\n\n  - url: \"/update-daemon-config\"\n    commands:\n      - cmd: [\"git\", \"fetch\"]\n      - cmd: [\"git\", \"reset\", \"--hard\", \"origin/main\"]\n      - cmd: [\"systemctl\", \"reload\", \"my-little-service\"]\n    working-dir: \"/etc/my-little-service/\"\n    secret: \"some-randomly-generated-secret\"\n```\n\n## Features\nThe crate has one optional feature: `static-openssl`.\nWhen the feature is enabled, `openssl` is linked statically against a locally compiled OpenSSL.\nThis can be used to create a binary with a minimal set of runtime dependencies,\nand it can make compilation easier on systems with no recent version of OpenSSL readily available.\n\nFor more information on how to build with a locally installed version of OpenSSL see:\nhttps://docs.rs/openssl/latest/openssl/#building\n\n## Examples\nThe `multipart-stdin` example shows how to process `multipart/form-data` from stdin and how to pass additional environment variables to your hooks from the config file.\n\nBuild the example\n```sh\n cargo build --example multipart-stdin --features static-openssl\n```\n\nAdd the hook:\n```yaml:\n  - url: \"/multipart-stdin\"\n    commands:\n      - cmd: [\"\"target/debug/examples/multipart-stdin\"]\n        stdin: request-body\n    environment:\n        OUTPUT_FOLDER: uploads\n        PREFIX_TIMESTAMP: 1\n```\n\nRun the server:\n```sh\ncargo run --features static-openssl -- --config example-config.yaml\n```\n\nYou can test the endpoint using `curl` with the `-F` option:\n```sh\ncurl -X POST -F \"key1=value1\" -F \"key2=value2\" -F \"file=@Cargo.toml\"   http://localhost:8091/multipart-stdin\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fde-vri-es%2Fwebhook-httpd","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fde-vri-es%2Fwebhook-httpd","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fde-vri-es%2Fwebhook-httpd/lists"}