Learning paths / Operate your application / Backups and availability

Lab: back up and restore

Verified lab · 25 min · Module 8, lesson 4 of 530 min left in this module

Module 8 · Backups and availabilityLesson 4 of 5

Preview. Volumes and snapshots are being fixed on the platform, so the restore in step 5 doesn't bring the note back yet. Read it through now; the lab opens when a restore passes end to end.

Goal: Snapshot a service's volume, change the data, restore the snapshot, and read the first value back.

You need notes Running with the notes-data volume mounted at /data, from lab 5.5.4.

Haven't done lab 5.5.4?

Do it first: it deploys the notes app, creates the volume and mounts it. The notes app keeps one note in /data/note.txt: POST /note saves the request body, GET /note returns it. Keep notes at 1 spherelet.

  1. Save the value to keep

    curl -X POST --data "before snapshot" https://<your-notes-url>/note
    curl https://<your-notes-url>/note
    

    You should seeNo error from curl, and the second command prints your note.

  2. Take a snapshot

    Open notes, then the Backups tab, and choose Back up now.

    You should seeA new row that turns from PENDING to COMPLETED.

  3. Change the data

    curl -X POST --data "after snapshot" https://<your-notes-url>/note
    curl https://<your-notes-url>/note
    

    This is the mistake you're about to undo.

    You should seeafter snapshot

  4. Wait two minutes

    A snapshot can't be restored until it's two minutes old.

    Check yourself

    If you restored an hour from now, what would happen to notes saved in that hour?

    You should seeThe snapshot is at least two minutes old.

  5. Restore the snapshot

    On the snapshot's row choose Restore. Set Restore to to Same service and environment and choose Restore. View logs shows the restore's progress.

    You should seenotes shows Redeploying, then Running.

  6. Read the first value back

    curl https://<your-notes-url>/note
    

    You should seebefore snapshot

Check your work

  • If this doesn't pass

    If it stays PENDING or shows FAILED, take another with Backup Now and wait for COMPLETED before going on.

  • If this doesn't pass

    Refused? The snapshot was under two minutes old. Wait and restore again.

  • If this doesn't pass

    Still after snapshot? Check you restored the snapshot from step 2, not a newer one. Empty? Check notes-data is still mounted at /data under Settings, Storage.

In the docs