如何让 Bluemix 引入多个运行时?
How can I get Bluemix to pull in multiple runtimes?
我的主要应用程序需要 Bluemix 上的 node.js 运行时。但是,我的应用程序的其他组件需要 Python 和 Java。当我推送我的应用程序时,如何让 Bluemix 引入所有 3 个运行时?
如果您需要三个不同的 运行 时间,您的应用程序中很可能有多个组件(在本例中为节点、python 和 java 组件)。如果您将应用程序分解为许多使用 REST 来回传递数据的较小应用程序,您可能会更容易维护和调试。这需要一些额外的工作,但这样做的好处可能是值得的。
如果您确定需要多个构建包,您可以使用 GitHub 中的 heroku-buildpack-multi 来引入多个构建包,但这可能需要您维护不稳定的配置,这可能会在长 运行 中引起问题。尽管如此,如果您创建指定其他构建包的 .buildpacks
(通过完整 URL 引用),则可以完成此操作。
我建议遵循微服务架构并将三个应用程序的部署生命周期分开。您可以为每个应用程序创建一个 manifest.yml 文件,并在需要更新时推送该应用程序。这也允许您单独缩放它们。
如果您确实需要同时推送和更新所有 3 个应用程序,您可以编写一个简单的脚本,对每个清单进行 cf 推送。
cf push -f ./some_directory/application1/
cf push -f ./some_directory/application2/
cf push -f ./some_directory/application3/
您还可以在一个清单文件中定义多个应用程序
https://docs.cloudfoundry.org/devguide/deploy-apps/manifest.html#multi-apps
---
# this manifest deploys two applications
# apps are in flame and spark directories
# flame and spark are in fireplace
# cf push should be run from fireplace
applications:
- name: spark
memory: 1G
instances: 2
host: flint-99
domain: shared-domain.com
path: ./spark/
services:
- mysql-flint-99
- name: flame
memory: 1G
instances: 2
host: burnin-77
domain: shared-domain.com
path: ./flame/
services:
- redis-burnin-77
我的主要应用程序需要 Bluemix 上的 node.js 运行时。但是,我的应用程序的其他组件需要 Python 和 Java。当我推送我的应用程序时,如何让 Bluemix 引入所有 3 个运行时?
如果您需要三个不同的 运行 时间,您的应用程序中很可能有多个组件(在本例中为节点、python 和 java 组件)。如果您将应用程序分解为许多使用 REST 来回传递数据的较小应用程序,您可能会更容易维护和调试。这需要一些额外的工作,但这样做的好处可能是值得的。
如果您确定需要多个构建包,您可以使用 GitHub 中的 heroku-buildpack-multi 来引入多个构建包,但这可能需要您维护不稳定的配置,这可能会在长 运行 中引起问题。尽管如此,如果您创建指定其他构建包的 .buildpacks
(通过完整 URL 引用),则可以完成此操作。
我建议遵循微服务架构并将三个应用程序的部署生命周期分开。您可以为每个应用程序创建一个 manifest.yml 文件,并在需要更新时推送该应用程序。这也允许您单独缩放它们。
如果您确实需要同时推送和更新所有 3 个应用程序,您可以编写一个简单的脚本,对每个清单进行 cf 推送。
cf push -f ./some_directory/application1/
cf push -f ./some_directory/application2/
cf push -f ./some_directory/application3/
您还可以在一个清单文件中定义多个应用程序 https://docs.cloudfoundry.org/devguide/deploy-apps/manifest.html#multi-apps
---
# this manifest deploys two applications
# apps are in flame and spark directories
# flame and spark are in fireplace
# cf push should be run from fireplace
applications:
- name: spark
memory: 1G
instances: 2
host: flint-99
domain: shared-domain.com
path: ./spark/
services:
- mysql-flint-99
- name: flame
memory: 1G
instances: 2
host: burnin-77
domain: shared-domain.com
path: ./flame/
services:
- redis-burnin-77