-
Notifications
You must be signed in to change notification settings - Fork 123
WIP: Swarm services #186
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
Open
ehazlett
wants to merge
7
commits into
master
Choose a base branch
from
swarm-services
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
WIP: Swarm services #186
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
6846959
switch to engine-api; update beacon to be more efficient
ehazlett 6d9d2b0
add support for influxdb backend for beacon
ehazlett 9e61d3c
start on swarm services; move to glade
ehazlett e2d25d0
support for docker services
ehazlett 153bb9f
add example docs for docker services
ehazlett 58bdde8
update glide deps
ehazlett 97977eb
update tests
ehazlett File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,88 @@ | ||
| # Interlock with Docker Services | ||
| Starting in Docker 1.12 there is support for Services. In this example, we | ||
| will use Services to run Interlock and the Proxy. | ||
|
|
||
| Note: if you have not initialized the Swarm, make sure to init it with `docker swarm init` | ||
|
|
||
| # Nginx | ||
| This will create a global Nginx service that will run on every node and | ||
| publish port 80: | ||
|
|
||
| ``` | ||
| docker service create \ | ||
| --name interlock-nginx \ | ||
| --publish 80:80 \ | ||
| --mode global \ | ||
| --label interlock.ext.name=nginx \ | ||
| nginx \ | ||
| nginx -g "daemon off;" -c /etc/nginx/nginx.conf | ||
| ``` | ||
|
|
||
| You should now be able to visit `http://<node-ip>` and see the Nginx welcome | ||
| page. | ||
|
|
||
| # Interlock | ||
| We will now start a global Interlock service that will run on every node: | ||
|
|
||
| First, we need an Interlock configuration. Create a file called `config.toml` | ||
| with the content: | ||
|
|
||
| ``` | ||
| ListenAddr = ":8080" | ||
| DockerURL = "unix:///var/run/docker.sock" | ||
| PollInterval = "2s" | ||
|
|
||
| [[Extensions]] | ||
| Name = "nginx" | ||
| ConfigPath = "/etc/nginx/nginx.conf" | ||
| PidPath = "/var/run/nginx.pid" | ||
| TemplatePath = "" | ||
| MaxConn = 1024 | ||
| Port = 80 | ||
| ``` | ||
|
|
||
| Now create the Interlock service: | ||
|
|
||
| ``` | ||
| docker service create \ | ||
| --mode global \ | ||
| --name interlock \ | ||
| --mount type=bind,source=/var/run/docker.sock,target=/var/run/docker.sock,writable=true \ | ||
| --env INTERLOCK_CONFIG="$(cat config.toml)" \ | ||
| ehazlett/interlock:latest -D run | ||
| ``` | ||
|
|
||
| This will load the `config.toml` as an environment variable. Also note that | ||
| we are using the Docker socket and do not need to have any other access to | ||
| Docker. If you need to update the configuration, simply update the config | ||
| file and run | ||
| `docker service update --env INTERLOCK_CONFIG="$(cat config.toml)" interlock`. | ||
|
|
||
| # Demo | ||
| We will now start a demo service. We will use labels in the service for | ||
| Interlock to configure the upstream: | ||
|
|
||
| ``` | ||
| docker service create \ | ||
| --name demo \ | ||
| --publish 8080 \ | ||
| --env SHOW_VERSION=1 \ | ||
| --label interlock.hostname=demo \ | ||
| --label interlock.domain=local \ | ||
| ehazlett/docker-demo:latest | ||
| ``` | ||
|
|
||
| To test locally, create an entry in `/etc/hosts` to the Node IP for | ||
| `demo.local`. An example entry is: | ||
|
|
||
| ``` | ||
| 10.10.0.150 demo.local | ||
| ``` | ||
|
|
||
| You should now be able to access `http://demo.local` and see the demo. | ||
|
|
||
| You can also now scale the service and see the new tasks show up in the demo: | ||
|
|
||
| ``` | ||
| docker service scale demo=6 | ||
| ``` | ||
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
Oops, something went wrong.
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.
According to moby/moby#24053
writable=trueis the default behavior and the flag has been removedThere 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.
Thanks. I'll re-vendor and update.
On Jul 31, 2016 05:51, "Luc Vieillescazes" [email protected] wrote: