Zum Inhalt

Wegweiser

generieren

Umfassende HashiCorp Waypoint-Befehle und Workflows für Applikations- und Release-Management auf Plattformen.

Installation und Inbetriebnahme

Command Description
waypoint version Show Waypoint version
waypoint server install -platform=docker Install server on Docker
waypoint server install -platform=kubernetes Install server on Kubernetes
waypoint context create -server-addr=localhost:9701 Create context
waypoint login Login to Waypoint server

Projektleitung

Projekte

Command Description
waypoint init Initialize project
waypoint project list List projects
waypoint project inspect myapp Inspect project
waypoint project destroy myapp Destroy project

Anwendung Lebenszyklus

Aufbau, Bereitstellung, Freigabe

Command Description
waypoint build Build application
waypoint deploy Deploy application
waypoint release Release application
waypoint up Build, deploy, and release

Anwendungsmanagement

Command Description
waypoint status Show application status
waypoint logs Show application logs
waypoint logs -follow Follow application logs
waypoint exec /bin/bash Execute command in deployment

Workspace Management

Command Description
waypoint workspace list List workspaces
waypoint workspace create dev Create workspace
waypoint workspace use dev Switch workspace

Konfigurationsbeispiele

Grundlegender Wegpunkt.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 Bereitstellung
```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 Bereitstellung
```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-Projekt
```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
    \\\\}
  \\\\}
\\\\}
```_

## Variablen und Konfiguration

### Variable Definitionen
```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"
\\\\}
```_

### Variablen verwenden
```hcl
app "web" \\\\{
  deploy \\\\{
    use "kubernetes" \\\\{
      replicas = var.replicas

      env = \\\\{
        "DATABASE_URL" = var.database_url
        "ENVIRONMENT"  = var.environment
      \\\\}
    \\\\}
  \\\\}
\\\\}
```_

## Funktionen und Ausdrücke

### Integrierte Funktionen
```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 und Builder

### Benutzerdefiniertes Plugin erstellen
```hcl
app "web" \\\\{
  build \\\\{
    use "pack" \\\\{
      builder = "heroku/buildpacks:20"
    \\\\}
  \\\\}
\\\\}
```_

### In den Warenkorb
```hcl
app "web" \\\\{
  deploy \\\\{
    use "nomad" \\\\{
      datacenter = "dc1"
      region     = "global"

      resources \\\\{
        cpu    = 500
        memory = 256
      \\\\}
    \\\\}
  \\\\}
\\\\}
```_

## Best Practices

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

Sicherheit

  1. **Secrets Management*: Verwenden Sie externe geheime Speicher
  2. RBAC: Implementierung einer rollenbasierten Zugriffskontrolle
  3. **Network Security*: Verwenden Sie sichere Netzwerke und Firewalls
  4. Image Scanning: Containerbilder scannen
  5. Audit Logging: Auditprotokoll aktivieren

Leistung

  1. ** Ressourcenlimits**: Angemessene Ressourcengrenzen festlegen
  2. **Gesundheitskontrollen*: Durchführung richtiger Gesundheitskontrollen
  3. Skalierung: Auto-Skalierung konfigurieren
  4. Monitoring: Anwendungsleistung überwachen
  5. Caching: Umsetzung von Cache-Strategien

Operationen

  1. **CI/CD Integration*: Integration mit CI/CD-Pipelines
  2. **Rollback Strategie*: Plan Rollbackverfahren
  3. **Blue-Green-Deployments*: Verwenden Sie blau-grüne Bereitstellungen
  4. **Canary Releases*: Implementieren von Canary Releases
  5. Monitoring: umfassende Überwachung einrichten