部署AWS Beanstalk之后执行命令 [英] Execute command after deploy AWS Beanstalk

查看:162
本文介绍了部署AWS Beanstalk之后执行命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在部署后,我有执行命令的问题,我有一些node.js项目和脚本,这个脚本从node_modules使用一些bin,如果我在.ebextensions / .config中写我的脚本命令,他在安装npm之前执行并返回错误(node_modules / .bin / some:没有这样的文件或目录)。部署后如何执行命令谢谢。

解决方案

我发现以下解决方案



我添加到beanstalk配置下一个命令:

 命令:
create_post_dir:
命令:mkdir / opt / elasticbeanstalk /钩子/ appdeploy / post
ignoreErrors:true
文件:
/opt/elasticbeanstalk/hooks/appdeploy/post/some_job.sh:
模式:000755
所有者:root
组:root
内容:|
#!/ usr / bin / env bash
/ var / app / current
npm运行some_script

此命令为挂钩脚本创建(如果不存在)文件夹,并添加bash脚本。此文件夹中的脚本仅在安装npm后执行,这对我的问题非常重要。



感谢这个人 http://junkheap.net/blog/2013/05/20/elastic-beanstalk-post-deployment-scripts/


I have problem with execute command after deploy, i have some node.js project and script, this script use some bin from node_modules, if i write my command for script in .ebextensions/.config he execute before npm install and return error ("node_modules/.bin/some": No such file or directory). How i can execute command after deploy. Thanks.

解决方案

I found the following solution

I add to beanstalk config next 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

This commands create(if not exist) folder for post-hooks scripts and adds bash script. Scripts in this folders execute only after npm install, this very important for my problem.

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

这篇关于部署AWS Beanstalk之后执行命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆