HUB
Sign inSign up

rdelorenzo/valet

By rdelorenzo

•Updated 22 days ago

Valet is a redeployment notification framework for Portainer

Image
Developer tools
Monitoring & observability
0

1.2K

rdelorenzo/valet repository overview

⁠Valet

Programmatically trigger stack redeploys for Portainer.

Push a new image from CI, hit a webhook, and your Portainer stack is pulling and redeploying within seconds.

CI License: GPL v3 Docker Docker Pulls Docker Image Size Node.js Next.js TypeScript

⁠Why Valet?

Portainer CE has no stack or container webhooks. This means that if you want to re-pull and re-deploy a stack as part of CI, you can't. You have to go into the UI or SSH.

Valet closes that gap. Each stack gets a deploy hook URL. When you want to re-deploy your stack, simply POST to that hook and Valet asks Portainer — via its own API — to update the stack with an image re-pull.

⁠Features

  • Deploy hooks per stack — a secret-token URL that you can call to re-pull and re-deploy any stack.
  • Centralized deployment — a single Valet instance can manage deployments on different Portainer environments.
  • UI for management - you can manage users, portainer instances, and webhooks from the web UI.
  • Native redeploys — uses Portainer's own API, keeping the stack fully managed by Portainer.
  • Webhook degradation alerting — we check stack reachability in the background, so if something breaks you'll know about it before a deploy failure.
  • CI-ready — copy-paste snippets for GitHub Actions, CircleCI, and other CI providers, generated for you live.
  • OIDC login — BYO Auth with multi-provider OpenID Connect support.
  • Private by design — Valet is designed to be used with private repos and image repositories.
  • Super simple to deploy — valet is a single container, so you don't have to worry about external queues, databases, or caches.

⁠Screenshots

Screenshots coming soon — placeholders live in docs/images/⁠.

⁠Getting Started

⁠Prerequisites
  • An environment to deploy Valet into, this can be either plain docker + compose or even Portainer itself.
⁠1. Deploy

If you're already running Portainer, you can deploy Valet as just another stack on it:

  1. In Portainer, go to Stacks → Add stack and name it valet.

  2. You can use this compose definition as a starting point:

    services:
      valet:
        image: rdelorenzo/valet:latest
        restart: unless-stopped
        ports:
          - "3000:3000"
        environment:
          APP_BASE_URL: https://valet.example.com
          AUTH_SECRET: <your-secret-here>
        volumes:
          - valet-data:/app/data
    
    volumes:
      valet-data:
    

Tip

A ready-made sample lives at [`docker-compose.yml`](docker-compose.yml) in the repo root.
  1. Set the environment variables — either inline above, or under the stack's Environment variables section (Portainer keeps those with the stack):

    • APP_BASE_URL — your public URL, will be used to compute hook and auth URLs

    • AUTH_SECRET — generate one with

      openssl rand -base64 32
      
  2. Deploy the stack.

Notes:

Valet talks to Portainer over its API as a client. Deployed on the same host as Portainer, host.docker.internal or a shared network works; for self-signed certs (e.g. Portainer's :9443), enable the instance's insecure TLS option when adding it.

⁠2. First-time setup
  1. Open the app in a browser. With no login provider configured, it'll send you to the first-time setup flow.

  2. Grab the setup code from the container logs — it's printed there on first use (in Portainer: Containers → valet → Logs, or docker logs valet):

    ══════════════════════════════════════════
      Valet — Initial setup required
      Setup code: A1B2C3
    ══════════════════════════════════════════
    
  3. Enter the code (it's valid for one hour) and configure your first OIDC auth provider, for example Authentik. The flow will provide you with instructions.

  4. Sign in through that provider. The first account to sign in becomes the admin.

  5. As admin, add your Portainer instances under Instances, then create your first deploy hook (below).

⁠Usage

⁠Create a deploy hook

From the dashboard, Create deployment hook and walk through the wizard:

  1. Pick a Portainer instance (or add one with the URL + access token)
  2. Pick the stack to deploy
  3. Name the hook

Each hook gets its own secret URL:

https://valet.example.com/api/deploy/<token>
⁠Wire it into CI

Trigger the hook after your image push, then poll until the deploy finishes. We provide snippets to do this in the most popular CI frameworks.

Store the hook URL as a repository secret (e.g. DEPLOY_WEBHOOK_URL) rather than committing it.

Building a custom integration? See the deploy hook API reference⁠.

⁠Development

Run from source:

git clone https://github.com/rudydelorenzo/valet.git
cd valet
npm ci
npm run dev        # http://localhost:3000
ScriptPurpose
npm run devDev server
npm run buildProduction build
npm startServe the production build
npm run lintESLint
npm run typecheckGenerate route types + TypeScript check

Notes for contributors:

  • Requires Node.js ≥ 24.
  • Database migrations apply automatically at startup; generated SQL lives in drizzle/⁠.
  • The SQLite database is created at ./data/valet.db on first run (gitignored).

⁠How it works

sequenceDiagram
    participant CI as CI pipeline
    participant V as Valet
    participant Q as SQLite queue
    participant W as Worker
    participant P as Portainer CE API

    CI->>V: POST /api/deploy/{token}
    V->>Q: Enqueue deploy event
    V-->>CI: 200 { eventId, statusUrl }
    W->>Q: Claim event (poll)
    W->>P: GET /api/stacks/{id} + /file
    W->>P: PUT /api/stacks/{id}?endpointId=…<br/>compose + env sent back, pullImage: true
    P->>P: Pull image, recreate containers
    W->>Q: Mark event success/error
    CI->>V: GET statusUrl (poll until done)
    V-->>CI: queued → running → success

⁠Contributing

Contributions are welcome.

  1. Fork the repository
  2. Create your feature branch: git checkout -b feature/awesome
  3. Commit your changes: git commit -m 'feat: add awesome'
  4. Push the branch: git push origin feature/awesome
  5. Open a Pull Request

⁠Tech Stack

LayerChoice
FrameworkNext.js 16⁠ (App Router) + React 19⁠
UITailwind CSS 4⁠ + shadcn/ui⁠ (Base UI primitives)
DatabaseSQLite via Drizzle ORM⁠ + better-sqlite3 (migrations auto-apply at startup)
AuthOpenID Connect⁠ with PKCE; sessions are signed JWTs (jose⁠)
ValidationZod⁠ — the API contract, types inferred from schemas
OrchestrationPortainer CE⁠ REST API (X-API-Key access tokens)

⁠License

Copyright (C) 2026 rudydelorenzo

Distributed under the GNU General Public License v3.0 (copyleft — derivative works must remain GPL). See LICENSE⁠ for details.

Questions or issues? Open a GitHub issue⁠.

⁠Roadmap

  • Scheduled stack healthchecks with worker
  • Prebuilt GitHub Actions job to automate the redeploy + wait step.
  • More integration guides for other CI frameworks
  • Ability to self-deploy, this needs some thought given to it... my instinct is the deploy would start and execute successfully, but then immediately after triggering we'd shut down and lose track of progress. Maybe the fix here is writing event lifecycle events to the db and adding some write-flushing to the shutdown logic to ensure it persists, then add some in-flight event recovery logic.
  • Worker paralleization (sequential right now, if we were to paralellize we have to give some thought to ensuring we don't execute events for the same webhook in parallel)
  • Better docs LOL, both about usage and about self-hosting
Tag summary
Recent tags
Content type
Image
Digest
sha256:e62a1fb51…
Size
102.7 MB
Last updated
22 days ago
docker pull rdelorenzo/valet:latest