Episode 5 — Who Gets to Flip the Switch
Week 3. "The artifact is sitting in the registry. Somebody still has to actually run it. Who, and how?" Previously Developer ↓ Runner ↓ Cache ↓ Artifact Today ↓ Deployment Junior Engineer: So the image is built, tagged, sitting in the registry. What's the simplest possible way to actually get it running in production? Senior Engineer: The simplest way is also the most dangerous way. Want to guess…
In the 5th episode of the series, the discussion revolves around the challenge of deploying new software versions to production without causing downtime or issues for users. The junior engineer proposes a simple solution: stop the old container and start the new one, but the senior engineer warns that this approach can lead to a critical gap of downtime where no container is running.
This gap can result in failed requests and negatively impact the user experience, especially for services like a payment API where downtime directly translates to financial loss and user dissatisfaction.
The senior engineer introduces the concept of "overlap" as a safer deployment strategy, suggesting that both the old and new versions of the software can run simultaneously, allowing for a smooth transition without downtime. Two popular deployment strategies mentioned are blue-green deployment and rolling deployment. Blue-green deployment involves maintaining two identical production environments, with one (Blue) serving live traffic and the other (Green) idle.
The new version is deployed to the Green environment, which is then switched to production, instantly redirecting all traffic from Blue to Green. If issues arise, the switch can be quickly reverted back to Blue.
Rolling deployment, on the other hand, gradually replaces instances of the old version with new ones in a controlled manner. For example, in a setup where multiple instances of an app are running behind a load balancer, instances are replaced one at a time, ensuring that some requests are served by the old version while others are served by the new version.
This method allows for monitoring and verification of the new version's performance and stability before fully transitioning to it. Both blue-green and rolling deployments require that the old and new versions can coexist safely, meaning they must handle data and operations in a compatible manner to avoid conflicts.
The senior engineer emphasizes the importance of ensuring that both versions can operate together without issues, as any discrepancies can cause unexpected behavior and errors during the deployment process. The episode highlights the trade-offs between different deployment strategies, balancing the need for simplicity and cost with the potential risks to application stability and user experience.
Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.