Lab: put hello-web on the internet

Verified lab · 20 min · Module 1, lesson 4 of 420 min left in this module

Module 1 · Your first deployLesson 4 of 4

Self-checked for now. Automatic checking arrives with sign-in; until then, tick off each item under Check your work yourself.

Goal: Deploy a web service with a health check, and prove it's live on its public URL.

You need csph pointed at your learn project and lab environment, from lesson 5.1.1.

What's a health check?

A health check is an address in your app that ComputeSphere calls to ask “are you working?”. A new version only gets traffic once it answers with success. The sample app answers on /healthz.

  1. Deploy hello-web

    csph deploy --image quay.io/computesphere/learn-hello-web:1.0.0 --name hello-web --port 8080
    

    Flex and 1 spherelet are the defaults.

    Already deployed it in lesson 5.1.2? Skip to step 2.

    You should seeRunning, and your URL.

  2. Add the health check

    In the console, open hello-web and go to Settings. Under Health check, choose Add health check, then set Endpoint path /healthz, Port 8080, Initial delay 5 and Check interval 10. Choose Save.

    You should seeThe Health check card shows Path /healthz and Port 8080.

  3. Redeploy so it applies

    The console asks Redeploy to apply changes? Choose Redeploy now. A health check only applies to deployments started after it's saved.

    You should seeThe status goes Redeploying, then back to Running.

  4. Open your URL

    curl -I https://<your-hello-web-url>
    

    You should seeHTTP/2 200, and the page in your browser.

Check your work

  • If this doesn't pass

    The name must be exactly hello-web, deployed into lab. Run csph context to check where csph deploys.

  • If this doesn't pass

    Open the Deploy log on the service's Logs tab. A wrong port is the usual cause.

  • If this doesn't pass

    If it's Running but the URL doesn't answer, wait a minute: a brand-new address can take a moment to appear.

  • If this doesn't pass

    The health check is saved but the running deployment is older. Choose Redeploy on hello-web.

In the docs