更新解决方案: 我没有压缩目录,而是选择了目录中的所有文件和文件夹并对其进行了压缩。然后我将压缩文件夹的权限更改为777。 此外,在efs-mount.config文件中,我将命令更改为:
1chown:
command: "chown webapp:webapp /drupalfiles"
2create:
command: "sudo -u webapp mkdir -p sites/default/files"
3link:
command: "sudo -u webapp ln -s /drupalfiles sites/default/files"
原始问题:
我对AWS和Drupal都很新。
我正在尝试按照此文档在AWS Elastic Beanstalk上安装Drupal 8:
当我进入"启动Elastic Beanstalk环境"时,我不断收到此错误,我永远无法进入Drupal 8安装屏幕。
命令在实例上失败。返回码:1输出:ln:无法创建符号链接' sites / default / files':没有这样的文件或目录。 elastic-beanstalk / .ebextensions / efs-mount.config中的container_command 2link失败。有关更多详细信息,请使用控制台或EB CLI检查/var/log/eb-activity.log。
我已确保将此文件夹和所有递归文件夹权限设置为读取和写入。
活动记录:
[2018-02-19T19:15:07.237Z] INFO [31021] - [Application restart/AddonsBefore] : Starting activity...
[2018-02-19T19:15:07.237Z] INFO [31021] - [Application restart/AddonsBefore/ConfigCWLAgent] : Starting activity...
[2018-02-19T19:15:07.237Z] INFO [31021] - [Application restart/AddonsBefore/ConfigCWLAgent/10-config.sh] : Starting activity...
[2018-02-19T19:15:07.495Z] INFO [31021] - [Application restart/AddonsBefore/ConfigCWLAgent/10-config.sh] : Completed activity. Result:
Log streaming option setting is not specified, ignore cloudwatch logs setup.
Disabled log streaming.
[2018-02-19T19:15:07.495Z] INFO [31021] - [Application restart/AddonsBefore/ConfigCWLAgent] : Completed activity. Result:
Successfully execute hooks in directory /opt/elasticbeanstalk/addons/logstreaming/hooks/config.
[2018-02-19T19:15:07.495Z] INFO [31021] - [Application restart/AddonsBefore] : Completed activity.
[2018-02-19T19:15:07.496Z] INFO [31021] - [Application restart/RestartAppServerStage0] : Starting activity...
[2018-02-19T19:15:07.496Z] INFO [31021] - [Application restart/RestartAppServerStage0/RestartAppServerPreHook] : Starting activity...
[2018-02-19T19:15:07.496Z] INFO [31021] - [Application restart/RestartAppServerStage0/RestartAppServerPreHook/10_configure_php.sh] : Starting activity...
[2018-02-19T19:15:08.567Z] INFO [31021] - [Application restart/RestartAppServerStage0/RestartAppServerPreHook/10_configure_php.sh] : Completed activity. Result:
Using configuration value for DocumentRoot:
[2018-02-19T19:15:08.567Z] INFO [31021] - [Application restart/RestartAppServerStage0/RestartAppServerPreHook] : Completed activity. Result:
Successfully execute hooks in directory /opt/elasticbeanstalk/hooks/restartappserver/pre.
[2018-02-19T19:15:08.567Z] INFO [31021] - [Application restart/RestartAppServerStage0] : Completed activity. Result:
Application restart - Command CMD-RestartAppServer stage 0 completed
[2018-02-19T19:15:08.567Z] INFO [31021] - [Application restart/RestartAppServerStage1] : Starting activity...
[2018-02-19T19:15:08.568Z] INFO [31021] - [Application restart/RestartAppServerStage1/RestartAppServerEnactHook] : Starting activity...
[2018-02-19T19:15:08.568Z] INFO [31021] - [Application restart/RestartAppServerStage1/RestartAppServerEnactHook/01_restart.sh] : Starting activity...
[2018-02-19T19:15:08.680Z] INFO [31021] - [Application restart/RestartAppServerStage1/RestartAppServerEnactHook/01_restart.sh] : Completed activity. Result:
Equivalent Upstart operations: start httpd, stop httpd, restart httpd, status httpd
Stopping httpd
httpd stop/waiting
Starting httpd
httpd start/running, process 31087
[OK]
[2018-02-19T19:15:08.680Z] INFO [31021] - [Application restart/RestartAppServerStage1/RestartAppServerEnactHook] : Completed activity. Result:
Successfully execute hooks in directory /opt/elasticbeanstalk/hooks/restartappserver/enact.
[2018-02-19T19:15:08.680Z] INFO [31021] - [Application restart/RestartAppServerStage1/RestartAppServerPostHook] : Starting activity...
[2018-02-19T19:15:08.681Z] INFO [31021] - [Application restart/RestartAppServerStage1/RestartAppServerPostHook] : Completed activity. Result:
Successfully execute hooks in directory /opt/elasticbeanstalk/hooks/restartappserver/post.
[2018-02-19T19:15:08.681Z] INFO [31021] - [Application restart/RestartAppServerStage1] : Completed activity. Result:
Application restart - Command CMD-RestartAppServer stage 1 completed
[2018-02-19T19:15:08.681Z] INFO [31021] - [Application restart/AddonsAfter] : Starting activity...
[2018-02-19T19:15:08.681Z] INFO [31021] - [Application restart/AddonsAfter/ConfigLogRotation] : Starting activity...
[2018-02-19T19:15:08.682Z] INFO [31021] - [Application restart/AddonsAfter/ConfigLogRotation/10-config.sh] : Starting activity...
[2018-02-19T19:15:09.048Z] INFO [31021] - [Application restart/AddonsAfter/ConfigLogRotation/10-config.sh] : Completed activity. Result:
Disabled forced hourly log rotation.
[2018-02-19T19:15:09.048Z] INFO [31021] - [Application restart/AddonsAfter/ConfigLogRotation] : Completed activity. Result:
Successfully execute hooks in directory /opt/elasticbeanstalk/addons/logpublish/hooks/config.
[2018-02-19T19:15:09.048Z] INFO [31021] - [Application restart/AddonsAfter] : Completed activity.
[2018-02-19T19:15:09.048Z] INFO [31021] - [Application restart] : Completed activity. Result:
Application restart - Command CMD-RestartAppServer succeeded
[2018-02-19T19:34:27.980Z] INFO [31597] - [Configuration update drupal-8.4.4@3] : Starting activity...
[2018-02-19T19:34:27.981Z] INFO [31597] - [Configuration update drupal-8.4.4@3/AddonsBefore] : Starting activity...
[2018-02-19T19:34:27.981Z] INFO [31597] - [Configuration update drupal-8.4.4@3/AddonsBefore/ConfigCWLAgent] : Starting activity...
[2018-02-19T19:34:27.981Z] INFO [31597] - [Configuration update drupal-8.4.4@3/AddonsBefore/ConfigCWLAgent/10-config.sh] : Starting activity...
[2018-02-19T19:34:28.241Z] INFO [31597] - [Configuration update drupal-8.4.4@3/AddonsBefore/ConfigCWLAgent/10-config.sh] : Completed activity. Result:
Log streaming option setting is not specified, ignore cloudwatch logs setup.
Disabled log streaming.
[2018-02-19T19:34:28.241Z] INFO [31597] - [Configuration update drupal-8.4.4@3/AddonsBefore/ConfigCWLAgent] : Completed activity. Result:
Successfully execute hooks in directory /opt/elasticbeanstalk/addons/logstreaming/hooks/config.
[2018-02-19T19:34:28.241Z] INFO [31597] - [Configuration update drupal-8.4.4@3/AddonsBefore] : Completed activity.
[2018-02-19T19:34:28.242Z] INFO [31597] - [Configuration update drupal-8.4.4@3/ConfigDeployStage0] : Starting activity...
[2018-02-19T19:34:28.242Z] INFO [31597] - [Configuration update drupal-8.4.4@3/ConfigDeployStage0/ConfigDeployPreHook] : Starting activity...
[2018-02-19T19:34:28.244Z] INFO [31597] - [Configuration update drupal-8.4.4@3/ConfigDeployStage0/ConfigDeployPreHook/10_setup_envvars.sh] : Starting activity...
[2018-02-19T19:34:28.709Z] INFO [31597] - [Configuration update drupal-8.4.4@3/ConfigDeployStage0/ConfigDeployPreHook/10_setup_envvars.sh] : Completed activity.
[2018-02-19T19:34:28.710Z] INFO [31597] - [Configuration update drupal-8.4.4@3/ConfigDeployStage0/ConfigDeployPreHook/20_configure_php.sh] : Starting activity...
[2018-02-19T19:34:29.736Z] INFO [31597] - [Configuration update drupal-8.4.4@3/ConfigDeployStage0/ConfigDeployPreHook/20_configure_php.sh] : Completed activity. Result:
Using configuration value for DocumentRoot:
[2018-02-19T19:34:29.736Z] INFO [31597] - [Configuration update drupal-8.4.4@3/ConfigDeployStage0/ConfigDeployPreHook] : Completed activity. Result:
Successfully execute hooks in directory /opt/elasticbeanstalk/hooks/configdeploy/pre.
[2018-02-19T19:34:29.736Z] INFO [31597] - [Configuration update drupal-8.4.4@3/ConfigDeployStage0] : Completed activity. Result:
Configuration update - Command CMD-ConfigDeploy stage 0 completed
[2018-02-19T19:34:29.736Z] INFO [31597] - [Configuration update drupal-8.4.4@3/ConfigDeployStage1] : Starting activity...
[2018-02-19T19:34:29.737Z] INFO [31597] - [Configuration update drupal-8.4.4@3/ConfigDeployStage1/ConfigDeployEnactHook] : Starting activity...
[2018-02-19T19:34:29.738Z] INFO [31597] - [Configuration update drupal-8.4.4@3/ConfigDeployStage1/ConfigDeployEnactHook/99_reload_app_server.sh] :
Starting activity...
[2018-02-19T19:34:29.851Z] INFO [31597] - [Configuration update drupal-8.4.4@3/ConfigDeployStage1/ConfigDeployEnactHook/99_reload_app_server.sh] : Completed activity. Result:
Equivalent Upstart operations: start httpd, stop httpd, restart httpd, status httpd
Stopping httpd
httpd stop/waiting
Starting httpd
httpd start/running, process 31677
[OK]
[2018-02-19T19:34:29.851Z] INFO [31597] - [Configuration update drupal-8.4.4@3/ConfigDeployStage1/ConfigDeployEnactHook] : Completed activity. Result:
Successfully execute hooks in directory /opt/elasticbeanstalk/hooks/configdeploy/enact.
[2018-02-19T19:34:29.851Z] INFO [31597] - [Configuration update drupal-8.4.4@3/ConfigDeployStage1/ConfigDeployPostHook] : Starting activity...
[2018-02-19T19:34:29.852Z] INFO [31597] - [Configuration update drupal-8.4.4@3/ConfigDeployStage1/ConfigDeployPostHook] : Completed activity. Result:
Successfully execute hooks in directory /opt/elasticbeanstalk/hooks/configdeploy/post.
[2018-02-19T19:34:29.852Z] INFO [31597] - [Configuration update drupal-8.4.4@3/ConfigDeployStage1] : Completed activity. Result:
Application restart - Command CMD-ConfigDeploy stage 1 completed
[2018-02-19T19:34:29.852Z] INFO [31597] - [Configuration update drupal-8.4.4@3/AddonsAfter] : Starting activity...
[2018-02-19T19:34:29.852Z] INFO [31597] - [Configuration update drupal-8.4.4@3/AddonsAfter/ConfigLogRotation] : Starting activity...
[2018-02-19T19:34:29.853Z] INFO [31597] - [Configuration update drupal-8.4.4@3/AddonsAfter/ConfigLogRotation/10-config.sh] : Starting activity...
[2018-02-19T19:34:30.244Z] INFO [31597] - [Configuration update drupal-8.4.4@3/AddonsAfter/ConfigLogRotation/10-config.sh] : Completed activity. Result:
Disabled forced hourly log rotation.
[2018-02-19T19:34:30.244Z] INFO [31597] - [Configuration update drupal-8.4.4@3/AddonsAfter/ConfigLogRotation] : Completed activity. Result:
Successfully execute hooks in directory /opt/elasticbeanstalk/addons/logpublish/hooks/config.
[2018-02-19T19:34:30.244Z] INFO [31597] - [Configuration update drupal-8.4.4@3/AddonsAfter] : Completed activity.
[2018-02-19T19:34:30.244Z] INFO [31597] - [Configuration update drupal-8.4.4@3] : Completed activity. Result:
Configuration update - Command CMD-ConfigDeploy succeeded
[2018-02-19T19:44:06.592Z] INFO [32014] - [CMD-TailLogs] : Starting activity...
[2018-02-19T19:44:06.592Z] INFO [32014] - [CMD-TailLogs/AddonsBefore] : Starting activity...
[2018-02-19T19:44:06.592Z] INFO [32014] - [CMD-TailLogs/AddonsBefore] : Completed activity.
[2018-02-19T19:44:06.592Z] INFO [32014] - [CMD-TailLogs/TailLogs] : Starting activity...
[2018-02-19T19:44:06.593Z] INFO [32014] - [CMD-TailLogs/TailLogs/TailLogs] : Starting activity...
efs-mount.config文件:
##############################################
#### Do not modify values below this line ####
##############################################
container_commands:
1chown:
command: "chown webapp:webapp /drupalfiles"
2link:
command: "sudo -u webapp ln -s /drupalfiles sites/default/files"
option_settings:
aws:elasticbeanstalk:application:environment:
EFS_VOLUME_ID: '`{"Ref" : "FileSystem"}`'
EFS_MOUNT_DIR: '/drupalfiles'
EFS_REGION: '`{"Ref": "AWS::Region"}`'
packages:
yum:
nfs-utils: []
jq: []
commands:
01_mount:
command: "/tmp/mount-efs.sh"
files:
"/tmp/mount-efs.sh":
mode: "000755"
content : |
#!/bin/bash
EFS_REGION=$(/opt/elasticbeanstalk/bin/get-config environment | jq -r '.EFS_REGION')
EFS_MOUNT_DIR=$(/opt/elasticbeanstalk/bin/get-config environment | jq -r '.EFS_MOUNT_DIR')
EFS_VOLUME_ID=$(/opt/elasticbeanstalk/bin/get-config environment | jq -r '.EFS_VOLUME_ID')
echo "Mounting EFS filesystem ${EFS_DNS_NAME} to directory ${EFS_MOUNT_DIR} ..."
echo 'Stopping NFS ID Mapper...'
service rpcidmapd status &> /dev/null
if [ $? -ne 0 ] ; then
echo 'rpc.idmapd is already stopped!'
else
service rpcidmapd stop
if [ $? -ne 0 ] ; then
echo 'ERROR: Failed to stop NFS ID Mapper!'
exit 1
fi
fi
echo 'Checking if EFS mount directory exists...'
if [ ! -d ${EFS_MOUNT_DIR} ]; then
echo "Creating directory ${EFS_MOUNT_DIR} ..."
mkdir -p ${EFS_MOUNT_DIR}
if [ $? -ne 0 ]; then
echo 'ERROR: Directory creation failed!'
exit 1
fi
chmod 777 ${EFS_MOUNT_DIR}
if [ $? -ne 0 ]; then
echo 'ERROR: Permission update failed!'
exit 1
fi
else
echo "Directory ${EFS_MOUNT_DIR} already exists!"
fi
mountpoint -q ${EFS_MOUNT_DIR}
if [ $? -ne 0 ]; then
AZ=$(curl -s http://169.254.169.254/latest/meta-data/placement/availability-zone)
echo "mount -t nfs4 -o nfsvers=4.1 ${AZ}.${EFS_VOLUME_ID}.efs.${EFS_REGION}.amazonaws.com:/ ${EFS_MOUNT_DIR}"
mount -t nfs4 -o nfsvers=4.1 ${AZ}.${EFS_VOLUME_ID}.efs.${EFS_REGION}.amazonaws.com:/ ${EFS_MOUNT_DIR}
if [ $? -ne 0 ] ; then
echo 'ERROR: Mount command failed!'
exit 1
fi
else
echo "Directory ${EFS_MOUNT_DIR} is already a valid mountpoint!"
fi
echo 'EFS mount complete.'
答案 0 :(得分:0)
更新解决方案:
在efs-mount.config文件中,我将命令更改为:
1chown:
command: "chown webapp:webapp /drupalfiles"
2create:
command: "sudo -u webapp mkdir -p sites/default/files"
3link:
command: "sudo -u webapp ln -s /drupalfiles sites/default/files"
我使用以下命令更改了文件夹的权限:
chmod -R 777 /drupal-beanstalk
我没有压缩目录本身,而是选择了目录中的所有文件和文件夹并对其进行了压缩。我使用以下命令从压缩文件夹中删除了.MACOSX:
zip -d filename.zip __MACOSX/\*
将此文件夹上传到AWS Elastic Beanstalk时,该应用程序为绿色健康状况,URL打开了Drupal安装页面。