LessonsHow to undo a broken website deployment

Mini lesson 28 of 30 · Run and maintain your website

Choose the known working version

Who is this for?

People who want a calm way to recover a broken publication. You can use the host’s release controls and a coding assistant; deployment scripting is optional.

A previous release is useful only if it did the intended task.

Purpose of this lesson

  • Choose a verified working release.
  • Restore it through the hosting tools.
  • Check the visitor task and prevent an immediate repeat.
Explanation, worked example and practice

Before you start

Your own new, disposable hosting project and the supplied working/broken pages. You will first publish working R1, then deliberately publish broken R2 only on that practice site. A coding assistant can guide the hosting steps; do not use a real user-facing service for this rehearsal.

Check your starting skills

These are useful skills, not locked course requirements. If you can already do them, start this lesson; otherwise open the linked preparation. The supplied starter files mean you do not need an existing personal website.

  1. How to publish your website from GitHub

    Connect a practice repository to hosting.

Estimated time: 19–31 min

Estimates for the supplied starter files with prerequisite accounts and tools ready. Setup, deployment queues and delivery/DNS waits take additional time. Host controls vary. Rolling back static code does not undo database changes, sent email, payments or secret exposure.

Understand the idea

Ask your assistant to publish working/public as R1 on a new disposable practice site. Open its public URL, read the R1 marker and activate “Find contact information”. Save the deploy or revision identifier whose link reaches the Contact section.

Only on this same disposable site, publish broken/public as R2. Repeat the action: R2 points to a missing target. Keep the failed R2 identifier beside the known-working R1 identifier. Now there is an actual practice failure and a specific recovery candidate.

A concrete example

The supplied R1 link targets #contact, which exists. R2 instead targets #contact-missing. An older timestamp is not what makes R1 suitable; the Contact task works there.

Use only my new disposable practice hosting project. Publish the supplied working/public version as R1 and help me verify its contact action and save its deploy identifier. After I confirm the practice target, publish broken/public as R2 only there and reproduce the contact-target failure. Then help restore the identified R1 artifact through the host, retest the same action and prevent broken R2 source from immediately redeploying. Do not touch another site, real user data or production service.

Files for this step

Start hereWorkshop files

Open or download the files below. When saving a project, keep the folder paths shown in the filenames.

Try it yourself

After the R1/R2 practice publication, which exact release should you restore, and what makes it a suitable candidate?

Show a worked solution

I would restore the R1 deploy identifier recorded on the disposable host. Its Contact link reaches the existing section, while the supplied R2 link points to #contact-missing. That task comparison makes R1 the recovery candidate; merely being older would not.

What a sound answer includes

  • Identifies the saved R1 deploy/revision rather than any arbitrary older release.
  • Uses the successful Contact task on R1 and reproduced failure on R2 as the reason.
How it works (optional)

Undo a broken deployment without guessing

Restore the version that actually passed the affected visitor task.

Recovery starts with the user's failure, not with a vague desire to return to an older date. The workshop breaks a contact anchor in R2 while R1 contains the correct target.

A host may let you republish a previous built deploy quickly. That restores its code artifact, while the Git branch may still contain the broken source. Treat immediate recovery and permanent repair as separate actions.

Worked example

R2's page can load with status 200 while its contact action fails. A health check that only opens the homepage would miss the incident.

Extra implementation exercise

Which evidence makes R1 a suitable rollback candidate?

Show a worked solution

It is the known deploy whose contact task works, with an identified artifact/revision. “Older” alone is not evidence that a version is suitable.

  • Checks the specific failed task on R1.
  • Identifies its exact deployed revision.

Step 1 · How to undo a broken website deployment

Restore in the practice host

Use the control for the intended disposable site.

Explanation, worked example and practice

Understand the idea

Confirm the disposable project name and failed R2 marker with your assistant. In that host’s deploy history, select the saved R1 artifact and use its supported restore or republish control. This operation changes the practice site, not the repository’s source history.

After the host completes the action, open the actual public practice URL again. Check the R1 marker and repeat “Find contact information”; a host success badge alone does not tell you that your browser is testing the right site.

A concrete example

If the host reports R1 but the public address still shows R2, compare the project, URL and deployed artifact before declaring recovery complete.

Files for this step

Start hereWorkshop files

Open or download the files below. When saving a project, keep the folder paths shown in the filenames.

Try it yourself

Which version did the host restore, and what did the public address show afterward?

Show a worked solution

Illustrative recovery result: I selected the saved R1 deploy on the disposable project; its public URL now shows Version R1 and “Find contact information” reaches Contact. If that URL still showed R2, the recovery would remain unresolved regardless of the host badge.

What a sound answer includes

  • Names the selected R1 artifact and confirms the disposable project target.
  • Checks the public R1 marker and the formerly failing contact action after restoration.
How it works (optional)

Rehearse rollback in a disposable project

Use deploy history to publish the known working artifact.

Follow START-HERE.txt only on your practice host. Record R1, release the intentional R2 fault and reproduce the broken contact task. Then locate R1 in deploy history and use the host's publish/rollback action.

Inspect the resulting public URL and version marker after the action completes. Hosting interfaces and permissions differ; consult the current host guide rather than relying on an old button position.

Worked example

The public page must now show R1 and the contact link must reach the actual contact section. The dashboard action alone is not the completed recovery check.

Netlify: manage deploys and rollbacks

Extra implementation exercise

The dashboard says the previous deploy was published. What should you check next?

Show a worked solution

Confirm the public artifact/version and repeat the contact action. Record the result rather than assuming a successful control-plane action proves user recovery.

  • Opens the actual public URL/version.
  • Repeats the previously failing task.

Step 2 · How to undo a broken website deployment

Prevent the same failure returning

Recovery and fixing the next publication are separate jobs.

Explanation, worked example and practice

Understand the idea

Repeat the Contact task on restored R1. Then ask the assistant to inspect the repository copy: the broken R2 link may still be there even though the host is serving the older working artifact.

Have the assistant repair the bad contact target in the repository and review the small change before a later publication. Keep automatic publication of the still-broken source under control using your host’s available workflow; do not assume restoring an artifact rewrites Git.

A concrete example

The permanent correction makes the link target match the existing Contact section again. It is a separate source change from republishing the already-built R1 artifact.

Files for this step

Start hereWorkshop files

Open or download the files below. When saving a project, keep the folder paths shown in the filenames.

Try it yourself

What made the visitor task work again, and what prevents the broken version from returning?

Show a worked solution

Republishing the R1 artifact restored the working Contact task. To prevent recurrence, I would have the assistant change the repository’s #contact-missing target back to #contact, inspect that small diff and review its next preview before allowing another publication. The host rollback alone does not repair that source.

What a sound answer includes

  • Separates immediate host restoration from repairing the broken repository source.
  • Names how the next publication will avoid reintroducing the R2 contact failure.
How it works (optional)

Repair the source and assess remaining effects

Prevent the next automatic build from restoring the same bug.

The production branch may still have the R2 code. Repair it in a reviewed source change and control automatic publication during recovery as your host supports. Otherwise the next deploy may reintroduce the fault.

Code rollback does not recover deleted records or undo messages/charges. A database schema change may also make old code incompatible. Investigate those effects separately before applying a rollback to a real stateful app.

Imagine R2 removes a database column while R1 still reads it. Republishing R1's old code will not recreate the column, so a code rollback may still fail. Check state/schema compatibility first. For this static exercise the repair is smaller: change href='#contact-missing' back to href='#contact', review the diff and verify the repaired branch before future automatic publication.

The database example explains a limit of rollback in a stateful app; this workshop itself changes only static files and asks for no database actions. If you are learning alone, perform the runbook from a fresh browser window and read it as instructions for someone who did not write the change.

Worked example

Restoring an old form page cannot unsend email already delivered by the newer version. If credentials leaked, rollback alone also does not revoke them.

Extra implementation exercise

A rollback restores the page, but the broken commit remains on the production branch. What risk remains?

Show a worked solution

A later build can publish the bug again. Fix or revert the source through the normal review process and verify the resulting release before restoring unattended deployment.

  • Anticipates automatic redeployment of the bad source.
  • Plans a source repair and verification.

Step 3 · How to undo a broken website deployment

Write the recovery handoff

Make the next incident easier to understand.

Explanation, worked example and practice

Understand the idea

Complete recovery-record.txt with the failed R2 task, the saved R1 deploy identifier, the host restoration and the public Contact retest. Add the repository correction or the exact next step still needed.

This rehearsal restores static website code. It does not undo database changes, sent email, charges or exposed keys; those would need their own recovery action in a real incident.

A concrete example

A compact recovery story is: R2’s target was missing → republished known-working R1 → public R1 Contact worked → repaired and reviewed the source before the next release.

Files for this step

Start hereWorkshop files

Open or download the files below. When saving a project, keep the folder paths shown in the filenames.

Try it yourself

Provide the recovery record and actual restored-task check.

What to produce: A recovery record with the restored version, actual task result and prevention step.

Show a worked solution

Illustrative record: R2 displayed normally but its Contact target was absent. I restored the recorded R1 artifact on the disposable host and the public Contact task worked again. The repository target still needed correction and preview review before another publication. No database, mail or payment recovery was part of this static rehearsal.

What a sound answer includes

  • Connects the failed R2 version, restored R1 artifact and actual public task retest.
  • Includes recurrence prevention and distinguishes code rollback from data or external side effects.
How it works (optional)

Your assignment: write and prove a short recovery runbook

Make the next recovery executable by someone who did not write the change.

Complete the recovery record with exact deploy/source identifiers, the failed task, rollback action and user-visible check. Include the source repair and any state outside rollback scope.

Have another person follow the written steps against the disposable site or walk through them from a fresh browser. Remove assumptions such as “click the old one” that only make sense to you.

Worked example

A useful runbook says which version to choose and how to tell recovery worked. A list of dashboard clicks without a task check is fragile.

The complete reference walkthrough is available in reference/assignment-walkthrough.txt. Compare its steps with your own result; fill the test record from observations in your own project.

Extra implementation exercise

Produce a recovery record that restores the test task and prevents immediate recurrence.

Show a worked solution

On the disposable site, reproduce the R2 contact failure and record its deploy ID/commit. In deploy history, locate the known working R1 record, inspect its artifact/revision and choose the provider's publish/rollback control for that record.

Open the actual public URL, read R1 and repeat the contact action. Then repair the broken source by restoring href='#contact'; review/commit that change before allowing later automatic publication.

Keep code restoration separate from data recovery. If a newer version removed a column required by old code, republishing old HTML/JS will not recreate it. The reference incident record names the recovered task, source fix and state outside rollback scope.

  • Restored version passes the exact failed task.
  • Source repair and non-code effects are explicitly addressed.

Was this lesson useful?

Leave a like, or share it with someone who could use it.