/deploy-unified

Operations L3 Production medium usage

/deploy-unified

Overview

The /deploy-unified command serves as the single entry point for all deployment operations across the Prismatic Platform, replacing the need to remember multiple deployment commands, scripts, and procedures. Whether deploying to staging, promoting to production, executing an emergency rollback, streaming logs, or checking system health, this command provides a consistent interface with built-in safety gates, health validation, and traceable audit trails for every operation.

The unified deployment philosophy addresses a common operational anti-pattern: scattered deployment procedures across mix tasks, shell scripts, CI/CD pipelines, and manual Fly.io commands. By consolidating all deployment operations under a single command with consistent parameter conventions, the platform eliminates the cognitive overhead of remembering which tool to use for which scenario, reduces the risk of using the wrong procedure, and ensures that every deployment follows the same safety protocol regardless of the operator's familiarity with the infrastructure.

This command operates under the L3 authority level and is executed by the deployment-coordinator agent. It is part of the platform's 216-command slash command registry, built on the AIAD (Autonomous Intelligence Agent Design) standard. The deployment coordinator agent orchestrates all deployment-related operations, delegating to specialized agents for environment-specific tasks while maintaining a unified audit trail.

Safety is the primary design principle. Every deployment passes through mandatory quality gates. Production deployments require explicit confirmation. Health checks run automatically after every deployment. Rollback procedures are prepared and tested before any forward deployment. The --dry-run option allows operators to preview exactly what a deployment would do before committing to execution, and the --force flag is available for non-production environments when prompt bypassing is needed during automated CI/CD flows.

Architecture

Unified Deployment Control Center

/deploy-unified [command] [target] [options]
    |
    v
COMMAND ROUTER
    +-- status   -> Display all environment status
    +-- staging  -> Deploy to staging environment
    +-- production -> Deploy to production (with gates)
    +-- rollback -> Rollback specified environment
    +-- logs     -> Stream logs from environment
    +-- ssh      -> SSH into environment instance
    +-- health   -> Health check environment
    +-- config   -> Show deployment configuration
    |
    v
SAFETY GATE ENGINE
    +-- Clean working directory check
    +-- Quality gates validation
    +-- Environment-specific confirmation
    +-- Rollback preparation
    |
    v
DEPLOYMENT EXECUTOR
    +-- Fly.io deployment (staging/production)
    +-- Health check monitoring
    +-- Telemetry event emission
    +-- Audit trail recording

Environment Protection Matrix

EnvironmentConfirmation RequiredQuality GatesHealth CheckRollback Ready
StagingNoYesYesYes
ProductionYES (explicit)YesYes (10s window)Yes
Rollback (staging)YesNoYesN/A
Rollback (production)YES (explicit)NoYesN/A

Usage

Status and Monitoring

# Show deployment status for all environments
/deploy-unified status

# Health check specific environment
/deploy-unified health staging
/deploy-unified health production

# Stream logs from environment
/deploy-unified logs staging
/deploy-unified logs production

# Show deployment configuration
/deploy-unified config

Staging Deployment

# Deploy to staging (with quality gates)
/deploy-unified staging

# Quick staging deploy (skip confirmation prompts)
/deploy-unified staging --force

# Dry run -- preview without executing
/deploy-unified staging --dry-run

# Verbose output
/deploy-unified staging --verbose

Production Deployment

# Deploy to production (full safety gates)
/deploy-unified production

# Preview production deployment
/deploy-unified production --dry-run

# Production with verbose output
/deploy-unified production --verbose

Rollback Operations

# Rollback staging
/deploy-unified rollback staging

# Rollback production (requires explicit confirmation)
/deploy-unified rollback production

SSH and Debugging

# SSH into staging instance
/deploy-unified ssh staging

# SSH into production instance
/deploy-unified ssh production

Options & Parameters

ParameterPositionRequiredTypeDefaultDescription
command$1NoenumstatusOperation: status, staging, production, rollback, logs, ssh, health, config
target$2Noenum--Target environment for rollback, logs, ssh, health
--dry-runflagNobooleanfalsePreview without executing
--skip-qualityflagNobooleanfalseSkip quality gates (requires confirmation)
--forceflagNobooleanfalseSkip confirmation prompts
--verboseflagNobooleanfalseShow detailed output

Execution Flow

Staging Deployment Flow

/deploy-unified staging
    |
    v
GATE 1: WORKING DIRECTORY (< 1s)
    +-- git status check
    +-- Uncommitted changes? -> BLOCK
    |
    v
GATE 2: QUALITY (< 30s)
    +-- mix quality.gates --quick
    +-- Any failures? -> BLOCK
    |
    v
DEPLOY (30-120s)
    +-- fly deploy --config fly.staging.toml
    +-- Monitor build and deployment
    |
    v
HEALTH CHECK (< 10s)
    +-- GET https://prismatic-staging.fly.dev/health
    +-- Status != 200? -> ALERT (no auto-rollback for staging)
    |
    v
COMPLETE
    +-- Log deployment event
    +-- Display success message

Production Deployment Flow

/deploy-unified production
    |
    v
GATE 1: WORKING DIRECTORY
    +-- Clean check required
    |
    v
GATE 2: QUALITY GATES
    +-- All 13 domains must pass
    |
    v
GATE 3: CONFIRMATION
    +-- "Deploy to PRODUCTION? Type 'yes': "
    +-- Anything other than 'yes' -> ABORT
    |
    v
DEPLOY
    +-- fly deploy --config fly.toml
    +-- Rolling update strategy
    |
    v
HEALTH CHECK (10s window)
    +-- Continuous polling every second
    +-- Failure -> AUTO-ROLLBACK
    |
    v
COMPLETE
    +-- Deployment recorded
    +-- 24-hour monitoring begins

Integration Points

ComponentRelationshipDetails
Prismatic AgentsExecuted by deployment-coordinator agentCentral orchestrator for all deployment operations
AIAD RegistryCommand specificationOperations category
Quality GatesMandatory pre-deployment validationmix quality.gates --quick execution
TelemetryDeployment metricsDeploy time, health status, rollback events
Fly.ioInfrastructure providerStaging and production hosting
GitLab CIPipeline integrationAutomated deployment triggers

Multiple Invocation Paths

The unified deployment command can be invoked through several equivalent paths:

# Slash command (interactive)
/deploy-unified staging

# Mix task (programmatic)
mix deploy.staging

# Shell script (CI/CD)
./scripts/deploy.sh staging

CI/CD Integration

# .gitlab-ci.yml
deploy_staging:
  script:
    - './scripts/deploy.sh staging --force'
  environment:
    name: staging
    url: https://prismatic-staging.fly.dev

deploy_production:
  script:
    - './scripts/deploy.sh production --force'
  environment:
    name: production
    url: https://prismatic-prod.fly.dev
  when: manual

Deployment Targets

EnvironmentAppConfigURL
Stagingprismatic-stagingfly.staging.tomlhttps://prismatic-staging.fly.dev
Productionprismaticfly.tomlhttps://prismatic-prod.fly.dev

Best Practices

  1. Use status before deploying -- Run /deploy-unified status to understand the current state of all environments before initiating any deployment.

  2. Prefer dry-run for production -- Always run /deploy-unified production --dry-run first to preview the deployment plan before committing.

  3. Deploy staging before production -- The staging-first workflow catches issues in a low-risk environment. Never deploy untested code to production.

  4. Monitor health after every deployment -- Use /deploy-unified health <env> immediately after deployment and periodically throughout the first 24 hours.

  5. Keep rollback procedures tested -- Periodically perform rollback operations on staging to ensure the procedure works when needed in production.

  6. Use force flag only in CI/CD -- The --force flag bypasses confirmation prompts and should only be used in automated pipelines where human confirmation is provided through pipeline approval gates.

Error Handling

ErrorCauseResolution
DIRTY_WORKING_DIRECTORYUncommitted changesCommit or stash before deploying
QUALITY_GATES_FAILEDQuality check failuresFix violations before deployment
CONFIRMATION_REJECTEDOperator did not type 'yes'Re-run and confirm, or use --dry-run to preview
DEPLOY_FAILEDFly.io deployment errorCheck build logs; verify Dockerfile and config
HEALTH_CHECK_FAILEDPost-deploy health failureAuto-rollback triggers for production; investigate
ROLLBACK_FAILEDCannot rollback to previous versionManual intervention via Fly.io dashboard

Exit Codes

CodeMeaning
0Deployment successful, health check passed
1Deployment failed or health check failed

Advanced Usage

Programmatic Deployment

# Trigger deployment from Elixir code
{:ok, result} = PrismaticDeploy.execute(%{
  environment: :staging,
  force: true,
  verbose: false
})

# Check deployment status
{:ok, status} = PrismaticDeploy.status(:production)

# Execute health check
{:ok, health} = PrismaticDeploy.health(:staging)

Custom Quality Gate Integration

# Pre-deployment quality validation
./scripts/quality.sh pre-commit
mix quality.gates --quick

# Full quality suite (for production)
mix compile --warnings-as-errors --force
mix credo --strict
mix test --cover

Multi-Region Deployment

# Deploy to specific Fly.io region
fly deploy --config fly.toml --region fra

# Scale across regions
fly scale count 2 --region fra
fly scale count 1 --region iad

Doctrine Compliance

All commands operate under the NO MERCY, NO DOUBTS doctrine:

  • NO MERCY: Zero tolerance for unvalidated deployments. Quality gates are mandatory, not optional. Health checks are automatic, not manual. Rollback procedures are prepared before deployment, not improvised after failure. Production confirmation is explicit, not assumed.
  • NO DOUBTS: Full pre-deployment verification through automated quality gates. Post-deployment health validated through active probing. Every deployment produces a traceable audit trail. Evidence-based deployment decisions with measurable pass/fail criteria.

Connect & Contribute

Created by Tomáš Korcak (korczis) | Open Source under GHL