-
-
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
Closed
Closed
docker-compose support #1596
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
f64fe7b
Ensure we send dokku receive the correct type for compose
josegonzalez f7c8408
First pass at using docker-compose to setup an application
josegonzalez 3f989f8
Use COMPOSE_ARGS instead of FIG_ARGS
josegonzalez 2537597
Scope the IMAGE variable to each process
josegonzalez 5b8fde3
Keep track of the image necessary for each process
josegonzalez adfddb8
Properly initialize the scale file for compose applications
josegonzalez 1f560de
Do not scale all containers to 1 on deploy
josegonzalez c0d58cd
remove extra echo
josegonzalez ed1ea5b
Add python-yaml as debian dependency to control file
josegonzalez e30755d
Allow stop and kill command to succeed when the container is no longe…
josegonzalez 1fd0b00
Shut docker stop and docker kill up
josegonzalez aa4ecb4
Fix reference to DOKKU_PROCFILE
josegonzalez 1c4225d
Fix lint violations
josegonzalez 7b5e7bb
compose => docker-compose
josegonzalez db3b411
Install shyaml and docker-compose in Makefile-based deployments
josegonzalez b2b3f68
Prefer the `web` to `app` process type as the primary process type
josegonzalez 96ba10a
Add documentation for docker-compose
josegonzalez da9d893
Use /tmp instead of /opt to store Procfile.compose
josegonzalez 60eaeb3
Upgrade docker-compose and ensure proper permissions on compose-relat…
josegonzalez 4697def
Specify project name so that docker-compose names the images correctly
josegonzalez File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| # Dockerfile Deployment | ||
|
|
||
| > New as of 0.4.3 | ||
|
|
||
| As an extension of Dockerfile-based deployment, you can also deploy an application that uses `docker-compose`. This is useful as an alternative to running a process manager inside of a `Dockerfile`-based container, and should be considered the canonical way to deploy multiple processes when using a `Dockerfile` directly. | ||
|
|
||
| To deploy an application via `docker-compose`, your repository will need the following files: | ||
|
|
||
| - `Dockerfile` | ||
| - `docker-compose.yml` | ||
|
|
||
| To use `docker-compose` for deployment, commit a valid `Dockerfile` **and** `docker-compose.yml` to the root of your repository and push the repository to your Dokku installation. If these files are detected, Dokku will default to using it to construct containers **except** in the following two cases: | ||
|
|
||
| - The application has a `BUILDPACK_URL` environment variable set via the `dokku config:set` command or in a committed `.env` file. In this case, Dokku will use your specified buildpack. | ||
| - The application has a `.buildpacks` file in the root of the repository. In this case, Dokku will use your specified buildpack(s). | ||
|
|
||
| At this time, you cannot fallback to using `Dockerfile` only deployments. | ||
|
|
||
| ## Web processes | ||
|
|
||
| At this time, you may only have **one** web process proxied by nginx. Having any other processes will require manual configuration of your nginx configuration. | ||
|
|
||
| The web process is noted as either the `app` or `web` stanza in your `docker-compose.yml` file, with the `web` stanza having precedence. | ||
|
|
||
| Your application *must* have either an `app` or `web` stanza or the `docker-compose` deployment will fail. | ||
|
|
||
| ## Exposed ports | ||
|
|
||
| By default, Dokku will extract the first `EXPOSE` tcp port and use said port with nginx to proxy your app to that port. For applications that have multiple ports exposed, you may override this port via the following command: | ||
|
|
||
| ```shell | ||
| # replace APP with the name of your application | ||
| dokku config:set APP DOKKU_DOCKERFILE_PORT=8000 | ||
| ``` | ||
|
|
||
| Dokku will not expose other ports on your application without a [custom docker-option](/dokku/configuration/docker-options/). | ||
|
|
||
| If you do not have a port explicitly exposed, Dokku will automatically expose port `5000` for your application. | ||
|
|
||
| ## Dependent images | ||
|
|
||
| Dokku will automatically use the images specified for each process-type specified in a `docker-compose.yml` file, and will fall back to the image created by either the `app` or `web` process-type. Non-primary process types will be scaled to 0 by default. | ||
|
|
||
| ## Limitations | ||
|
|
||
| `docker-compose` support has a few known limitations. The below is not considered exhaustive, and may change over time. | ||
|
|
||
| - Container `links` do not work. When Dokku starts containers, the containers are named pseudo-randomly, and due to how zero-downtime deployments work, we cannot guarantee that any started links will start properly. Docker also cannot link already started containers, and thus this functionality is currently unused. For datastores, please use the [official datastore plugins](/dokku/plugins/#official-plugins-beta). | ||
| - Dokku uses a special `Procfile.compose` file to maintain a mapping of the process type to docker image. Please avoid using this file for other purposes. | ||
|
|
||
| ## Process scaling | ||
|
|
||
| Process scaling works the same as it does for `buildpack` deployments. See the [process management documentation](/dokku/process-management/). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| #!/usr/bin/env bash | ||
| set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x | ||
|
|
||
| STDIN=$(cat) | ||
| APP="$1" | ||
|
|
||
| echo "$STDIN -p $APP" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| #!/usr/bin/env bash | ||
| set -eo pipefail; [[ $DOKKU_TRACE ]] && set -x | ||
|
|
||
| STDIN=$(cat) | ||
| APP="$1" | ||
|
|
||
| echo "$STDIN -p $APP" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
if
shyamlcomes from thepython-yamlpackage then you'll want to add installation of this package to the Makefile.