# Advanced DevOps Engineering: Release and Recovery

Fieldline Services, a fictional trades scheduling business, wants safer releases and evidence it can recover job records. Build and test a local operations toolkit, version its release state and rehearse failed health checks and corrupted backups before proposing cloud deployment.

## Required tools
Python 3.11+, a text editor and a terminal. All required Python dependencies are standard library. Git is recommended. No video, paid cloud service or real credentials are required.

## Getting started
Extract this archive to a new folder, then open a terminal in that folder.
```sh
python --version
python -m unittest -v test_operations
```
If your system names Python `python3` or `py`, substitute that command throughout. The starter intentionally raises NotImplementedError. These are assignments, not completed solutions.

## Five checkpoints

1. Validate environment configuration
   `python -m unittest -v test_operations.TestConfig`

2. Gate releases and preserve rollback state
   `python -m unittest -v test_operations.TestRelease`

3. Build actionable service telemetry
   `python -m unittest -v test_operations.TestObservability`

4. Restore safely and detect corruption
   `python -m unittest -v test_operations.TestRecovery`

5. Automate checks and rehearse an incident
   `python -m unittest -v test_operations.TestCapstone`

Later test classes include earlier checks. Do not remove assertions to obtain a pass. Add your own boundary, fault and regression tests. The suite is a specified acceptance baseline, not exhaustive proof of production security or reliability.

## Troubleshooting
- ModuleNotFoundError: run commands from the extracted kit folder.
- NotImplementedError: implement the named function using its docstring and the lesson.
- AssertionError: compare the expected business rule to the actual result, add a small reproduction and fix the implementation.
- Database locked: close stale processes, use a fresh temporary database for tests, and document transaction behavior.

## Evidence
Save the command, full output, Python version and Git commit SHA. Record any manual checks separately. Submit a permitted HTTPS repository/artifact link plus results, decisions, limitations and assistance in SkillProof. The platform labels this self-reported; it does not run uploaded code or award an external certification.

## Project change
Choose a module's stakeholder change. Write a failing regression test before changing implementation. Explain which acceptance assumptions changed.

## Rights
Fictional business case and synthetic data, created for SkillProof. Adapt the starter and tests for your learning portfolio. Do not include confidential employer data, production credentials or fabricated customer results.

## Actual local service and optional container
```sh
python health_service.py
```
Open http://127.0.0.1:8081/health. The local service is distinct from simulated release state. If Docker is installed, build with `docker build -t skillproof-ops:local .` and run `docker run --rm -p 127.0.0.1:8081:8081 skillproof-ops:local`. Copy ci.yml to .github/workflows/ci.yml at the repository root to run acceptance tests with GitHub Actions. This workflow tests code; it does not deploy a service.

## Repeatable incident rehearsal
Run `python rehearse.py` after implementing operations.py. It checks failed-gate state preservation, promotion, rollback, an isolated synthetic restore and aggregate metrics. The output explicitly describes its local simulation scope. Run the health service separately to observe actual process behavior.
