Comments (7)
Thank you, and good analysis that's how really works dokploy under the hood in deployments terms.
You are right, it will deploy only the tag you selected, but in your case you pushed 3 images at the same time it will create 3 deployments obviously with the same tag, but is not ideal to redeploy 3 times the same tag, We need to apply a filter there to prevent the deployments when you push another tag, the same as we do in github when the branch doesnt match it will return 301, We can do the same, altought is not a big problem for now but would be ideal to do make this little detail.
Would you ve up to make a PR?
from dokploy.
Would you ve up to make a PR?
I'll be happy to work on it
from dokploy.
I understand the problem, definitely the easiest solution would be to filter by the tag chosen in the docker setup provider, this would make it easier
from dokploy.
I understand the problem, definitely the easiest solution would be to filter by the tag chosen in the docker setup provider, this would make it easier
You are right, problem is that dockerhub does not offer any support to filter / condition webhook triggers.
Maybe with github webhook i can achieve that behaviour.
Thanks for the reply!
from dokploy.
Yeah, what i mean is we can change the behavior in the endpoint where we recieve the webhook, and filter by the tag you specified in the docker provider, I think this will have more sense, because if tou specified a specific tag, you expect to be deployed only on that specific tag, in fact this is what we do on GitHub provider and git provider, we filter by the branch
from dokploy.
With github integration worked as expected.
Kinda different workflow since now its listening to "push" on specified branch and then building that source code and deploying.
I'm still a little worried about build the application in the same machine that I use for production apps (maybe its just over thinking since my apps are lightweight).
Anyway,
I'm studying the dokploy architecture a little bit. As I understood,
1 - Dokploy listens to http request on /api/deploy/<refreshToken>
(which do we pass to providers dockerhub, etc..)
2 - Find application by using provided token
3 - If application deploy sourceType is git / github:
-> Ensure that webhook payload matchs with provided branch (if not, ends with 301 status)
4 - Push deployments
to queue.
dokploy/pages/api/deploy/[refreshToken].ts
Lines 36 to 50 in 874d1f9
5 - deployments
worker start job execution.
6 - Processor execute deployApplication
which will execute deploy action based on sourceType
Lets say our sourceType is "docker".
7 - Execute dockerBuild
which will docker pull the image with provided setup (including tag).
Looks like dokploy is not deploying the other tags, which is great... I mean, we dont read the webhook payload. It is used only to trigger the deploy (which i think is the right choice).
Its a fake data (titleLog
naming event payload)
dokploy took from webhook payload the name from tags (production, staging, etc) but it never deployed every image... It only repeat the same deploy for the initial provided tag image
So... there is no problem (only multiple deploy of the same image)
Solution
if (sourceType === 'docker') {
const currentTagName = getTagFromDockerImage(application.dockerImage) ?? 'latest'
if (currentTagName) {
const requestBody = request.body // i dont know how to access it
// https://docs.docker.com/docker-hub/webhooks/?_gl=1*1ksgu74*_ga*NjA2MjQ5NTU3LjE3MTY1NTI4ODc.*_ga_XJWPQMJYHQ*MTcxNjU5Mjc5OS4zLjEuMTcxNjU5MzI2NS41Ny4wLjA.
const payloadTagName = requestBody.push_data.tag
if (payloadTagName !== currentTagName) {
res.status(301).json({ message: "Branch Not Match" });
return;
}
}
}
if (sourceType === "github") {
const branchName = extractBranchName(req.headers, req.body);
if (!branchName || branchName !== application.branch) {
res.status(301).json({ message: "Branch Not Match" });
return;
}
} else if (sourceType === "git") {
const branchName = extractBranchName(req.headers, req.body);
if (!branchName || branchName !== application.customGitBranch) {
res.status(301).json({ message: "Branch Not Match" });
return;
}
}
from dokploy.
Here is the titleLog.
Appears like it is deploying the image described. But its only log purpose (deployed tag is always the provided on initial config)
dokploy/pages/api/deploy/[refreshToken].ts
Lines 109 to 113 in 874d1f9
from dokploy.
Related Issues (20)
- Invalid password set after creating a redis database HOT 1
- Href on the entire project card
- dokploy not responding HOT 2
- Can't fetch Github Repository HOT 2
- Splitting DB container in docker compose when deploy HOT 1
- ERR_EMPTY_RESPONSE on traefik domain [IPV6] HOT 6
- Include Typebot in Dokploy Templates
- Feature: Categorize Templates for Improved UX HOT 1
- Cluster (Docker Swarm Worker Replication) Not Working on Ipv6 HOT 4
- Linux Standards Violation: Incorrect Storage of Docker Volumes and Logs HOT 2
- Next.js could not access redis from the same project HOT 1
- Every time I create a server on Hetzner, it does not work after restart HOT 2
- Add more avatar options or/and custom avatar for the Dokploy dashboard HOT 1
- Clarify error message for naming validation in `AppName` (`application`, `database`, and `compose`) HOT 1
- Domains for services created via template HOT 5
- Support pgvector HOT 4
- Update default CNB builder image to `heroku/builder:24` HOT 1
- Should trafik be automatically configured for docker compose? HOT 1
- 2 Factor Authentication HOT 2
- Add Support for Environment Variables During Dockerfile Build Process in Dokploy HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dokploy.