Deployment: fat jars and twelve-factor habits
Containers are packaging; discipline is the system
java -jar app.jar starts an embedded Tomcat and wires the whole app. Packaging it in a container does not change the rules — it standardizes them. The twelve-factor habits that mattered on a bare VM still matter: externalized config, stateless processes, disposable instances, graceful shutdown, and immutable builds.
- Build once; promote the same artifact through environments.
- Expose health and readiness probes (Actuator
/actuator/health). - Handle
SIGTERMwith a graceful shutdown grace period so in-flight requests finish. - Log to stdout; let the platform aggregate.
Takeaways
- Treat each deploy as immutable — roll forward, don't patch in place.
- Externalize config; the binary is the same everywhere.
- Graceful shutdown and readiness probes are not optional in production.
Enjoying This Lesson?
Your support helps create more comprehensive courses and lessons like this one. Help me build better learning experiences for everyone.
Support Awashyak