'Problems deploying wordpress in updated elsatic beanstalk environment

I wanted to update my environment to one that has php version 8. I configured it with the same variables as the environment I have running with php 7.2, and I deployed it with the example application that comes in elastic beanstalk.. the environment status is OKAY. When I want to deploy wordpress, it throws me an error when trying to create the symbolic link in /wp-content/uploads (since I have efs/uploads).

This is the cfn-init.log:

[INFO] Command 01-rm-wp-content-uploads succeeded
2022-03-28 14:35:20,329 
[ERROR] Command 02-symlink-uploads (ln -snf $(/opt/elasticbeanstalk/bin/get-config environment | jq -r '.EFS_UP_DIR') /var/app/ondeck/wp-content/uploads) failed
2022-03-28 14:35:20,329 
[ERROR] Error encountered during build of postbuild_0_Conclusion: Command 02-symlink-uploads failed
Traceback (most recent call last):
  File "/usr/lib/python3.7/site-packages/cfnbootstrap/construction.py", line 576, in run_config
    CloudFormationCarpenter(config, self._auth_config).build(worklog)
  File "/usr/lib/python3.7/site-packages/cfnbootstrap/construction.py", line 276, in build
    self._config.commands)
  File "/usr/lib/python3.7/site-packages/cfnbootstrap/command_tool.py", line 127, in apply
    raise ToolError(u"Command %s failed" % name)
cfnbootstrap.construction_errors.ToolError: Command 02-symlink-uploads failed
2022-03-28 14:35:20,331 [ERROR]

efs.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 $(/opt/elasticbeanstalk/bin/get-config environment | jq -r '.EFS_UP_DIR')
          chown webapp:webapp $(/opt/elasticbeanstalk/bin/get-config environment | jq -r '.EFS_UP_DIR')
          mkdir -p $(/opt/elasticbeanstalk/bin/get-config environment | jq -r '.EFS_CACHE_DIR')
          chown webapp:webapp $(/opt/elasticbeanstalk/bin/get-config environment | jq -r '.EFS_CACHE_DIR')
          mkdir -p /mnt/efs/datafactory
          chown :webapp /mnt/efs/datafactory -R
          mkdir -p /mnt/efs/pub
          chown :webapp /mnt/efs/pub -R
    commands:
      01_mount:
        command: "/tmp/mount-efs.sh"
    container_commands:
      01-rm-wp-content-uploads:
        command: rm -rf /var/app/ondeck/wp-content/uploads
      02-symlink-uploads:
        command: ln -snf $(/opt/elasticbeanstalk/bin/get-config environment | jq -r '.EFS_UP_DIR') /var/app/ondeck/wp-content/uploads
      03-rm-wp-content-cache:
        command: rm -rf /var/app/ondeck/wp-content/cache
      04-symlink-cache:
        command: ln -snf $(/opt/elasticbeanstalk/bin/get-config environment | jq -r '.EFS_CACHE_DIR') /var/app/ondeck/wp-content/cache
      05-rm-wp-datafactory:
        command: rm -rf /var/app/ondeck/html
      06-symlink-datafactory:
        command: ln -snf /mnt/efs/datafactory /var/app/ondeck/html
      07-rm-wp-publicidad:
        command: rm -rf /var/app/ondeck/publicidad
      08-symlink-publicidad:
        command: ln -snf /mnt/efs/pub /var/app/ondeck/publicidad

the efs.config file is the same one I use to deploy the changes in my production environment and I have no problems, but in this new one with version 8 of php I do have



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source