Richard Bucker

how to pick a docker stack name?

Posted at — Sep 12, 2019

I’m working on a very small project that is meant to demonstrate a small web application (not a service) so I can get all the moving parts together and at some point I might be able to script project scaffolding creation. But one thing I have been facing is that the target URLs lose meaning/context; there is still plenty of manual cleanup; while I liked the k8s mode of using the uuid or branch name to deploy a dev instance there is a bunch of leftover topic.This is a docker swarm¬†installation. There are analogs with k8s but the swarm is easier to deploy regardless of the fact that k8s is integrated. That’s simply for another day. So now there are a bunch of things that need names:domainstackservice(s)urlA quick search to review the docker docs did not turn up anything interesting. My definition of a docker stack is analogous to docker-compose¬†because they use similar config files. The purpose of a docker compose is to link and name a set of services. For example an application server and a database server for storing it’s data. The docker-compose file describes the services with the outside world and with each other. A comic book inventory application might be connected to a comic book database but not connected to a newspaper database. The composition file provides some ephemeral connectivity.production requests stay in production and staging requests stay in staging.Given the 4 names above it’s also important to note that there are multiple states to consider… dev, branch, staging, production… and maybe a few more. When you create the cross product from the two lists the number of names explodes and frankly requires some care. Especially when you might only have one domain or if you have multiple projects… in fact this is one of the shortcomings of traefik and micro services.One nice thing about the gitlab+k8s design is that it simply uses a uuid and the rest is up to the user and the subsequent compose file. But then what about the other names?But then it falls apart again…