·
Added a discussion

Curious if anyone has done this and if so, how do you handle getting rid of the "install" directory after you have configured your site? I have success in configuring the site with Amazon RDS, but cannot figure out how to delete the "install" directory to the installed version.

  • 1075
Comments
    • Or, how do you work around not being able to remove the "install" directory? The way Elastic Beanstalk works is really a deployment package, in this case the Una Directory of the packaged app as a .zip file. Once that is uploaded, I can run through the install correctly, but I am getting hung up on the "remove install directory" need.

      • Per AWS:

        To get to the point, it is possible to delete the directory after installation.

        You can reserve set of jobs to install, delete directories or other assets at various point of times.

        I recommend you to refer to ‘Platform hooks’ section in our document about ‘Extending Elastic Beanstalk Linux platforms’ [1].

        The document says:

        ‘Platform hooks are specifically designed to extend your environment's platform. These are custom scripts and other executable files that you deploy as part of your application's source code, and Elastic Beanstalk runs during various instance provisioning stages.’

        Platform hooks can operate at:

        1) before building your application (prebuild)

        2) before deployment (predeploy)

        3) after deployment (postdeploy)

        To utilize platform hooks, you have to place the platform hook files under the .platform/hooks directory in your environment.

        Like this:

        --------------------

        ~/your-app-directory/

        |— .platform

        | └-- hooks

        | |-- prebuild\t\t← Put files here if you want the jobs to be run before build

        | |-- predeploy\t \t← Put files here if you want the jobs to be run before deployment

        | └-- postdeploy\t← Put files here if you want the jobs to be run after deployment

        |

        └-- other application files or directories

        --------------------

        Platform hooks are *.sh files, so you can just write shell scripts to install and delete directories.

        And platform hook files need execute permission, so you have to grant x permission to your platform hooks.

        You can give permission to files with .ebextentions [2].

        If you want to learn more about .ebextensions, please check out ‘Configuration files’ section in our document [1].

        Here is an example of .ebextention file.

        ------example.config------

        add_x_permission_to_platform_hooks:

        command: “chmod +x .platform/hooks/postdeploy/delete_directory.sh”

        ----------------------------

        And .ebextensions files should be placed under the .ebextentions directory in your environment.

        Like this:

        --------------------

        ~/your-app-directory/

        |— .ebextensions

        | |-- example.config\t← Put files here

        | └-- other .config files

        |

        └-- other application files or directories

        --------------------

        Login or Join to comment.