Skip to content

Better Stack Automated Maintenance During Deployments #30

Description

@fe51

Pitch

Automate Better Stack maintenance windows during Ansible deployments to:

  • avoid false downtime alerts
  • keep clean uptime stats
  • keep deployment traceability
  • remove manual maintenance actions

Deployment Flow

  1. Start short maintenance window ( YY min -> to be defined, and might depend on the service)
  2. Deploy new image/version
  3. Wait for healthcheck (/health) ?
  4. End maintenance early or let it expire automatically

Better Stack Targeting

Deployment must notify the correct Better Stack monitor depending on (as an example)

Service Environment Target
frontend prod prod frontend monitor
backend prod prod backend monitor
frontend dev dev frontend monitor
backend dev dev backend monitor

Use Ansible variables/inventory, no hardcoded IDs.

Example:

service_name: frontend
environment: prod
betterstack_monitor_id: xxx
betterstack_api_token: vault_secret

Specs suggestion

Failure Handling

If deploy fails:

  • maintenance stays active until expiry
  • playbook fails normally
  • optional notification later

Security

API token stored in Ansible Vault / CI secrets

ansible ideas

  • Reusable role: roles/betterstack_maintenance

  • usage

pre_tasks:
  - include_role:
      name: betterstack_maintenance
    vars:
      state: start

roles:
  - deploy_app

post_tasks:
  - include_role:
      name: betterstack_maintenance
    vars:
      state: stop
  • maintenance windows instead choice over pause/unpause because they suppress false alerts while preserving a clear audit trail and deployment history

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions