algethamy/laravel-ack-deploy
Composer 安装命令:
composer require algethamy/laravel-ack-deploy
包简介
Laravel package for easy deployment to Alibaba Cloud Container Service for Kubernetes (ACK)
README 文档
README
A Laravel package that simplifies deployment to Alibaba Cloud Container Service for Kubernetes (ACK). This package automatically generates Docker configurations, Kubernetes manifests, and deployment scripts optimized for ACK clusters.
Features
- 🚀 One-command setup - Generate all ACK deployment files instantly
- 🐳 Optimized Dockerfiles - Production-ready PHP 8.3 + Apache containers
- ☸️ Complete K8s Manifests - Deployments, Services, Ingress, HPA, ConfigMaps
- 💰 Cost-optimized scaling - Smart auto-scaling with minimal resource usage
- 🔧 Artisan commands - Easy build, deploy, and management
- 🌍 Multi-region support - Support for all ACK regions
- ⚡ Production ready - Includes health checks, resource limits, and best practices
Installation
Install via Composer:
composer require algethamy/laravel-ack-deploy
Quick Start
1. Initialize ACK Configuration
php artisan ack:init
This will create:
Dockerfile.ack- Optimized Docker configurationk8s/directory with Kubernetes manifestsdeploy-ack.sh- Deployment script.env.ack- Environment template
2. Build Docker Image
# Build only php artisan ack:build # Build and push to registry php artisan ack:build --push
3. Deploy to ACK
# Deploy with existing image php artisan ack:deploy # Build, push, and deploy in one command php artisan ack:deploy --build --wait
Configuration
Environment Variables
Add these to your .env file:
# ACK Configuration APP_NAME=my-laravel-app DOCKER_REGISTRY=registry.me-central-1.aliyuncs.com K8S_NAMESPACE=production DOMAIN=myapp.com # Resource Configuration (optional) ACK_CPU_REQUEST=50m ACK_MEMORY_REQUEST=64Mi ACK_CPU_LIMIT=200m ACK_MEMORY_LIMIT=256Mi ACK_MIN_REPLICAS=1 ACK_MAX_REPLICAS=5 ACK_CPU_THRESHOLD=70
Advanced Configuration
Customize the generated files in the k8s/ directory:
deployment.yaml- Container deployment configurationservice.yaml- LoadBalancer serviceingress.yaml- Ingress routing ruleshpa.yaml- Horizontal Pod Autoscalerconfigmap.yaml- Environment variables
Commands
ack:init
Initialize ACK deployment configuration:
php artisan ack:init --app-name=myapp --registry=registry.me-central-1.aliyuncs.com
Options:
--app-name- Application name--registry- Docker registry URL--namespace- Kubernetes namespace--domain- Application domain
ack:build
Build Docker image for ACK deployment:
php artisan ack:build --tag=v1.0.0 --push
Options:
--tag- Docker image tag (default: latest)--registry- Override registry URL--push- Push image to registry after build
ack:deploy
Deploy application to ACK cluster:
php artisan ack:deploy --namespace=production --build --wait
Options:
--namespace- Kubernetes namespace--build- Build and push image before deploying--wait- Wait for deployment to be ready
Prerequisites
Local Environment
- Docker Desktop or Docker Engine
- kubectl configured for your ACK cluster
- PHP 8.1+ with Composer
ACK Cluster Setup
-
Create ACK Cluster in Alibaba Cloud Console
-
Configure kubectl access:
# Download kubeconfig from ACK console export KUBECONFIG=./kubeconfig.yaml kubectl get nodes
-
Set up Container Registry access:
docker login registry.me-central-1.aliyuncs.com
Generated Files
Dockerfile.ack
Production-optimized Docker image with:
- PHP 8.3 + Apache
- Composer dependencies
- Laravel optimizations
- Security best practices
- Health check support
Kubernetes Manifests
deployment.yaml
- Cost-optimized resource requests (50m CPU, 64Mi RAM)
- Health checks and probes
- Environment configuration
- Rolling update strategy
service.yaml
- LoadBalancer for external access
- Port 80/443 configuration
hpa.yaml
- Auto-scaling from 1-5 pods
- CPU-based scaling (70% threshold)
- Smart scale-down delays
ingress.yaml
- Domain-based routing
- SSL/TLS ready
- Nginx ingress controller
configmap.yaml
- Laravel environment variables
- Database configuration
- Cache settings
Cost Optimization
This package is designed for cost-efficient ACK deployments:
Resource Efficiency
- Minimal baseline: 50m CPU, 64Mi RAM per pod
- Smart scaling: Only scales up when CPU > 70%
- Scale-to-minimum: Returns to 1 pod during low traffic
Estimated Costs
- Small app (1 pod): ~$5-10/month
- Medium load (2-3 pods): ~$15-25/month
- High load (5 pods): ~$30-50/month
Costs depend on ACK cluster configuration and region
Multi-Region Support
Supported ACK regions:
| Region | Location | Registry Endpoint |
|---|---|---|
me-central-1 |
Saudi Arabia (Riyadh) | registry.me-central-1.aliyuncs.com |
me-east-1 |
UAE (Dubai) | registry.me-east-1.aliyuncs.com |
ap-southeast-1 |
Singapore | registry.ap-southeast-1.aliyuncs.com |
us-west-1 |
US West | registry.us-west-1.aliyuncs.com |
eu-west-1 |
UK (London) | registry.eu-west-1.aliyuncs.com |
Troubleshooting
Common Issues
Docker build fails:
# Check Docker is running docker version # Clear Docker cache docker system prune -f
kubectl connection fails:
# Check cluster connectivity kubectl cluster-info # Verify kubeconfig kubectl config view
Deployment not ready:
# Check pod logs kubectl logs deployment/myapp-app -n production # Check pod status kubectl describe pods -l app=myapp-app -n production
No external IP assigned:
# Check LoadBalancer service kubectl get service myapp-service -n production # Check service events kubectl describe service myapp-service -n production
Best Practices
Security
- Use environment variables for sensitive data
- Enable RBAC in your ACK cluster
- Keep Docker images updated
- Use private container registries
Performance
- Set appropriate resource limits
- Use health checks
- Enable horizontal pod autoscaling
- Monitor application metrics
Cost Optimization
- Use cost-efficient resource requests
- Enable cluster autoscaling
- Monitor resource usage
- Schedule non-production workloads
Contributing
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
License
This package is open-sourced software licensed under the MIT license.
Support
- 📖 Documentation
- 🐛 Issues
- 💬 Discussions
Credits
- Built with ❤️ for the Laravel community
- Optimized for Alibaba Cloud ACK
- Inspired by Laravel Sail and Laravel Forge
algethamy/laravel-ack-deploy 适用场景与选型建议
algethamy/laravel-ack-deploy 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 14 次下载、GitHub Stars 达 0, 最近一次更新时间为 2025 年 09 月 13 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「laravel」 「deployment」 「docker」 「kubernetes」 「alibaba-cloud」 「ack」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 algethamy/laravel-ack-deploy 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 algethamy/laravel-ack-deploy 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 algethamy/laravel-ack-deploy 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Automated deployment template for Laravel Envoy based on Capistrano.
Docker based testing environment for shopware projects.
Morpht Development Tools
blueways deployer recipes
The Laragoon utility package
Docker compose for Robo Task Runner
统计信息
- 总下载量: 14
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 11
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-09-13