简体   繁体   English

清单文件中的服务和环境?

[英]Services and env in manifest file?

I have a web (online calculator for an example) which developed by my fellow tem members.我有一个由我的团队成员开发的 web(例如在线计算器)。 Now they want to deploy in PCF using manifests.现在他们想使用清单在 PCF 中进行部署。

Languages used: python, php and javascipt.使用的语言:python、php 和 javascipt。

I gone through the docs about pcf with manifest.yml我用 manifest.yml 浏览了有关 pcf 的文档

In that I don't have any idea about services and env.因为我对服务和环境一无所知。

What is that services and how can I find the services for the above project and also how can I find the environment variables?那是什么服务,如何找到上述项目的服务以及如何找到环境变量?

And tell whether these fields are mandatory to run the project in PCF.并告诉这些字段是否是在 PCF 中运行项目所必需的。

To your original question:对于你原来的问题:

What is that services and how can I find the services for the above project and also how can I find the environment variables?那是什么服务,如何找到上述项目的服务以及如何找到环境变量? And tell whether these fields are mandatory to run the project in pcf.并告诉这些字段是否必须在 pcf 中运行项目。

Does your app require any services to run?您的应用程序是否需要任何服务才能运行? Services would be things like a database or message queue.服务可以是数据库或消息队列之类的东西。 If it does not, then you do not need to specify any services in your manifest.如果没有,那么您不需要在清单中指定任何服务。 They are optional.它们是可选的。

Similarly, for environment variables, you would only need to set them if they are required to configure your application.同样,对于环境变量,您只需在需要配置应用程序时设置它们。 Otherwise, just omit that section of your manifest.否则,只需省略清单的该部分。

At the end of the day, you should talk with whomever developed the application or read the documentation they produce as that's the only way to know what services or environment variables are required.归根结底,您应该与开发应用程序的人交谈或阅读他们生成的文档,因为这是了解需要哪些服务或环境变量的唯一方法。

In regards to your additional questions:关于您的其他问题:

1)And also I have one more query...like in our application we used python ok, In that we use lots of pacakages say pandas,numpy.scipy and so on..?how can I import all the libraries into the PCF??? 1)And also I have one more query...like in our application we used python ok, In that we use lots of pacakages say pandas,numpy.scipy and so on..?how can I import all the libraries into the PCF ??? Buildpacks will contain version only right? Buildpacks 将只包含版本,对吗?

Correct.正确的。 The buildpack only includes Python itself. buildpack 仅包含 Python 本身。 Your dependencies either need to be installed or vendored.您的依赖项需要安装或供应。 To do this for Python, you need to include a requirements.txt file.要为 Python 执行此操作,您需要包含一个requirements.txt文件。 The buildpack will see this and use pip to install your dependencies. buildpack 将看到这一点并使用pip安装您的依赖项。

See the docs for the Python buildpack which explains this in more detail: https://docs.cloudfoundry.org/buildpacks/python/index.html#pushing_apps请参阅 Python buildpack 的文档,其中更详细地解释了这一点: https://docs.cloudfoundry.org/buildpacks/python/index.html#pushing_apps

2)And also tell me what will be the path for my app name if Java I can enclose jar files 2)如果 Java 我可以附上 jar 文件,还告诉我我的应用程序名称的路径是什么

For Java apps, you need to push compiled code.对于 Java 应用程序,您需要推送已编译的代码。 That means, you need to run something like mvn package or gradle assemble to build your executable JAR or WAR file.这意味着,您需要运行类似mvn packagegradle assemble来构建可执行 JAR 或 WAR 文件。 This should be a self contained file that has everything necessary to run your app, compile class files, config, and all dependent JARs.这应该是一个自包含文件,其中包含运行您的应用程序、编译 class 文件、配置和所有相关的 JARs 所需的一切。

You then run cf push -p path/to/my-app.jar (or WAR, whatever you build).然后,您运行cf push -p path/to/my-app.jar (或 WAR,无论您构建什么)。 The cf cli will take everything in the app and push it up to Cloud Foundry where the Java buildpack will install things like the JVM and possibly Tomcat so you app can run. cf cli 将获取应用程序中的所有内容并将其推送到 Cloud Foundry,其中 Java buildpack 将安装 JVM 之类的东西,可能还有 Z8F72E28063C30C7468ZFB6AF4653F4F9 等您可以运行的东西。

what should I do for application devloped using pyhton, JavaScript and php....对于使用 pyhton、JavaScript 和 php 开发的应用程序,我该怎么办......

You can use multiple buildpacks.您可以使用多个构建包。 See the instructions here.请参阅此处的说明。

https://docs.cloudfoundry.org/buildpacks/use-multiple-buildpacks.html https://docs.cloudfoundry.org/buildpacks/use-multiple-buildpacks.html

In short, you can have as many buildpacks as you want.简而言之,您可以拥有任意数量的构建包。 The last buildpack in the list is special because that is the buildpack which will set the start command for your application (although you can override this with cf push -c if necessary).列表中的最后一个 buildpack 是特殊的,因为它是为您的应用程序设置启动命令的 buildpack(尽管您可以在必要时使用cf push -c覆盖它)。 The non-final buildpacks will run and simply install dependencies.非最终构建包将运行并简单地安装依赖项。

3) we were using postgresql how can I use this in pcf with my app 3) 我们使用的是 postgresql 我如何在我的应用程序中使用它

Run cf marketplace and see if there are any Postgres providers in your Marketplace.运行cf marketplace并查看您的 Marketplace 中是否有任何 Postgres 提供程序。 If there is one, you can just do a cf create-service <provider> <plan> <service name> and the foundation will create a database for you to use.如果有,您只需执行cf create-service <provider> <plan> <service name> ,基金会将创建一个数据库供您使用。 You would then run a cf bind-service <app> <service name> to bind the service you create to your app.然后,您将运行cf bind-service <app> <service name>将您创建的服务绑定到您的应用程序。 This will generate credentials and pass them along to your app when it starts.这将生成凭据并在启动时将它们传递给您的应用程序。 You app can then read the credentials out of VCAP_SERVICES and use them to make connections to the database.然后,您的应用程序可以从 VCAP_SERVICES 中读取凭据并使用它们连接到数据库。

See here for more details:有关更多详细信息,请参见此处:

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM