Deployment Template

Template

= [DEPLOY-YYYY-MM-DD] Deployment Name
:description: Brief description of what's being deployed
:revdate: YYYY-MM-DD
:deploy-window: YYYY-MM-DD HH:MM - HH:MM TZ

== Deployment Overview

[cols="1,2"]
|===
| Field | Value

| Target Environment
| Production / Staging / Dev

| Deployment Window
| YYYY-MM-DD HH:MM - HH:MM TZ

| Expected Duration
| X hours

| Change Type
| Feature / Bugfix / Security / Infrastructure

| Risk Level
| Low / Medium / High

| Rollback Time
| X minutes
|===

== Prerequisites

=== Approvals

* [ ] Change request approved
* [ ] Technical review completed
* [ ] Stakeholder notification sent

=== Pre-Deployment Checks

* [ ] All tests passing
* [ ] Dependencies updated
* [ ] Backup completed
* [ ] Monitoring in place
* [ ] Rollback plan tested

=== Required Access

* [ ] Production credentials available
* [ ] SSH keys configured
* [ ] VPN connected (if required)

== Deployment Steps

=== Phase 1: Preparation

```bash
# Step 1: Verify current state
command --check

# Step 2: Create backup
command --backup
```

* [ ] Backup verified

=== Phase 2: Deployment

```bash
# Step 3: Deploy new version
command --deploy

# Step 4: Run migrations (if applicable)
command --migrate
```

* [ ] Deployment completed without errors

=== Phase 3: Verification

```bash
# Step 5: Health check
curl -f https://service/health

# Step 6: Smoke tests
./run-smoke-tests.sh
```

* [ ] Health check passing
* [ ] Smoke tests passing
* [ ] Monitoring shows normal metrics

=== Phase 4: Finalization

* [ ] Remove old version (if applicable)
* [ ] Update documentation
* [ ] Notify stakeholders

== Rollback Plan

=== Rollback Triggers

* Health check fails after 3 attempts
* Error rate exceeds X%
* Response time exceeds Y ms
* Any data corruption detected

=== Rollback Steps

```bash
# Step 1: Stop new version
command --stop

# Step 2: Restore previous version
command --rollback

# Step 3: Verify rollback
command --verify
```

== Validation Checklist

* [ ] Service responding to requests
* [ ] All endpoints returning expected responses
* [ ] No errors in application logs
* [ ] Database connectivity confirmed
* [ ] External integrations working
* [ ] Performance within acceptable range

== Communication

=== Before Deployment

Notify: [stakeholders, team channels]

Message: "Starting deployment of [component] to [environment]. Expected duration: X hours."

=== After Deployment

Message: "Deployment of [component] completed successfully. All systems operational."

=== If Rollback Required

Message: "Deployment rolled back due to [reason]. Service restored to previous version."

== Post-Deployment

* [ ] Monitor for 24 hours
* [ ] Document any issues encountered
* [ ] Update runbook with lessons learned

Deployment Types

Blue-Green Deployment

Switch traffic between two identical environments.

Canary Deployment

Gradually roll out to subset of users.

Rolling Deployment

Update instances one at a time.

Big Bang Deployment

All-at-once replacement (higher risk).

Risk Assessment Matrix

Risk Level Characteristics Mitigation

Low

Well-tested, minor changes, easy rollback

Standard deployment, monitoring

Medium

New features, moderate complexity, known dependencies

Staged rollout, enhanced monitoring

High

Major changes, database migrations, many dependencies

Canary deployment, dedicated support, rollback rehearsal