【问题标题】:EFS symlink fails while deployingEFS 符号链接在部署时失败
【发布时间】:2021-07-13 02:48:09
【问题描述】:

所以我使用 AWS Elastic Beanstalk 为我的 PHP 应用程序提供服务。我想挂载 EFS 以永久存储通过我的应用程序上传的图像。 我创建了 .ebextensions 文件夹并使用以下代码创建了一个名为 mount.config 的文件

packages:
  yum:
    nfs-utils: []
    jq: []
files:
  "/tmp/mount-efs.sh" :
    mode: "000755"
    content: |
      #!/usr/bin/env bash
      mkdir -p /mnt/efs
      EFS_NAME=$(/opt/elasticbeanstalk/bin/get-config environment | jq -r '.EFS_NAME')
      mount -t nfs4 -o nfsvers=4.1,rsize=1048576,wsize=1048576,hard,timeo=600,retrans=2 $EFS_NAME:/ /mnt/efs || true
      mkdir -p /mnt/efs/questions
      chown webapp:webapp /mnt/efs/questions
commands:
  01_mount:
    command: "/tmp/mount-efs.sh"
container_commands:
  01-symlink-uploads:
    command: ln -s /mnt/efs/questions /var/app/ondeck/images/

一切正常,直到最后一行未能创建符号链接。

到目前为止我所尝试的:

  • 直接在机器上运行命令,同时更改 ondeck -> current。这很好用。
  • 删除 EC2 实例并添加一个新实例。仍然失败

在我看到的日志中

ln: 未能创建符号链接 '/var/app/current/images/questions': 没有这样的文件或目录

任何建议可能是什么原因?

【问题讨论】:

    标签: amazon-web-services amazon-elastic-beanstalk config amazon-efs ebextensions


    【解决方案1】:

    好的,我通过将 ondeck 替换为 staging

    来修复它

    并在 container_commands 下添加这一行:

      01-change-permission:
        command: chmod -R 777 /var/app/staging/images
    

    【讨论】:

      猜你喜欢
      • 2020-10-08
      • 2016-10-14
      • 2022-11-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多