--- name: mosaic-portainer description: Manage Docker Swarm stacks through Portainer when a Portainer credential is available. Use when asked to list, start, stop, redeploy, or check logs through Portainer. --- # mosaic-portainer Manage Portainer stacks through supplied scripts. ## Decision Gate Portainer is optional. Use this skill only when the estate holds a Portainer credential. If a stack README documents `docker stack deploy` on the manager, that is the deploy path. Do not propose Portainer otherwise. ## Setup After confirming a Portainer credential is available, load it before running scripts: ```bash source ~/.config/mosaic/tools/_lib/credentials.sh load_credentials portainer # Exports: PORTAINER_URL, PORTAINER_API_KEY ``` ## Scripts All scripts live in `~/.config/mosaic/tools/portainer/`. | Script | Purpose | Key flags | | ------------------- | ---------------------------- | ------------------------------ | | `stack-list.sh` | List all stacks | — | | `stack-status.sh` | Status of a stack | `-n ` | | `stack-redeploy.sh` | Redeploy (file or git-based) | `-n [-p]` (pull images) | | `stack-start.sh` | Start a stopped stack | `-n ` | | `stack-stop.sh` | Stop a running stack | `-n ` | | `stack-logs.sh` | Tail stack logs | `-n [-l lines]` | | `endpoint-list.sh` | List Portainer endpoints | — | ## Common Workflows **Redeploy a stack through Portainer:** ```bash source ~/.config/mosaic/tools/_lib/credentials.sh && load_credentials portainer ~/.config/mosaic/tools/portainer/stack-redeploy.sh -n -p ``` **Check all stack statuses:** ```bash source ~/.config/mosaic/tools/_lib/credentials.sh && load_credentials portainer ~/.config/mosaic/tools/portainer/stack-list.sh ``` **Tail logs for a service:** ```bash source ~/.config/mosaic/tools/_lib/credentials.sh && load_credentials portainer ~/.config/mosaic/tools/portainer/stack-logs.sh -n -l 100 ``` ## Notes - `stack-redeploy.sh -p` does not override a digest-pinned image. Follow the stack README's documented deployment procedure for pinned images. - Credentials are loaded through `load_credentials portainer`.