Draw a Sequence Diagram

I got the code checked out, got secrets setup, and launched the local dev environment. The response in my browser was less than helpful: 502 Bad Gateway.

Trace of 502 Bad Gateway error with a sequence diagram. source

There were many moving parts in the docker-compose.yml. There were actually two docker-compose.yml files in play. One of my favorite tools for helping recover from mental stack overflow is drawing sequence diagrams. Drawing a sequence diagram takes time. It forces me to slow down, trace through the code or study the network tab in the web browser inspector. Slowing down in this way changes what I have in my head as I read the code. What's more, once I've drawn the diagram, I can share that picture with colleagues to drive discussion about what is actually happening.

In this specific case, tracing through the browser inspector's network tab and then following the details in the docker-compose.yml helped me find something really simple. I needed to build the database. But the process was not simple to discover that in this case "502 Bad Gateway" meant "create the dabase". The result is a helpful artifact for thinking through all the moving parts in the dev environment. Moreover, there's a technique that can be applied the next time there's a less than helpful error message.

.

Sequence Diagram editor

title SAML & local dev env actor Developer participant SAML fontawesome F109 "Localhost 3000" materialdesignicons F867 nginx fontawesome F109 "Localhost 5000" materialdesignicons F867 web materialdesignicons F867 pg linear Developer -> SAML:click "local dev env" SAML -> SAML:302 */sso/saml SAML ->"Localhost 3000":200 js\nPOST */saml/consume "Localhost 3000" -> nginx:proxy:3000 nginx ->"Localhost 5000":docker.for.mac.host.internal\n:5000 "Localhost 5000" -> web:engine\nweb :8080 web -> pg : select ... from users pg -> web : relation "users"\ndoes not exist web ->"Localhost 5000" : 500 Error "Localhost 5000" -> nginx : 500 Error nginx -> "Localhost 3000" : 502 Bad Gateway "Localhost 3000" -> Developer : 502 Bad Gateway