# Rollback Plan — frontend-shell Principle (Q8 = B): roll back by **deploying a previous version through the pipeline**. The site is static: there is no state or database to undo. ## Test environment Old versions are not kept on test (keeping it simple). To go back, run the workflow on the branch, commit or tag you want, with **Deploy to Test**. This is the same route as production, so a rollback on test is also a rehearsal for production. ## Production 1. **Choose the version.** That is the previous tag (for example `v1.0.0`) or the release branch from before the faulty change. 2. **Deploy it.** If the release branch still exists at that version, run the workflow on it with **Deploy to Production**. Otherwise create a branch from the tag first: ```bash git switch -c release/1.0-rollback v1.0.0 && git push -u origin release/1.0-rollback ``` Then deploy that branch. Production deploys are only allowed from `release/*`, which is why the branch is needed. 3. **Check the result.** The pipeline's post-deploy check verifies reachability and the CSP header. Also open a deep link (for example `/portfolio`) and the home page. 4. **Fix forward.** Fix the problem on the release branch and deploy again as a new patch version. **Emergency (pipeline unavailable):** run `pnpm build` locally from the tag, copy `web/deploy/iis/web.config` into `dist/`, and upload `dist/` with FileZilla to `wwwroot`. Use "FTP over explicit TLS", and upload `index.html` last. ## Before go-live As long as the DNS points to the current host (D12), a broken production deploy affects no visitors. Fix it and deploy again. ## Later: with the .NET API and a database - **Code**: roll back the same way, by deploying the previous version. - **Database**: do **not** roll back with "down" migrations, because they can destroy data. Instead: - Make migrations backward compatible (expand/contract), so the previous API version still works on the new schema. - Back up the database (or export it; the package allows 50 MB) before every production migration. The pipeline can do this as a step. - Fix errors in data or schema with a new migration (roll forward). - **Restore from backup** only as a last resort, when data was damaged.