我有一个Spring Boot应用程序,我想在Amazon Linux AMI上部署并启动它。当我使用代码部署时,出现以下错误:
LifecycleEvent - ApplicationStart
Script - application-start.sh
[stderr]bash: /opt/codedeploy-agent/deployment-root/9d89f9db-04d5-4474-bd84-ecd5b8008ae6/d-VXICFIBLY/deployment-archive/application-start.sh: Permission denied
我的appsec.yml文件如下:
version: 0.0
os: linux
files:
- source: /
destination: /data/
owner: spring
permissions:
- object: /data
owner: spring
group: spring
hooks:
AfterInstall:
- location: change-permissions.sh
timeout: 300
runas: root
ApplicationStart:
- location: application-start.sh
timeout: 90
runas: spring
创建EC2实例时,我在引导程序中创建了用户“ spring ”。 安装事件之后,/ data文件夹中application-start.sh的文件权限为:
我不确定为什么Codedeploy尝试从以下位置运行application-start.sh文件: / opt / codedeploy-agent / deployment-root / 9d89f9db-04d5-4474-bd84-ecd5b8008ae6 / d-VXICFIBLY /deployment-archive/application-start.sh
而不是 /data/applications-start.sh