Simple WebHook - Restart a Container using Webhooks
Find a file
andi-makes b36404d868
All checks were successful
ci/woodpecker/push/build Pipeline was successful
fixed hmac issue
how did that even ever work?
2023-09-20 11:49:10 +02:00
.woodpecker Looked at wrong docs, maybe now it works? 2022-11-26 09:06:14 +01:00
src fixed hmac issue 2023-09-20 11:49:10 +02:00
.dockerignore Docker fun and fix rust warning 2023-09-20 11:22:56 +02:00
.gitignore Initial Commit 2022-09-14 15:50:18 +02:00
Cargo.lock updated dependencies, added logging statement 2023-09-19 22:44:16 +02:00
Cargo.toml updated dependencies, added logging statement 2023-09-19 22:44:16 +02:00
Dockerfile Docker fun and fix rust warning 2023-09-20 11:22:56 +02:00
LICENSE Added License, updated Cargo.lock 2022-10-29 17:45:05 +02:00
README.md Bump version 2022-09-17 22:27:38 +02:00

swh - Simple Webhook

I needed a Service to restart a Docker Container when I push changes to a git repository. This tool does exactly that.

Usage:

Configure a Git Webhook to your needs. Enter a Secret in the Webhook GUI of your Git Forge and note it down. The webhook URL is http[s]://ip_or_url[:port]/.

You can either start the docker image using this command:

docker run -it -d -v /var/run/docker.sock:/var/run/docker.sock -e SWH_SECRET="YOUR_SECRET" -e SWH_CONTAINER_NAME="YOUR_CONTAINER_NAME" git.schmarrn.dev/andi/swh:latest

The service listens to port 3000. I recommend using a reverse proxy.

A docker compose file would look like this:

version: "3.8"
services:
  swh:
    image: git.schmarrn.dev/andi/swh:latest
    environment:
      SWH_SECRET: "YOUR_SECRET"
      SWH_CONTAINER_NAME: "YOUR_CONTAINER_NAME"
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock