Skip to content
Ameen Abozaid
JNR-052

Deployment basics

  • 7 Lessons
  • 3 h practice (estimate)
On this page 8 topics

Overview

Topics

  • Executable JARs
  • container deployment
  • configuration
  • health checks

Learn first

3 h of practice (estimate)

Learning outcomes

  1. Deploy the containerized app and a managed PostgreSQL to a hosting platform or VM.
  2. Configure the deployment entirely through environment variables.
  3. Expose liveness and readiness health checks and explain the difference.
  4. Perform graceful shutdown and roll back to the previous image.

Lessons

  1. 01From artifact to running service
  2. 02Deployment targets compared
  3. 03Configuration in deployed environments
  4. 04Health checks: liveness vs readiness
  5. 05Graceful shutdown and rollback
  6. 06Demo: deploying Shop and its database
  7. 07Demo: rolling back a bad release

Lab and exercises

Lab

JNR-052-LAB1 · Shop goes live

Outcomes: 1–4 · Time: ~3 h Deploy from the pipeline to a public URL with a managed database, configured through environment variables, with probes and graceful shutdown; perform and document a rollback. Acceptance: deployed instance reachable; rollback under 5 minutes.

Exercises (assessment: deployment walkthrough)

IDOutcomeTask
JNR-052-EX011Compare VM, PaaS, and managed containers for Shop on cost, control, and effort; recommend one.
JNR-052-EX021Write the numbered steps from "merge to main" to "live URL".
JNR-052-EX032Convert a application-prod.yml with a database password into environment-variable configuration.
JNR-052-EX043Enable liveness and readiness probes and show both endpoints' responses.
JNR-052-EX053Explain why liveness should not call the database, using a database-outage scenario.
JNR-052-EX064Enable graceful shutdown and prove an in-flight request finishes during a stop.
JNR-052-EX074Write a five-step rollback runbook with expected timing.
Show solutions
  • EX01 For example: VM is cheapest but needs patching and setup; PaaS is fastest to start; recommend a PaaS for a first deployment. Verify current prices.
  • EX02 Merge, CI passes, image pushed with SHA tag, deploy job updates the service, health check passes, URL serves traffic.
  • EX03 Remove the password; set SPRING_DATASOURCE_PASSWORD in the platform secret store; keep only non-secret defaults in the file.
  • EX04 management.endpoint.health.probes.enabled=true; /actuator/health/liveness and /actuator/health/readiness return {"status":"UP"} (verify for your Boot version).
  • EX05 If the database goes down, liveness failing restarts every instance, causing restart loops and extra load; readiness failing only removes traffic until it recovers.
  • EX06 server.shutdown=graceful and a shutdown timeout; start a slow request, send SIGTERM, and see the response complete before exit.
  • EX07 Identify the bad release; find the previous tag; redeploy it; verify health; record the time; communicate the result.
  • Common mistakes (credentials in the image) are checked in the walkthrough assessment.

Quiz

Outcomes: O1 deploying the app and database · O2 environment configuration · O3 liveness and readiness · O4 graceful shutdown and rollback.

A self-check for you: nothing is graded, saved or sent anywhere. Choose an answer, then check it. You can try again as often as you like.

  1. 1The easiest first deployment target is usually a:O1
  2. 2Between environments you should keep the same:O1
  3. 3Where should database credentials live?O2
  4. 4SPRING_DATASOURCE_URL maps to:O2
  5. 5Readiness answers:O3
  6. 6Liveness answers:O3
  7. 7A liveness probe that calls the database can cause:O3
  8. 8Graceful shutdown means the app:O4
  9. 9The quickest rollback is:O4
  10. 10Why keep old image tags?O4

Practical part

Seven exercises JNR-052-EX01 to EX07 plus the lab; the assessment is a deployment walkthrough. Pass: quiz 8/10, at least five exercises correct, deployed instance reachable, and a documented rollback under 5 minutes.

Common mistakes

Database credentials in the image; health checks that call the database for liveness.

Assessment

Deployment walkthrough.

Career relevance

Kubernetes (MID-057) and production readiness (SRC-011).

Type to search levels, phases, modules and lessons.