Logo Deployment Automation

Deployment Automation

Cộng đồng
Firstp1ck
deployment-automation

Agents should invoke this skill for Docker Compose deployments, container updates, stack health checks, rollbacks, compose-file changes, image upgrades, failed deploys, or service restart planning. Provides safe deployment and rollback workflows.

Tổng quan

Nhà phát hànhFirstp1ck
Kho mãpi-coding-agent-forge
Tên kỹ năngdeployment-automation
Sao
93
Bản fork
22
Tệp đi kèm
Chỉ có hướng dẫn
Giấy phépMIT
Liên kết
  • Hướng dẫn bằng Markdown

    Tệp SKILL.md được mô hình tải khi cần, nên chỉ tốn token khi có yêu cầu thực sự phù hợp.

  • Dùng được với mọi LLM

    Kỹ năng AI dùng hướng dẫn viết bằng Markdown thay vì mã dành riêng cho một nhà cung cấp, nên dùng được với GPT, Claude, Gemini, Grok hoặc mô hình cục bộ.

  • Hướng dẫn có đủ mọi thứ cần thiết

    Mọi thứ mô hình cần đều nằm trong hướng dẫn — không có tệp bổ sung cần đồng bộ.

  • Mã nguồn mở

    Được Firstp1ck công bố trên GitHub. Hãy đọc các tệp nguồn trước khi cài đặt.

Cài đặt

Cài đặt kỹ năng AI Deployment Automation trong TypingMind để dùng với bất kỳ LLM nào, hoặc thêm vào một tác nhân AI khác có thể đọc SKILL.md.

1

Cài đặt trong TypingMind

TypingMind cài đặt kỹ năng trực tiếp từ thư mục GitHub — đọc SKILL.md, đóng gói các tệp tài nguyên và lưu kết quả trên máy.

  1. Mở ứng dụng và vào Plugin → Kỹ năng.
  2. Chọn "Cài đặt từ GitHub".
  3. Dán URL của thư mục kỹ năng được hiển thị bên dưới rồi xác nhận.
    https://github.com/Firstp1ck/pi-coding-agent-forge/tree/main/pi-skill-deployment-automation/skills/deployment-automation
  4. Bật kỹ năng trong từng cuộc trò chuyện mà bạn muốn sử dụng kỹ năng đó.
Plugin → Kỹ năng → Thêm kỹ năng → Từ URL GitHub, sau đó dán URL thư mục và nhấn Tiếp tục.
2

Cài đặt trong tác nhân AI khác

Bất kỳ tác nhân AI nào đọc được định dạng Agent Skills đều có thể dùng kỹ năng này — hãy sao chép thư mục vào thư mục kỹ năng của tác nhân AI đó.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/Firstp1ck/pi-coding-agent-forge.git /tmp/pi-coding-agent-forge
mkdir -p .claude/skills
cp -r /tmp/pi-coding-agent-forge/pi-skill-deployment-automation/skills/deployment-automation .claude/skills/deployment-automation
Khởi động lại Claude Code sau khi sao chép để ứng dụng nhận kỹ năng mới.

Sử dụng trong TypingMind

Bật Deployment Automation trong bất kỳ cuộc trò chuyện nào trên TypingMind, mô hình sẽ tự xử lý phần còn lại. Tên và mô tả của kỹ năng nằm trong prompt hệ thống. Ngay khi có yêu cầu phù hợp, mô hình tự tải toàn bộ hướng dẫn — bạn không cần gọi thủ công và kỹ năng không tốn token cho đến khi thực sự được dùng.

Mô hình tự nạp Deployment Automation ngay khi có yêu cầu phù hợp.

Dùng được với mọi mô hình AI

Kỹ năng AI là các hướng dẫn Markdown thuần túy, không phải mã dành riêng cho một nhà cung cấp, nên bạn có thể dùng Deployment Automation với cả những mô hình khác ngoài mô hình ban đầu. Chỉ cần cài đặt một lần trong TypingMind rồi dùng với GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama hoặc mô hình cục bộ do bạn tự chạy — tất cả đều dùng khóa API của riêng bạn.

  • Chỉ tải khi cần

    Prompt hệ thống chỉ chứa tên và mô tả. Hướng dẫn được tải khi có yêu cầu phù hợp đầu tiên, nên khi kỹ năng chưa được dùng, bạn không tốn token cho phần hướng dẫn.

  • Đổi mô hình ngay trong cuộc trò chuyện

    Vì kỹ năng là hướng dẫn chứ không phải mã, việc đổi mô hình không làm kỹ năng ngừng hoạt động — mô hình tiếp theo vẫn đọc cùng tệp SKILL.md.

Hướng dẫn của kỹ năng

Đây là nội dung SKILL.md mà mô hình tải. Hãy đọc trước khi cài đặt — kỹ năng là những hướng dẫn mà mô hình của bạn sẽ làm theo.

Deployment Automation

Manage Docker Compose deployments, container lifecycle, image updates, and rollbacks.

Quick Start

Deploy a Compose Stack

bash
# Start services
docker compose up -d

# Start with rebuild
docker compose up -d --build

# Check status
docker compose ps

Update a Running Service

bash
# Pull latest images
docker compose pull

# Recreate with new images
docker compose up -d --remove-orphans

# Verify health
docker compose ps
docker compose logs --tail=20 <service>

Docker Compose Management

Lifecycle Commands

bash
# Start all services
docker compose up -d

# Stop all services (preserves volumes)
docker compose down

# Stop and remove volumes (DESTRUCTIVE)
docker compose down -v

# Restart a specific service
docker compose restart <service>

# Scale a service
docker compose up -d --scale <service>=3

# View logs
docker compose logs -f <service>
docker compose logs --tail=50 <service>

Stack Health Check

bash
# List all containers with status
docker compose ps --format "table {{.Name}}\t{{.Status}}\t{{.Ports}}"

# Check resource usage
docker stats --no-stream --format "table {{.Name}}\t{{.CPUPerc}}\t{{.MemUsage}}"

# Inspect a specific container
docker inspect <container> | jq '.[0].State'

Image Update Workflow

Safe update process with rollback path:

Step 1: Pre-Update Checks

bash
# Record current state
docker compose ps > /tmp/pre-update-state.txt
docker compose config --images > /tmp/current-images.txt

# Check current image digests
docker compose images --format "table {{.Repository}}\t{{.Tag}}\t{{.ID}}"

Step 2: Pull New Images

bash
# Pull latest images
docker compose pull

# Compare image IDs (see if anything changed)
docker compose images --format "table {{.Repository}}\t{{.Tag}}\t{{.ID}}"

Step 3: Deploy Update

bash
# Recreate containers with new images
docker compose up -d --remove-orphans

# Wait for services to stabilize
sleep 10

# Verify all containers are healthy
docker compose ps

Step 4: Post-Update Verification

bash
# Check for restart loops
docker compose ps --format "{{.Name}}: {{.Status}}" | grep -i "restarting"

# Check logs for errors
docker compose logs --since 2m --tail=50 2>&1 | grep -iE "error|fatal|panic"

# Test service endpoints
curl -s -o /dev/null -w "%{http_code}" http://localhost:<port>/health

Step 5: Rollback (If Needed)

bash
# Rollback to previous image
docker compose down
# Edit compose file or use specific image tags
docker compose up -d

# Or if you tagged the previous image:
docker tag <service>:previous <service>:latest
docker compose up -d

Health Check Patterns

In Compose Files

Always include health checks in new deployments:

yaml
services:
  myservice:
    image: myimage:latest
    healthcheck:
      test: ["CMD", "curl", "-f", "http://localhost:8080/health"]
      interval: 30s
      timeout: 10s
      retries: 3
      start_period: 40s
    restart: unless-stopped

Common Health Check Types

yaml
# HTTP endpoint
healthcheck:
  test: ["CMD", "curl", "-f", "http://localhost:8080/health"]

# TCP port
healthcheck:
  test: ["CMD", "nc", "-z", "localhost", "5432"]

# Command execution
healthcheck:
  test: ["CMD", "pg_isready", "-U", "postgres"]

# Shell command
healthcheck:
  test: ["CMD-SHELL", "wget -q --spider http://localhost:80 || exit 1"]

Monitor Health Status

bash
# Check health status of all containers
docker ps --format "table {{.Names}}\t{{.Status}}"

# Inspect health details
docker inspect --format='{{json .State.Health}}' <container> | jq '.'

# Watch for unhealthy containers
docker ps --filter "health=unhealthy"

Container Cleanup

Regular Maintenance

bash
# Remove stopped containers
docker container prune -f

# Remove unused images
docker image prune -f

# Remove unused images (including tagged)
docker image prune -a -f

# Remove unused volumes (CAREFUL — data loss)
docker volume prune -f

# Remove unused networks
docker network prune -f

# Full cleanup (containers, images, networks — NOT volumes)
docker system prune -f

# Full cleanup INCLUDING volumes (DESTRUCTIVE)
docker system prune -a --volumes -f

Disk Usage

bash
# Docker disk usage summary
docker system df

# Detailed breakdown
docker system df -v

Compose File Best Practices

Template for New Services

yaml
version: "3.8"

services:
  servicename:
    image: image:tag          # Pin to specific tag, not :latest for production
    container_name: servicename
    restart: unless-stopped
    healthcheck:
      test: ["CMD", "curl", "-f", "http://localhost:8080/health"]
      interval: 30s
      timeout: 10s
      retries: 3
      start_period: 40s
    environment:
      - TZ=Etc/UTC
    volumes:
      - servicename_data:/data
    ports:
      - "8080:8080"
    networks:
      - default
    logging:
      driver: json-file
      options:
        max-size: "10m"
        max-file: "3"

volumes:
  servicename_data:

networks:
  default:

Key Principles

  1. Pin image tags — Use image:1.2.3 not image:latest for production
  2. Always health check — Every service should have a health check
  3. Always restart policy — unless-stopped or always
  4. Log rotation — Set max-size and max-file to prevent disk fill
  5. Named volumes — Use named volumes, not bind mounts, for data persistence
  6. Timezone — Set TZ=Etc/UTC for consistent logs
  7. Resource limits — Set memory/CPU limits for critical services

Resource Limits

yaml
services:
  myservice:
    deploy:
      resources:
        limits:
          memory: 512M
          cpus: "0.5"
        reservations:
          memory: 256M
          cpus: "0.25"

Rollback Strategies

Strategy 1: Image Tag Pinning

bash
# Before update: note current tag
docker compose images

# Update compose file to new tag
# If it fails: revert compose file to old tag
docker compose up -d

Strategy 2: Docker Image Tagging

bash
# Tag current image before updating
docker tag myimage:latest myimage:rollback
docker compose pull
docker compose up -d

# If it fails:
docker tag myimage:rollback myimage:latest
docker compose up -d

Strategy 3: Compose File Versioning

bash
# Keep previous compose file
cp docker-compose.yml docker-compose.yml.bak

# Deploy new version
docker compose up -d

# If it fails:
cp docker-compose.yml.bak docker-compose.yml
docker compose up -d

Troubleshooting

Container Won't Start

bash
# Check logs
docker compose logs <service>

# Check if port is already in use
ss -tlnp | grep <port>

# Check if image exists
docker images | grep <image>

# Try running interactively
docker compose run --rm <service> sh

Container Keeps Restarting

bash
# Check restart count
docker inspect <container> --format='{{.RestartCount}}'

# Check exit code
docker inspect <container> --format='{{.State.ExitCode}}'

# Check OOM kill
docker inspect <container> --format='{{.State.OOMKilled}}'

# View last logs before crash
docker logs --tail=50 <container>

Out of Disk Space

bash
# Check Docker disk usage
docker system df

# Identify large images
docker images --format "{{.Repository}}:{{.Tag}} {{.Size}}" | sort -k2 -h

# Clean up
docker system prune -f
docker image prune -a -f

Kai skill — Docker deployment and lifecycle management

Câu hỏi thường gặp

Kỹ năng AI Deployment Automation làm được gì?

Agents should invoke this skill for Docker Compose deployments, container updates, stack health checks, rollbacks, compose-file changes, image upgrades, failed deploys, or service restart planning. Provides safe deployment and rollback workflows.

Vì sao nên dùng Deployment Automation trên TypingMind?

Vì bạn chỉ cần cài một lần rồi dùng với bất kỳ mô hình nào. Deployment Automation là nội dung Markdown chứ không phải mã dành riêng cho từng nhà cung cấp, nên cùng một kỹ năng có thể chạy trên GPT-5, Claude, Gemini, Grok hoặc mô hình trên thiết bị — và bạn có thể đổi mô hình ngay trong cuộc trò chuyện mà kỹ năng vẫn hoạt động. TypingMind dùng khóa API riêng của bạn, nên bạn thanh toán trực tiếp cho nhà cung cấp thay vì trả phí thuê bao theo suất người dùng, đồng thời kỹ năng và các cuộc trò chuyện vẫn nằm trong bộ lưu trữ của bạn.

Làm thế nào để cài Deployment Automation trong TypingMind?

Mở Plugin → Kỹ năng → Cài đặt từ GitHub trong TypingMind rồi dán https://github.com/Firstp1ck/pi-coding-agent-forge/tree/main/pi-skill-deployment-automation/skills/deployment-automation. TypingMind đọc tệp SKILL.md rồi cài đặt kỹ năng để bạn có thể bật cho từng cuộc trò chuyện.

Những mô hình AI nào có thể dùng Deployment Automation?

Bất kỳ mô hình nào bạn kết nối trong TypingMind. Kỹ năng AI là các hướng dẫn bằng Markdown chứ không phải mã dành riêng cho từng nhà cung cấp, nên GPT, Claude, Gemini, Grok và các mô hình chạy trên thiết bị đều có thể tải kỹ năng này khi có yêu cầu phù hợp.

Có thể dùng Deployment Automation với bao nhiêu mô hình AI?

Bao nhiêu cũng được. Miễn là mô hình hỗ trợ kỹ năng, bạn có thể dùng Deployment Automation với mô hình đó — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama và nhiều mô hình khác — tất cả đều trên TypingMind với khóa API riêng của bạn.

Kỹ năng AI Deployment Automation có miễn phí không?

Có. Kỹ năng này được Firstp1ck phát hành trên GitHub theo giấy phép MIT. Bạn chỉ trả tiền cho nhà cung cấp AI của mình theo số token đã dùng.

Kỹ năng AI là gì?

Kỹ năng AI là một gói hướng dẫn có thể tái sử dụng, chỉ cho mô hình AI cách thực hiện một tác vụ cụ thể. Kỹ năng tuân theo định dạng mở Agent Skills: một tệp SKILL.md chứa tên và mô tả, cùng các tập lệnh, mẫu hoặc tệp tham khảo mà mô hình có thể cần. Mô hình chỉ đọc hướng dẫn khi yêu cầu của bạn phù hợp với kỹ năng, nên kỹ năng đã cài đặt không phát sinh chi phí cho đến khi được sử dụng.

Kỹ năng AI khác gì với plugin hoặc máy chủ MCP?

Plugin hoặc máy chủ MCP cung cấp các công cụ mới mà mô hình có thể gọi. Khi mô hình gọi một công cụ, mã của công cụ đó chạy ở đâu đó và trả về kết quả. Còn kỹ năng AI cung cấp kiến thức và quy trình: cách tiếp cận tác vụ, các bước cần thực hiện và những tiêu chí mà kết quả cần đáp ứng. Kỹ năng chỉ là nội dung Markdown, nên không cần máy chủ, khóa API hay môi trường thực thi và hoạt động với mọi mô hình.

Xem tất cả

Tạo ngay không gian làm việc AI riêng

Đăng ký bản tin của chúng tôi để nhận thông báo về tính năng mới và các đợt tặng quà sắp tới 👇