Skip to content

Waypoint

Comprehensive HashiCorp Waypoint commands and workflows for application deployment and release management across platforms.

Installation & Setup

CommandDescription
waypoint versionShow Waypoint version
waypoint server install -platform=dockerInstall server on Docker
waypoint server install -platform=kubernetesInstall server on Kubernetes
waypoint context create -server-addr=localhost:9701Create context
waypoint loginLogin to Waypoint server

Project Management

Project Operations

CommandDescription
waypoint initInitialize project
waypoint project listList projects
waypoint project inspect myappInspect project
waypoint project destroy myappDestroy project

Application Lifecycle

Build, Deploy, Release

CommandDescription
waypoint buildBuild application
waypoint deployDeploy application
waypoint releaseRelease application
waypoint upBuild, deploy, and release

Application Management

CommandDescription
waypoint statusShow application status
waypoint logsShow application logs
waypoint logs -followFollow application logs
waypoint exec /bin/bashExecute command in deployment

Workspace Management

CommandDescription
waypoint workspace listList workspaces
waypoint workspace create devCreate workspace
waypoint workspace use devSwitch workspace

Configuration Examples

Basic waypoint.hcl

hcl
project = "myapp"

app "web" {
  labels = {
    "service" = "web"
    "env"     = "dev"
  }

  build {
    use "docker" {
      dockerfile = "./Dockerfile"
    }
    
    registry {
      use "docker" {
        image = "myapp"
        tag   = "latest"
      }
    }
  }

  deploy {
    use "docker" {
      service_port = 3000
    }
  }

  release {
    use "docker" {}
  }
}

Kubernetes Deployment

hcl
project = "myapp"

app "web" {
  build {
    use "docker" {
      dockerfile = "./Dockerfile"
    }
    
    registry {
      use "docker" {
        image = "registry.example.com/myapp"
        tag   = gitrefpretty()
      }
    }
  }

  deploy {
    use "kubernetes" {
      probe_path = "/health"
      
      replicas = 3
      
      resources {
        requests {
          memory = "256Mi"
          cpu    = "250m"
        }
        limits {
          memory = "512Mi"
          cpu    = "500m"
        }
      }
    }
  }

  release {
    use "kubernetes" {
      load_balancer = true
      port          = 80
    }
  }
}

AWS ECS Deployment

hcl
project = "myapp"

app "web" {
  build {
    use "docker" {
      dockerfile = "./Dockerfile"
    }
    
    registry {
      use "aws-ecr" {
        region     = "us-west-2"
        repository = "myapp"
        tag        = gitrefpretty()
      }
    }
  }

  deploy {
    use "aws-ecs" {
      region = "us-west-2"
      cluster = "production"
      
      memory = 512
      cpu    = 256
      
      count = 3
      
      subnets = [
        "subnet-12345",
        "subnet-67890"
      ]
      
      security_groups = [
        "sg-abcdef"
      ]
    }
  }

  release {
    use "aws-alb" {
      listener_arn = "arn:aws:elasticloadbalancing:..."
      
      health_check {
        enabled             = true
        healthy_threshold   = 2
        interval            = 30
        matcher             = "200"
        path                = "/health"
        port                = "traffic-port"
        protocol            = "HTTP"
        timeout             = 5
        unhealthy_threshold = 2
      }
    }
  }
}

Multi-App Project

hcl
project = "microservices"

app "api" {
  labels = {
    "service" = "api"
    "tier"    = "backend"
  }

  build {
    use "docker" {
      dockerfile = "./api/Dockerfile"
    }
    
    registry {
      use "docker" {
        image = "mycompany/api"
        tag   = gitrefpretty()
      }
    }
  }

  deploy {
    use "kubernetes" {
      probe_path = "/health"
      replicas   = 2
      
      env = {
        "DATABASE_URL" = var.database_url
        "REDIS_URL"    = var.redis_url
      }
    }
  }

  release {
    use "kubernetes" {
      port = 8080
    }
  }
}

app "frontend" {
  labels = {
    "service" = "frontend"
    "tier"    = "frontend"
  }

  build {
    use "docker" {
      dockerfile = "./frontend/Dockerfile"
    }
    
    registry {
      use "docker" {
        image = "mycompany/frontend"
        tag   = gitrefpretty()
      }
    }
  }

  deploy {
    use "kubernetes" {
      probe_path = "/"
      replicas   = 3
    }
  }

  release {
    use "kubernetes" {
      load_balancer = true
      port          = 80
    }
  }
}

Variables and Configuration

Variable Definitions

hcl
variable "database_url" {
  description = "Database connection URL"
  type        = string
  sensitive   = true
}

variable "replicas" {
  description = "Number of replicas"
  type        = number
  default     = 2
}

variable "environment" {
  description = "Environment name"
  type        = string
  default     = "dev"
}

Using Variables

hcl
app "web" {
  deploy {
    use "kubernetes" {
      replicas = var.replicas
      
      env = {
        "DATABASE_URL" = var.database_url
        "ENVIRONMENT"  = var.environment
      }
    }
  }
}

Functions and Expressions

Built-in Functions

hcl
app "web" {
  build {
    registry {
      use "docker" {
        image = "myapp"
        tag   = gitrefpretty()  # Git reference
      }
    }
  }
  
  deploy {
    use "kubernetes" {
      env = {
        "BUILD_TIME" = timestamp()
        "GIT_SHA"    = gitsha()
        "VERSION"    = gitrefpretty()
      }
    }
  }
}

Plugins and Builders

Custom Build Plugin

hcl
app "web" {
  build {
    use "pack" {
      builder = "heroku/buildpacks:20"
    }
  }
}

Custom Deploy Plugin

hcl
app "web" {
  deploy {
    use "nomad" {
      datacenter = "dc1"
      region     = "global"
      
      resources {
        cpu    = 500
        memory = 256
      }
    }
  }
}

Best Practices

Project Structure

project/
├── waypoint.hcl
├── .waypointignore
├── apps/
│   ├── api/
│   │   ├── Dockerfile
│   │   └── src/
│   └── frontend/
│       ├── Dockerfile
│       └── src/
├── infrastructure/
│   └── terraform/
└── scripts/
    └── deploy.sh

Security

  1. Secrets Management: Use external secret stores
  2. RBAC: Implement role-based access control
  3. Network Security: Use secure networks and firewalls
  4. Image Scanning: Scan container images
  5. Audit Logging: Enable audit logging

Performance

  1. Resource Limits: Set appropriate resource limits
  2. Health Checks: Implement proper health checks
  3. Scaling: Configure auto-scaling
  4. Monitoring: Monitor application performance
  5. Caching: Implement caching strategies

Operations

  1. CI/CD Integration: Integrate with CI/CD pipelines
  2. Rollback Strategy: Plan rollback procedures
  3. Blue-Green Deployments: Use blue-green deployments
  4. Canary Releases: Implement canary releases
  5. Monitoring: Set up comprehensive monitoring