Replies: 9 comments
-
|
Some related issues, Implementing #1753 and a webhook without payload would allow you to update the stack after a build is completed. However, the git reference may not match the trigger for the CI build. And the stack file can't be generated as a build artifact (for example if you've got a need to generate it from templates), it needs to be committed. This may cover the use cases for #2752 It may also provide an alternative approach to #2238, where builds can be run externally, for example on Drone CI and deployed through this call. |
Beta Was this translation helpful? Give feedback.
-
|
Hi @Beanow Definitely a must have !
I believe that if we can support #1753 (and thus, #1752 first), we'd be able to trigger a git pull and docker stack deploy via a webhook. I wonder why you think it might not be enough? I also don't think that it covers #2752 as this one covers service webhooks, which are used to update a single service (and this enhancement's goal is to be able to provide a different image name to use for a service). I'm keen to discuss this on Slack, feel free to PM me and then we can share our discussion/ideas in here. |
Beta Was this translation helpful? Give feedback.
-
|
Sorry to have gone off grid for a while.
Both worked well for a straightforward use-case. But I think there are some differences that might make the later preferable for more involved setups. One big difference is handling race conditions. Whether 20s or 20m, your CI build will take some time to complete. Imagine two merges going to master in quick succession. And the second one is a breaking overhaul of the container's configuration, reflected in the environment vars of the service in the stack. Completing the first build pipeline, may cause the second stack configuration to be deployed before the corresponding code changes are built, breaking the deployment. Had the stack been submitted from the build pipeline instead, that would have allowed matching the correct stack with the code we've just built. Another is having a more declarative pipeline. When the stack is pushed, you specify exactly what you want your end result to be. While the git pull approach means your pipeline comes to depend on assumptions about the side-effects of triggering the webhook. Finally, complex deployment schemes don't require this complexity to be implemented in portainer. For example, if you'd like to maintain a stack serving a preview service for each open pull request. Could be achieved with a script in your pipeline generating the necessary stack for PR triggers but would be a standardization nightmare to do based on pulling multiple files from git and merging them somehow. |
Beta Was this translation helpful? Give feedback.
-
|
We're currently calling a handful of service webhooks from CI after each successful build, but as we scale up, this is going to become a nightmare to manage. A single webhook URL for the stack that updates every service (or a subset of services based on the body of the request) would be super useful. |
Beta Was this translation helpful? Give feedback.
-
|
We have a preview version available that allows you to pull compose files from Git and either poll for changes or use a webhook to pull the latest compose file from Git and redeploy the stack. Please give it a try by using the image |
Beta Was this translation helpful? Give feedback.
-
|
@huib-portainer are notifications ( slack,webhook,email,etc ) on the roadmap? For example:
Would be nice to support also Prometheus metrics for these states, but afaik Prometheus integration is not planned.. Thanks |
Beta Was this translation helpful? Give feedback.
-
|
For the short term sending notifications is not part of this feature. What is your use case for needing notifications, if you don't mind me asking? |
Beta Was this translation helpful? Give feedback.
-
|
I am using industry standard for k8s
Notifications
,but there is nothing for standalone docker. And these notification states should correlate also to metrics ...
These are related to continious deployment ( portainer ), metrics from node-exporter, cadvisor or dockerd should not replace them, only to complete the observability itself. |
Beta Was this translation helpful? Give feedback.
-
|
@deviantony ^ what do you think ? |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Is your feature request related to a problem? Please describe.
Currently I am managing stacks through a CI tool to build new images, and calling
PUT /stacks/{id}to take the stack's compose file from the git repository that triggered this build and deploy it.This requires some steps to set up, particularly creating a new user, granting them access, and knowing the stack ID. The flow would be to obtain a JWT for this user then PUT the stack.
Describe the solution you'd like
Similar to how webhooks currently work to restart services, being able to generate a token for this specific stack and operation will make administration a lot simpler by removing the need for deploy-users. A bit safer as capabilities are reduced compared to a user. And simpler to implement as a single HTTP request.
For the API there's lots of options, but I would suggest using the existing
POST /webhooks/{token}for a new typeStackWebhook.It would have an optional body that matches
PUT /stacks/{id}'s body.When the body is empty, this is the equivalent of updating every existing service in this stack.
When a body is provided, it's the equivalent of a
PUT /stacks/{id}request.This allows for both clients that don't know Portainer's API to trigger updates, and for clients that do to be able to change the stack's contents.
I'm happy to have a crack at this, but some opinions on the API would be appreciated.
Beta Was this translation helpful? Give feedback.
All reactions