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

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

问题描述

我有问题,部署后执行的命令,我有一些Node.js的项目和脚本,该脚本使用一些斌从node_modules,如果我写我的命令,在.ebextensions /的.config脚本,他执行NPM安装前和返回错误(node_modules /的.bin /一些:没有这样的文件或目录)。我怎么能部署后执行的命令。谢谢你。

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 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

此命令创建(如果不存在)的文件夹后钩子脚本,并增加了bash脚本。在此文件夹中的脚本只执行后NPM安装,这个非常重要的,我的问题。

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.

感谢这家伙的http://junkheap.net/blog/2013/05/20/elastic-beanstalk-post-deployment-scripts/

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

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