Skip to content

aklinker1/portainer-stack-webhook

Repository files navigation

Portainer Stack Webhook

An equivalent solution to Portainer BE's Automatic Stack Updates feature, but free.

Just run the container, tell it how to access your portainer instance, and tada, it's done! 🎉

# docker-compose.yml
services:
  stack-webhook:
    image: aklinker1/portainer-stack-webhook
    ports:
      - 3000:3000
    environment:
      PORTAINER_API_URL: https://portainer.example.com/api  # Required, full URL including /api
      PORTAINER_USERNAME: your-username                     # Required, username to login with
      PORTAINER_PASSWORD: your-password                     # Required, password to login with
      PORT: 3000                                            # Optional, default 3000
      API_KEY: your-api-key                                 # Optional, set to a any string to require authentication
      LOG_LEVEL: json                                       # Optional, control the log format ("pretty" | "json")

To tell Portainer to pull the latest images and update the stack, make a simple POST request:

# No authentication
curl -X POST http://localhost:3000/api/webhook/stacks/:stackId

# With an API key
curl -X POST -H "X-API-Key: <your-api-key>" http://localhost:3000/api/webhook/stacks/:stackId

You can get the stackId from the GET /api/stacks endpoint.

For other available APIs, see /scalar or copy-paste ./openapi.json into Scalar Editor

Contributing

To install dependencies:

bun install

@aklinker1/zeta docs: https://jsr.io/@aklinker1/zeta

To run:

  1. Copy the .env.template to .env and fill it out with your portainer instance's info:
    cp .env.template .env
  2. Start the server
    bun dev
  3. Send a request to test it out
    curl -X POST http://localhost:3000/api/webhook/stacks/123

To run tests:

bun test

About

Free alternative to Portainer BE's "Automatic Stack Updates"

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors