Docker.github.io: Managing apps with Compose V3 docs needed

Created on 4 Jan 2017  路  7Comments  路  Source: docker/docker.github.io

Topic list

In Compose docs:

  • [ ] What's new in V3 Compose Files and how to update
  • [x] Ideally, have V2 file ref available for legacy users -- tabs and engine/binary/file spec matrices would be nice so it's all in one place and has good SEO/discoverability for users.

In top-level docs, under "Create and manage an application"

  • [x] Walkthrough: Create an application. Set up swarm (machine/boot2docker using v1.13 with at least one master and one worker), then deploy voting app on swarm.
  • [x] Walkthrough: Updating and taking down an application
  • [ ] Set up healthcheck for your application (use new healthcheck option)

Resources for app creation

Essentially what's new is the deploy: key in Compose, which is now where resource constraints and deploy/swarm stuff lives for each service.

One wrinkle: You can't have a deploy: key on a service whose image is being built in that compose file; you can only deploy pre-built images, so you'd need to use docker-compose build with a YAML file or docker build with a long command line first, then deploy the resulting image.

Because this is all done with docker stack * (the Engine CLI) we should avoid referring to the docker-compose binary in these docs; it's not really necessary.

Machine command for creating a node w/v1.13:

docker-machine create -d virtualbox --virtualbox-memory 5000 --virtualbox-disk-size 8000 --virtualbox-boot2docker-url "https://github.com/boot2docker/boot2docker/releases/download/v1.13.0-rc4/boot2docker.iso" my-machine

Better yet, use this zero-to-swarm-in-10-seconds script from @thaJeztah:
https://gist.github.com/thaJeztah/90d92e2114287144990b503efd952a3a

Example voting app: posts data to a redis queue, worker app pulls data out of redis and puts it into postgresql.
https://gist.github.com/ManoMarks/39748aa1931f592303bd111c3d3dfed4#file-docker-compose-yml

Docs for V2-based voting app:
https://github.com/docker/labs/blob/master/beginner/chapters/votingapp.md

Docker stack refdocs:
https://docker-docs-vnext-engine.netlify.com/engine/reference/commandline/stack/ (autogen)

To run app on a swarm, use that V3 file with this command:

docker stack deploy --compose-file (file) (stackname)

Resources for app update/delete

docker stack remove (stackname) takes down an application.

To update an app, docker stack deploy w/same stack name, which re-reads YAML and updates service. That's it! Live stacks are hot-swappable, if you just reuse the stack name. For example, you can kill a single service and bring it back:

docker service rm stack_service #take down a portion of an app.
docker service ls #shows service is stopped
docker stack deploy --compose-file etc #update
docker service ls #shows service is back

Most helpful comment

@johndmulhausen @ManoMarks @thaJeztah I'm closing this issue, as I believe it's been addressed by these new and revised topics:

Feel free to re-open if you think we missed anything in John's original list of what needs to be covered

All 7 comments

@docker/core-compose-maintainers Anything else we should cover? @shin-?

In addition to deploy, aren't these also new in Compose file format v.3?

  • healthcheck

Unsupported or removed from v3

  • volume_driver not supported in v3, use top-level volumes option
  • volumes_fromremoved from v3, use top-level volumes option to share a volume between services
  • various resource constraint options removed from v3 (cpu_shares, cpu_quota, cpuset, mem_limit, memswap_limit), use deploy.resources instead

Also stop_grace_period was added

^ All great things to add to the "What's new in V3 / upgrade" topics!

Except for healthcheck, which should get a separate topic, to be honest; load balancing breaks without it. Adding it to the topic list.

To walkthrough the sample:

  • run docker swarm init
  • run sh create-a-swarm.sh (from @thaJeztah)
  • run docker stack deploy --compose-file FILE.yaml STACKNAME (where FILE.yaml is Manos' V3 example, and STACKNAME is an arbitrary string)

First draft of lab change (still need to change the title and some navigation)
https://github.com/ManoMarks/labs/blob/master/beginner/chapters/votingapp.md

@johndmulhausen @ManoMarks @thaJeztah I'm closing this issue, as I believe it's been addressed by these new and revised topics:

Feel free to re-open if you think we missed anything in John's original list of what needs to be covered

Was this page helpful?
0 / 5 - 0 ratings