Run command after deploying AWS Beanstalk

I have a problem with the execute command after deployment, I have a node.js project and a script, this script uses some bit from node_modules, if I write my command for the script in .ebextensions / .config is executed before npm installation and return error ( "node_modules/.bin/some": No such file or directory) . How can I execute the command after deployment. Thank.

+4
source share
3 answers

I found the following solution

I add the following beanstalk config command:

commands:
  create_post_dir:
    command: "mkdir /opt/elasticbeanstalk/hooks/appdeploy/post"
    ignoreErrors: true
files:
  "/opt/elasticbeanstalk/hooks/appdeploy/post/some_job.sh":
    mode: "000755"
    owner: root
    group: root
    content: |
      #!/usr/bin/env bash
      /var/app/current
      npm run some_script

( ) post-hooks bash script. npm, .

http://junkheap.net/blog/2013/05/20/elastic-beanstalk-post-deployment-scripts/

+7

.ebextensions/post_actions.config:

container_commands:
 <name of container_command>:
    command: "<command to run>"

, , .

+1

AWS ebextensions, , , , .

" container_commands . container_ . , , ."

, ; , . , , , , , .

-1

All Articles