Customize the app and redeploy

Estimated reading time: 2 minutes

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 those services, which we did not change.

New visualizer web page

Resources

chat icon Feedback? Suggestions? Can't find something in the docs?
Edit this page Request docs changes Get support
Rate this page: