大佬教程收集整理的这篇文章主要介绍了npm 脚本创建一个子进程以在弹性 beantalk 错误上运行数据库迁移,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
使用 ELB、docker、POSTGRes 和调用
我有一个问题,只有在我部署到弹性 beantalk 时才会发生。我有一个 sHell 脚本 init.sh,它在调用 npm run start 之前调用 npm run db-migrations
。 db-migrations
是我的 package.Json 中定义为
"db-migrations": ts-node-dev ./getDatabaseKeys.ts -- 'sequelize db:migrate'
init.sh 是从我的 docker 文件中调用的
CMD [ "./init.sh" ]
getDatabaseKeys 将登录安全密钥存储,下载密钥,设置正确的 env.process 变量,然后使用
调用 exec exec(
process.argv[2],{ env: process.env },err => (err
? reject(err)
: resolve(null)
)
);
process.argv[2]
将是 sequelize: db:migrate
这在我的开发环境中本地运行良好,但是当我部署到弹性 beantalk 时,实例变得无响应,并且在等待了很长时间后,我终于可以通过 ssh 进入它并检查日志
如果我检查 /var/log/eb-docker/containers/eb-current-app/eb-stdouterr.log
我明白了
Attaching to current_myApp_1,current_POSTGRes_1
myApp_1 | [INFO] 22:12:24 ts-node-dev ver. 1.1.1 (using ts-node ver. 9.1.1,typescript ver. 4.1.3)
myApp_1 | AttempTing to load database parameters
myApp_1 | successful. Loaded database parameters into environment
myApp_1 | ExecuTing sequelize db:migrate...
POSTGRes_1 | 2021-02-06 22:26:24.790 UTC [77] WARNING: worker took too long to start; canceled
POSTGRes_1 | 2021-02-06 22:26:34.621 UTC [87] WARNING: autoVACUUM worker started without a worker entry
POSTGRes_1 | 2021-02-06 22:37:19.216 UTC [77] WARNING: worker took too long to start; canceled
POSTGRes_1 | 2021-02-06 22:37:30.810 UTC [89] WARNING: autoVACUUM worker started without a worker entry
POSTGRes_1 | 2021-02-06 22:43:53.674 UTC [77] WARNING: worker took too long to start; canceled
POSTGRes_1 | 2021-02-06 22:44:02.764 UTC [91] WARNING: autoVACUUM worker started without a worker entry
myApp_1 |
myApp_1 | Sequelize Cli [Node: 12.19.0,Cli: 6.2.0,ORM: 5.21.11]
myApp_1 |
myApp_1 | Loaded configuration file "sequelize.config.Js".
myApp_1 | Using environment "production".
myApp_1 | (node:25) UnhandledPromiseRejectionWarning: Error: Command Failed: sequelize db:migrate
myApp_1 |
myApp_1 | at ChildProcess.exithandler (child_process.Js:308:12)
myApp_1 | at ChildProcess.emit (events.Js:314:20)
myApp_1 | at ChildProcess.EventEmitter.emit (domain.Js:483:12)
myApp_1 | at maybeClose (internal/child_process.Js:1021:16)
myApp_1 | at Socket.<anonymous> (internal/child_process.Js:443:11)
myApp_1 | at Socket.emit (events.Js:314:20)
myApp_1 | at Socket.EventEmitter.emit (domain.Js:483:12)
myApp_1 | at Pipe.<anonymous> (net.Js:676:12)
myApp_1 | (node:25) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing insIDe of an async function without a catch block,or by rejecTing a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection,use the Cli flag `--unhandled-rejections=Strict` (see https://nodeJs.org/API/cli.HTML#cli_unhandled_rejections_modE). (rejection ID: 1)
myApp_1 | (node:25) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future,promise rejections that are not handled will terminate the Node.Js process with a non-zero exit code.
谷歌搜索“worker花了太长时间启动;已取消”或“autoVACUUM worker在没有worker条目的情况下启动”给了我关于POSTGRes(我的数据库)的点击。我很困惑为什么这个错误会起源于 POSTGRes ......除非它是关于无法连接到进度......但是什么是 autoVACUUM(我的理解是这用于清除记录已被删除的表/修改)。
我对这些错误的来源感到困惑......它真的是 POSTGRes 还是因为我使用了 exec 调用而 ELB 不喜欢它......或者完全是其他的东西。
谢谢
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)
以上是大佬教程为你收集整理的npm 脚本创建一个子进程以在弹性 beantalk 错误上运行数据库迁移全部内容,希望文章能够帮你解决npm 脚本创建一个子进程以在弹性 beantalk 错误上运行数据库迁移所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。