You need csph signed in, with learn and lab as your defaults (lesson 5.1.1), and curl.
Room on your account
Each case is a new service, shop-case-1 to shop-case-5, so none of them touches your other services. A trial account runs two Flex spherelets in total, so do the cases one at a time and delete each before the next. If a deploy is refused for capacity, stop or delete another service first.
Download the five cases
mkdir broken-deploys && cd broken-deploys curl -fsSLO "https://raw.githubusercontent.com/computesphere-samples/learn/main/labs/shop-api/broken/case-[1-5].yaml" lsEach file deploys the shop sample with one thing wrong. Don't read them yet: find the fault the way you would in production.
You should seecase-1.yaml to case-5.yaml in a new folder.
Read the evidence for case 1
csph deploy --file case-1.yaml --no-wait--no-waitreturns at once. Wait about two minutes for it to fail, then read the logs (csph lists the newest deploy event first):csph logs shop-case-1 --kind deploy csph logs shop-case-1Follow the order from lesson 6.5.1: status (on its page in the console), deploy log, runtime log, then the config in the file. Name the fault.
You should seethe deploy log shows Unhealthy, and the runtime log ends with listening.
Fix it with a fresh start, then clean up
A port change doesn't reach the URL of a service that already exists. So delete the broken service, fix the file, and deploy it again: a new service gets everything in the file.
csph services list csph services delete <shop-case-1-service-id> csph services list -o json csph deploy --file case-1.yamlOnce it answers, delete
shop-case-1the same way and check the JSON list. Clean up after every case, so the next one has room.You should seeshop-case-1 comes back Running and its URL answers; after the last delete, it isn't in the JSON list.
Case 2
Same evidence loop, with
case-2.yaml,--no-waitandshop-case-2. The fix is a secret, set on the running service, as in lesson 5.4.3:csph services secrets set <KEY>=demo-not-a-real-key-0000 --service <service-id>Setting it redeploys the service.
You should seeRestarting repeatedly in the deploy log, and a fatal line in the runtime log.
Case 3
Same loop, with
case-3.yaml. When you know which variable is to blame, delete its line from the file and deploy again; a variable the file no longer lists is removed:csph deploy --file case-3.yamlYou should seeThe runtime log stops partway through starting, and the deploy log names the reason.
Case 4
csph deploy --file case-4.yaml --no-waitRead the error. It still leaves an empty
shop-case-4service: fix the file and deploy it again, and the service gets its first version.You should seeAn error straight away. Nothing starts, so there are no logs.
Case 5
Deploy
case-5.yamland look. Fix the file and deploy it again.You should seeUnhealthy in the deploy log, and requests answered 404 in the runtime log.
Answers (try first)
- Wrong port. The service's port is 3000; the app listens on 8080. Delete the service, set
port: 8080, and deploy the file again. - Crash loop. The
fatalline namesSIGNING_KEY, and the deploy log says Restarting repeatedly. Set theSIGNING_KEYsecret; that redeploys it. - Out of memory.
CACHE_MB: "900"asks for 900 MB on a 512 MB Flex spherelet. The log stops afterwarming the product cache. Delete theCACHE_MBline and deploy the file again. - Image can't be used. Tag
1.0.9doesn't exist. Use the tag the other cases use, and deploy the file again. - Bad config. The health check is on
/health, which answers 404. Sethealth_check_path: /healthzand deploy the file again.
Check yourself