我们有一个相当简单的node.js应用程序,但由于AWS Elastic Beanstalk部署机制,git aws.push
即使在单个文件提交后,也需要大约5分钟来推出新版本(通过).
即提交本身(和上传)很快(只有1个文件要推送),但随后Elastic Beanstalk从S3获取整个包,解压缩并运行npm install
,这会导致node-gyp编译一些模块.安装/构建完成后,Elastic Beanstalk会擦除/var/app/current
并替换为新的应用程序版本.
毋庸置疑,不需要进行常规node_modules重建,并且在我的旧Macbook Air上重建需要30秒,在ec2.micro实例上花费大约5分钟,并不好玩.
我在这里看到两种方法:
/opt/containerfiles/ebnode.py
并使用node_modules位置以避免在部署时删除和重建.npm install
只在必要时接收推送和运行(这使得Elastic Beanstalk看起来像OpsWorks ..)当Amazon更新其Elastic Beanstalk挂钩和架构时,这两个选项都缺乏优势并且容易出现问题.
也许有人有更好的想法如何避免不断重建已存在于app dir中的node_modules?谢谢.
git amazon-web-services node.js npm amazon-elastic-beanstalk