{"id":26190155,"url":"https://github.com/zazuko/swarm-webhook","last_synced_at":"2026-04-16T17:36:28.585Z","repository":{"id":74818018,"uuid":"381129326","full_name":"zazuko/swarm-webhook","owner":"zazuko","description":"Run a Docker Swarm service by calling a webhook","archived":false,"fork":false,"pushed_at":"2022-12-12T18:52:49.000Z","size":672,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-10-09T09:11:29.751Z","etag":null,"topics":["docker","swarm","webhook"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zazuko.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2021-06-28T18:39:26.000Z","updated_at":"2022-02-09T18:50:51.000Z","dependencies_parsed_at":"2023-05-24T23:30:15.232Z","dependency_job_id":null,"html_url":"https://github.com/zazuko/swarm-webhook","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"purl":"pkg:github/zazuko/swarm-webhook","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zazuko%2Fswarm-webhook","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zazuko%2Fswarm-webhook/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zazuko%2Fswarm-webhook/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zazuko%2Fswarm-webhook/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zazuko","download_url":"https://codeload.github.com/zazuko/swarm-webhook/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zazuko%2Fswarm-webhook/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279001117,"owners_count":26083021,"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","status":"online","status_checked_at":"2025-10-09T02:00:07.460Z","response_time":59,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["docker","swarm","webhook"],"created_at":"2025-03-12T00:52:45.484Z","updated_at":"2025-10-09T09:13:10.827Z","avatar_url":"https://github.com/zazuko.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Swarm webhook\n\n## Quick start\n\nCreate a `docker-compose.yaml` file with the following content:\n\n```yaml\nversion: \"3\"\n\nservices:\n  webhook:\n    image: ghcr.io/zazuko/swarm-webhook\n    volumes:\n      - \"/var/run/docker.sock:/var/run/docker.sock\"\n    ports:\n      - 3000:3000\n    environment:\n      - SERVER_HOST=0.0.0.0\n      - SERVER_PORT=3000\n    deploy:\n      placement:\n        constraints:\n          - node.role == manager\n\n  nginx:\n    image: nginx:1.21-alpine\n    deploy:\n      mode: replicated\n      replicas: 0\n      labels:\n        - swarm.webhook.enabled=true\n        - swarm.webhook.name=nginx\n      restart_policy:\n        condition: none\n\n  nginx-two:\n    image: nginx:1.21-alpine\n    deploy:\n      mode: replicated\n      replicas: 0\n      labels:\n        - swarm.webhook.enabled=true\n        - swarm.webhook.name=nginx-two\n      restart_policy:\n        condition: none\n```\n\nMake sure you have a Swarm cluster (`docker swarm init`), and run the stack using:\n\n```sh\ndocker stack deploy -c docker-compose.yaml swarm-webhook\n```\n\nSome actions:\n\n- http://127.0.0.1:3000/ : list all containers with webhook enabled\n- http://127.0.0.1:3000/start/nginx : start the container for the `nginx` service\n- http://127.0.0.1:3000/stop/nginx : stop the container for the `nginx` service\n- http://127.0.0.1:3000/start/nginx-two : start the container for the `nginx-two` service\n- http://127.0.0.1:3000/stop/nginx-two : stop the container for the `nginx-two` service\n\nYou can use `docker ps` to see the containers that are running.\n\nTo remove the stack, use:\n\n```sh\ndocker stack rm swarm-webhook\n```\n\n## Use it in your stack\n\n### Deploying the webhook service\n\nYou have to deploy the webhook service:\n\n```yaml\nwebhook:\n  image: ghcr.io/zazuko/swarm-webhook\n  volumes:\n    - \"/var/run/docker.sock:/var/run/docker.sock\"\n  ports:\n    - 3000:3000\n  environment:\n    - SERVER_HOST=0.0.0.0\n    - SERVER_PORT=3000\n  deploy:\n    placement:\n      constraints:\n        - node.role == manager\n```\n\nYou can use following environment variables:\n\n- `SERVER_PORT`: configure the server port (default: `3000`)\n- `SERVER_HOST`: configure the server host (default: `::`)\n\n### Configure your services\n\nYou will have to edit the `deploy` part of your services to have something like the following:\n\n```yaml\nyour-service:\n  # …\n  deploy:\n    mode: replicated\n    replicas: 0\n    labels:\n      - swarm.webhook.enabled=true\n      - swarm.webhook.name=your-service\n    restart_policy:\n      condition: none\n```\n\nThe `swarm.webhook.enabled=true` is useful to filter only on services having this label.\n\nYou will also have to add the `swarm.webhook.name=your-service` label (by changing `your-service` with something which is unique).\nThis will be the part you should provide in the URL: `WEBHOOK_URL/start/your-service`.\n\nIf you want to run multiple instances for a specific service, you can add the following label: `swarm.webhook.replicas=2` (replace `2` with the desired number of replicas).\nThe default value is `1`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzazuko%2Fswarm-webhook","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzazuko%2Fswarm-webhook","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzazuko%2Fswarm-webhook/lists"}