Customize the app and redploy (Engine)

Customize the app and redeploy

In this step, we’ll make a simple change to the application and redeploy it. We’ll change the focus of the poll from Cats or Dogs to .NET or Java.

In the real world, you might do this by making code changes and rebuilding to create new images, or new versions of the same images.

For our example, we’ve done this for you. We already have a different version of the application available as built images. So, all you need to do is reconfigure docker-stack.yml to point to the new images, then redeploy.

Update docker-stack.yml to reference new images

Go back to docker-stack.yml and replace the before tags on both the vote and result images to reference after tags.

before tags for vote and result in yml

after tags for vote and result in yml

Redeploy

Run the same deploy command again to run the app with the new configuration.

docker stack deploy --compose-file docker-stack.yml vote

The output will look similar to this:

docker@manager:~$ docker stack deploy --compose-file docker-stack.yml vote
Updating service vote_redis (id: md73fohylg8q85aryz07852o0)
Updating service vote_db (id: gny9ieqxancnufrg1oeazz9gq)
Updating service vote_vote (id: 0ig0s4gb10q8auek9tris5i8z)
Updating service vote_result (id: lqwxjmmdhmegs2aw0a6ehipsp)
Updating service vote_worker (id: 8u4cfu60dtliz77x1o74kiwpr)
Updating service vote_visualizer (id: ya2vt9z2b4to248tccjjeqitw)

Try it out

Take the app for another test drive.

You’ll see the new voting choices for Java and .NET at <MANAGER-IP:>5000.

New voting page

And the related results at <MANAGER-IP:>5001.

New results page

The visualizer at <MANAGER-IP:>8080 will show some differences, such as updates to the containers, and some services might have moved between the manager and the worker.

However, the PostgreSQL container (vote_db) and the visualizer (vote_visualizer) will still be running on the manager because of the [node.role == manager] constraints on the those services, which we did not change.

New visualizer web page

Resources

© 2013–2016 Docker, Inc.
Licensed under the Apache License, Version 2.0.
Docker and the Docker logo are trademarks or registered trademarks of Docker, Inc. in the United States and/or other countries.
Docker, Inc. and other parties may also have trademark rights in other terms used herein.
https://docs.docker.com/engine/getstarted-voting-app/customize-app/

在线笔记
App下载
App下载

扫描二维码

下载编程狮App

公众号
微信公众号

编程狮公众号

意见反馈
返回顶部