so many things to try No images? Click here Unpacking Elixir - PhoenixIn my series Unpacking Elixir I try to demystify and explain Erlang, BEAM and Elixir things without getting too into the code where it isn't relevant. This is the Phoenix one and I hope it will find you well. If you are curious or know people that are I think you could find worse explainers. Blog post: Unpacking Elixir - Phoenix Zero downtime Postgres upgradesThis was a cool conversation with Brent Anderson at Knock about a migration they did, jumping from Postgres 11 to 15 without downtime. Lots of consideration of trade-offs and tolerances. Some good BEAM and OTP in there. Podcast episode: BEAM Radio, epsiode 69 (nice) No more business!I cannot handle more inbound client work. Calm down :D No but seriously, from having had a quiet start of the year and needing to find work I suddenly have a small glut where I can't take on more right this month or two. Assuming everything that hands have been shook about comes to pass. If you are concerned about the market for Elixir work, this is a blip on the positive side of the radar. No idea about the trendline yet. Relevance of FundamentalsWhen digging around how I could do cool deployments with Elixir and pet servers as I am occasionally a cloud-skeptic I have run into things I bet most people never even think about. Options we don't consider available and might not have realized exist. Have you ever attempted to start a dev server and gotten some weird error complaint about the port? The dev server can't start because another instance is already running actually? I do it all the time. This is not a good solution to that but it will prevent that scenario.. Consider your dev.exs and adding this:
I assume I found this code here though I apparently didn't keep notes in my sample project. This will let your latest started dev server take over the port. Not typically desirable in the development but quite interesting in a deployment where you don't recycle the entire server on every software update. Essentially you are starting the new server, it will start receiving new traffic. Existing connections should still work and you would need to do whatever approach to draining/shutting down of those when you are happy that the new deploy is up. If the new deploy falls over the old version is still there. Listening. I don't know the incantations to do this on Windows, there might be ways. It generally only matters on the end deployment target but you can try it locally on Mac and Linux with the above code. This stuff is possible to leverage in a container world I imagine but I bet it can be tricky. And the more abstraction the harder it is. But if you have a server and you just want to start a new instance, this is very cool. I am not the best at figuring out Linux socket options and such, there may be something here that ensures the old service is not getting new traffic. It isn't in my tests. But I know SO_REUSEPORT can offer fair distribution of datagrams to the participating listeners. Not quite what I wanted and I don't know if there is a bit flipped to control that behavior. Need to read more. Or someone reading can just tell me which is rad. You can read background on when this came to Linux here. Another example of knowing the tools and using what is already provided. This is Linux and UNIX functionality. It is there for you. If you have questions or comments they are very welcome in response here to lars@underjord.io or you can find me as @lawik@fosstodon.org on the fediverse. Thanks for reading, I appreciate it. |