smorken/cdk

适用于 ECS Fargate/Laravel 的 CDK 辅助工具

dev-main 2024-07-10 13:55 UTC

This package is auto-updated.

Last update: 2024-09-13 14:49:01 UTC


README

从 .copy 文件创建文件

$ ./prep

初始设置

$ ./config_stack deploy
$ ./secrets_stack deploy
$ ./secrets_deploy
$ #first run
$ npm run static-config #if you want to use the local config over the aws param
$ ./pipeline_stack deploy

更新密钥

你可能需要重新部署应用程序

$ ./secrets_deploy

Lambda Artisan 命令(AWS 控制台)

使用具有层(PHP 和 Console)的 Lambda 函数

{
  "cli": "migrate --seed"
}

Lambda Artisan 命令(计划事件) config

functionProps: {
    brefRuntime: [BrefRuntime.PHP81, BrefRuntime.CONSOLE],
    scheduledEvents:
    [
        {
            schedule: 'rate(5 minutes)',
            eventInput: {cli: 'schedule:run'}
        }
    ]
}

Lambda Warmer(通过 Bref) config

distribution: {
    functionProps: {
        scheduledEvents: [
            {
                schedule: 'rate(10 minutes)',
                eventInput: {warmer: true}
            }
        ]
    }
}

其他

强制重新部署集群服务

$ aws ecs update-service --force-new-deployment --cluster pcc-sdlc-app-cluster --service pcc-sdlc-app-service --profile AWSACCOUNTID --region us-west-2

列出监听规则(获取下一个优先级)

$ aws elbv2 describe-rules --listener-arn arn:aws:elasticloadbalancing:us-west-2:... --profile PROFILE --region us-west-2

执行命令(在 Fargate 容器中)

$ aws ecs execute-command --cluster pcc-ENV-NAME-cluster --task TASKHASH --container pcc-ENV-NAME-container-phpfpm-web-u-0 --command "/bin/sh" --interactive --profile PROFILE --region us-west-2