-
-
Notifications
You must be signed in to change notification settings - Fork 2k
docker-compose support #1596
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
docker-compose support #1596
Conversation
b4be79e to
aad27d8
Compare
plugins/00_dokku-standard/commands
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we make this docker-compose? or at least something less generic.
|
need docs and tests |
|
Can you describe this deployment scenario from repo to deployment? Now that the implementation is out of the way 😜 what is the justification for adding this new method? |
|
Read the attached docs for more reasoning :) |
|
Basically this "solves" the issue where Dockerfile deployments currently have no way of running multiple processes. We treat the |
|
Can you include some example repo artifacts for this method? Even better a test app would be great. |
plugins/00_dokku-standard/commands
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From line 75-90, the file is generated and copied.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh i see that now. the use of a generic directory like /opt/ seems odd to me. can we use /tmp or /tmp/build in the container instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah I can take a stab at that.
|
Heh I've managed to stay this long without having tests! https://github.com/josegonzalez/dokku-compose-app It's more or less the sample |
95677c4 to
35bc85e
Compare
|
+1 |
|
Please do not +1 feature pull requests. We'll merge the features when they are ready :) |
|
@michaelshobbs If I add my test app, would you mind adding actual tests for it? |
|
please add a test app in this PR and i can add tests to the documented spec. (side note: make sure those docs clarify the expected behavior) |
This method does not currently scale non-web/app containers properly.
fig became docker-compose
This will allow us to specify a custom image for each process.
docker-compose processes are simply top-level entries in the docker-compose.yml file. We need to keep track of custom images for containers where the file specifies them, and otherwise use the built image. We use a special `Procfile.compose` file to keep track of this within the base image itself, and then later retrieve this when deploying each scaled container.
|
Why? |
|
@josegonzalez I would like to run multiple instances (web, workers) using Dockerfile deployment method (no Procfile). Currently if I have Dockerfile, dokku creates only web process and there is no way to run other type of processes (for example workers). Using docker-compose standard, dokku can automatically create web and workers processes which are defined in docker-compose.yml file. |
|
How do you imagine linking works? Really what we want is a way to define multiple images or the same image with different start commands. Compose more or less replicates a lot of what dokku does and supporting it properly isn't feasible. The above could work but would leave everyone upset with how things are implemented/not supported. |
|
I understand your concerns about django-compose which overlaps dokku functionality. And I agree with you. |
|
So what would you like us to do? Ideally we do not introduce a dokku.yml :) |
|
@josegonzalez For me the removal of Zero-Downtime deploys would be a dealbreaker. What would be biggest benefit be for the Docker-compose? |
|
Being able to run multiple commands for a Dockerfile-based deploy. |
|
@josegonzalez I suggest to add a new option to specify path to Dockerfile (as environmental variable). It gives possibility to create separate Dockerfiles for web and workers. For example, I can have the following repository structure: And then I can create a worker by defining path to /worker/, e.g. dokku config:set my_app DOCKERFILE_PATH=/worker/ |
This is already possible via the DOCKER_BUILD_OPTIONS part of the docker-options plugin. You can specify |
|
You can't do that for a specific process though. |
|
I've had success using a Procfile and the |
|
@mmerickel would you be willing to write an documentation for this? |
|
Note: even in such a deploy, you don't get the ability to run different dockerfiles. I suppose that is okay. |
|
Closing in favor of using the Procfile behavior that @pmclanahan is going to work on :) |
|
@josegonzalez is there any feedback about the feature @pmclanahan is working on? |
|
That ended up being our Procfile support as documented here. |
|
There is another use-case for this which, I believe, is much more compelling -- dev-prod parity. Currently you can use dokku plugins to link to other services, which is great for production but if you app depends on those services you can no longer use it locally. Docker-compose allows you to have the same exact environment, complete with orchestrated services locally and and in production. Currently, I get around this by using vagrant to orchestrate local docker containers. It would be great to be able to deploy a docker-compose file as well. It seems to be supported by heroku as well, so I know i'm not crazy: https://devcenter.heroku.com/articles/local-development-with-docker-compose |
|
This just doesn't work with zero-downtime deploys. Docker-compose doesn't handle that properly at all, and it's not clear to me how we'd handle conditionally starting/stopping certain services once they are running. If you'd like to contribute to this, please see me on chat - my nick is |
|
@josegonzalez I thought I saw the new v3 compose config supports docker services. Perhaps dokku automatically turns it's zero downtime off in the case of compose and we leave it up to the docker-compose.yml author to do what they want. shrug |
|
@michaelshobbs you may as well just shove sshfront + docker-compose if you're going to do that. I don't see the value of using docker-compose for infra if you are tossing out the best parts of Dokku. |
|
I get your point. To be fair zero-downtime is just part of the build -> deploy -> proxy pipeline. The point about using docker-compose to represent prod environments in development is also valid. Just throwing it out there that this might be possible with the latest version of docker-compose. |
|
dokku does offer some other goodies like automatically setting up nginx proxies for your containers, plugins (especially letsencrypt...) |
|
I mean if someone wants to do the work of refactoring our pipeline to make it easy to make this an engine, then they may want to speak to me directly on chat. |
|
I'm locking this thread as I don't think it's productive - the code here isn't mergeable anymore anyhow - and would rather we go back to the drawing board on how this might fit in. I mentioned engines above, and have had this convo with @michaelshobbs via video, but if you are interested, please chat with me directly. |
This PR implements preliminary docker-compose support. It's pretty untested, but building containers and deploying them the dokku way appears to work. A few notes:
linksdo not work. This is because containers have random names when we start them, and the links depend upon those names being applied to running containers. There isn't a straightforward way to do this since you cannot re-link running containers. I'm sure other compose features are similarly broken.We require using a
Procfile.composeto track the required image for a given process type. It's pretty hacky and I'm not proud of it.It goes without saying, but you need both a
Dockerfileand adocker-compose.ymlfile. Unfortunately there is currently no way to disabledocker-composesupport.Tests don't pass, mostly because github is broken atm and I didn't run them locally. We probably want a
docker-composetest as well. I have a small app that should work.You still need to run the following (as root) to get this to work:
Todo:
docker-compose.yml.Refs #1564
Refs #1594