Skip to content

Comments

First version of stack deployment tutorial#685

Merged
mdlinville merged 1 commit intodocker:vnext-enginefrom
aanand:deploy-composefile
Nov 28, 2016
Merged

First version of stack deployment tutorial#685
mdlinville merged 1 commit intodocker:vnext-enginefrom
aanand:deploy-composefile

Conversation

@aanand
Copy link
Contributor

@aanand aanand commented Nov 22, 2016

Based on @vdemeester's work in #672

To try this tutorial out, you need a 1.13 daemon, a 1.13 client and a master build of Compose.

Copy link
Contributor

@dnephin dnephin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, few comments about the commands and typo

---

When running Docker Engine in swarm mode, you can use `docker stack deploy`
(or just `docker deploy`) to deploy a complete application stack to the swarm.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're planning on keeping docker deploy experimental in 1.13 so that we can change it later if we need to. We might want to avoid calling it out here since it won't be available to everyone like docker stack deploy.

The `deploy` command accepts a stack description in the form of a [Compose
file](/compose/compose-file.md).

The `docker deploy` command supports any Compose file of version "3.0" or
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

docker stack deploy

Compose doesn't take advantage of swarm mode, and deploys everything to a
single node. You can safely ignore this.

<!-- TODO: this warning needs to be updated for `docker deploy` -->
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is done: docker/compose#4170 (needs merged)

Unless you mean something else


1. Create the stack with `docker deploy`:

$ docker deploy --compose-file docker-compose.yml stackdemo
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

docker stack deploy

The last argument is a name for the stack. Each network, volume and service
name is prefixed with the stack name.

2. Check that it's running with `docker service ls`:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

docker stack services stackdemo might be more appropriate here?

Removing service stackdemo_redis
Removing network stackdemo_default

4. Bring the registry down ith `docker service rm`:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/ith/with/

@aanand aanand force-pushed the deploy-composefile branch from 0ca615c to 5010fdb Compare November 22, 2016 17:11
@aanand
Copy link
Contributor Author

aanand commented Nov 22, 2016

@dnephin Thanks! Addressed.

@aanand aanand force-pushed the deploy-composefile branch from 5010fdb to a6ff281 Compare November 22, 2016 17:14
Copy link
Contributor

@dnephin dnephin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@mdlinville mdlinville changed the base branch from master to vnext-engine November 22, 2016 23:20
@mdlinville
Copy link

Oops, please rebase your work on vnext-engine branch since it requires 1.13.

@mdlinville mdlinville changed the base branch from vnext-engine to master November 22, 2016 23:21
@mdlinville mdlinville added this to the engine/1.13.0 milestone Nov 22, 2016
a stack description in the form of a [Compose file](/compose/compose-file.md).

The `docker stack deploy` command supports any Compose file of version "3.0" or
above. If you have an older version, upgrading is simple - see the

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's not editorialize about how simple it is. :) Something like "If you have an older version, see ."

Because a swarm consists of multiple Docker Engines, a registry is required to
distribute images to all of them. You can use the
[Docker Hub](https://hub.docker.com), or maintain your own, but for the purposes
of this tutorial it's sufficient to create a throwaway registry.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

change "it's sufficient to create a throwaway registry" to something like "This tutorials creates a simple registry, which you can discard afterward."


$ docker service create --name registry --publish 5000:5000 registry:2

2. Check its status with `docker service ls`:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check the status of the registry

of this tutorial it's sufficient to create a throwaway registry.

1. Start the registry as a service on your swarm:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use fenced code blocks instead of relying on indentation.

2. Check its status with `docker service ls`:

$ docker service ls
ID NAME REPLICAS IMAGE COMMAND

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As above, fenced code blocks. Please separate the command input from the output with a carriage return.


2. Create a file called `app.py` in the project directory and paste this in:

from flask import Flask

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When you change this to a fenced version, use Dockerfile as the highlighter.

```Dockerfile
From flask import Flask

RUN pip install -r requirements.txt
CMD ["python", "app.py"]

5. Finally, create a file called `docker-compose.yml` and paste this in:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/Finally,//


5. Finally, create a file called `docker-compose.yml` and paste this in:

version: '3'

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use fences for this code block and designate it as yaml in the highlighter.

Creating stackdemo_redis_1
Creating stackdemo_web_1

2. Check that it's running with `docker-compose ps`:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Check that the app is running...

@aanand aanand force-pushed the deploy-composefile branch from a6ff281 to c5fa76e Compare November 23, 2016 11:12
@aanand
Copy link
Contributor Author

aanand commented Nov 23, 2016

Rebased on vnext-engine and addressed @mstanleyjones' comments. I don't have permission to view the build result, so I don't know why it's failing, sorry!

@aanand
Copy link
Contributor Author

aanand commented Nov 23, 2016

By the way, this tutorial also depends on Compose version 1.10, which isn't out yet. I don't know if that affects what branch it should be rebased on.

@mdlinville
Copy link

yeah, sorry that you can't see the Netlify build failure logs. Netlify is working to make this feature available. I'll have a look and let you know what's going on.

We should probably add a milestone for Compose 1.10 and tag this into that milestone as well. As far as the branches, there is a vnext-compose but let's keep it in vnext-engine for now, and we can work onto getting it into all the places it needs to go.

cc/ @londoncalling can you please create the milestone and tag this into it?

@mdlinville mdlinville changed the base branch from master to vnext-engine November 23, 2016 18:56
@mdlinville
Copy link

Also the Netlify check doesn't apply to vnext-engine branch right now, so ignore its failure. I had to change the base in the pull request in Github too (the Edit button next to the PR title). Now it is correctly only showing one commit in the PR.

Copy link

@mdlinville mdlinville left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking great! Just a few style-related tweaks for highlighting, and then this is ready. Thanks!


1. Start the registry as a service on your swarm:

```

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add the bash highlighter after the fence. like this:

```bash

Also add it to the other codeblocks that are terminal commands. There are lots of other highlighters such as markdown, dockerfile, json, yaml, go, etc.


3. Create a file called `requirements.txt` and paste these two lines in:

```

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For this one you can use the none highlighter.

@aanand aanand force-pushed the deploy-composefile branch from c5fa76e to da3b4ff Compare November 25, 2016 10:41
@aanand
Copy link
Contributor Author

aanand commented Nov 25, 2016

Tagged all the code blocks with the appropriate highlighter, per @mstanleyjones' advice

Copy link

@mdlinville mdlinville left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great! Thanks for this.

@mdlinville mdlinville merged commit 2bd57a4 into docker:vnext-engine Nov 28, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants