在 Heroku 上部署 FeathersJS 应用程序
Deploy FeathersJS App on Heroku
我正在尝试在 heroku 上部署我的 feathersjs 网络应用程序,并且由于 feathers 只是一个快速包装器,我认为它就像部署一个普通的节点应用程序一样。我在我的 package.json 上获得了 "npm start" 脚本,我将 heroku remote 添加到我的 git 存储库中,当我推送 heroku 运行 "yarn install" 和 "npm start" 脚本。但是就在应用程序启动时,出现错误:
heroku logs
我不知道发生了什么,有什么建议吗?
也许我可以将我的应用程序 docker 化,有人可以帮我找到合适的实现吗?
谢谢大家
它与 Express 相同,但生成的应用程序将默认使用 feathers-configuration 来提取您的应用程序设置。从错误消息来看,您似乎没有提供正确的 NODE_ENV
环境变量,在部署到 Heroku 时必须将其设置为 production
。
尝试将 "NODE_CONFIG_DIR" 设置为 "app/config/"
feathers-chat 应用程序通过 Sequelize 到 Heroku PostgreSQL 的工作端口
我现在在 Heroku 上获得了 hello world https://github.com/feathersjs/feathers-chat 运行 的端口!
- 来源:https://github.com/cirosantilli/feathers-chat/tree/sequelize-pg
- 一直活到坏掉:https://cirosantilli-feathersjs-chat.herokuapp.com/
密钥源更改
将'postgres'
设置为DATABASE_URL
环境变量config/production.json
:
+ "postgres": "DATABASE_URL"
Heroku 还导出 PORT
,它在我的补丁之前也已经在该文件中。
按照以下方式将 dialiectOptions
传递给数据库连接:Can't connect to heroku postgresql database from local node app with sequelize
+ const sequelize = new Sequelize(connectionString, {
+ dialect: 'postgres',
+ logging: false,
+ define: {
+ freezeTableName: true
+ },
+ dialectOptions: {
+ //
+ // https://devcenter.heroku.com/articles/heroku-postgresql#connecting-in-node-js
+ //
+ ssl: {
+ require: true,
+ rejectUnauthorized: false
+ }
+ }
+ });
关键 Heroku 设置
启用 PostgreSQL Heroku 附加组件:
heroku addons:create heroku-postgresql:hobby-dev-
这会自动为我们设置 DATABASE_URL
环境变量。
在 config/production.json 中将 host
编辑为正确的值
在 Heroku 应用程序设置中,将 NODE_ENV
环境变量设置为 production
参考书目:
我正在尝试在 heroku 上部署我的 feathersjs 网络应用程序,并且由于 feathers 只是一个快速包装器,我认为它就像部署一个普通的节点应用程序一样。我在我的 package.json 上获得了 "npm start" 脚本,我将 heroku remote 添加到我的 git 存储库中,当我推送 heroku 运行 "yarn install" 和 "npm start" 脚本。但是就在应用程序启动时,出现错误: heroku logs
我不知道发生了什么,有什么建议吗? 也许我可以将我的应用程序 docker 化,有人可以帮我找到合适的实现吗?
谢谢大家
它与 Express 相同,但生成的应用程序将默认使用 feathers-configuration 来提取您的应用程序设置。从错误消息来看,您似乎没有提供正确的 NODE_ENV
环境变量,在部署到 Heroku 时必须将其设置为 production
。
尝试将 "NODE_CONFIG_DIR" 设置为 "app/config/"
feathers-chat 应用程序通过 Sequelize 到 Heroku PostgreSQL 的工作端口
我现在在 Heroku 上获得了 hello world https://github.com/feathersjs/feathers-chat 运行 的端口!
- 来源:https://github.com/cirosantilli/feathers-chat/tree/sequelize-pg
- 一直活到坏掉:https://cirosantilli-feathersjs-chat.herokuapp.com/
密钥源更改
将'postgres'
设置为DATABASE_URL
环境变量config/production.json
:
+ "postgres": "DATABASE_URL"
Heroku 还导出 PORT
,它在我的补丁之前也已经在该文件中。
按照以下方式将 dialiectOptions
传递给数据库连接:Can't connect to heroku postgresql database from local node app with sequelize
+ const sequelize = new Sequelize(connectionString, {
+ dialect: 'postgres',
+ logging: false,
+ define: {
+ freezeTableName: true
+ },
+ dialectOptions: {
+ //
+ // https://devcenter.heroku.com/articles/heroku-postgresql#connecting-in-node-js
+ //
+ ssl: {
+ require: true,
+ rejectUnauthorized: false
+ }
+ }
+ });
关键 Heroku 设置
启用 PostgreSQL Heroku 附加组件:
heroku addons:create heroku-postgresql:hobby-dev-
这会自动为我们设置
DATABASE_URL
环境变量。在 config/production.json 中将
host
编辑为正确的值在 Heroku 应用程序设置中,将
NODE_ENV
环境变量设置为production
参考书目: