三分钟导览

A Three-second Tour 结束的地方开始,本节将介绍 Skipper 的其他命令和其他功能。 每个部分都介绍相同的操作集,但针对不同的平台:spring-doc.cn

8. 本地机器

按照 3 秒教程中的步骤启动 Server 和 shell。spring-doc.cn

现在,您可以安装并更新 Hello World 应用程序。 首先运行该命令,如以下示例中所示(及其输出):package installspring-doc.cn

skipper:>package install --release-name helloworldlocal --package-name helloworld --package-version 1.0.0 --properties spec.applicationProperties.server.port=8099
Released helloworldlocal. Now at version v1.

现在,您可以 curl 终端节点,如以下示例中所示(及其输出):greetingspring-doc.cn

$ curl http://localhost:8099/greeting
Hello World!
$ curl http://localhost:8099/about
Hello World v1.0.0.RELEASE

我们使用 YAML 文件来更新版本。 此应用程序包含一个名为 的 Spring Boot,因此我们将其与标准 Spring Boot 属性一起设置: 。 我们还将内存提高到 2G,使 Boot actuator 端点不敏感,并将端口设置为 8100。@ConfigurationPropertyhelloworld.greetingendpoints.sensitive=falsespring-doc.cn

该文件包含以下代码:helloworld-upgrade-local.ymlspring-doc.cn

spec:
  applicationProperties:
    server.port: 8100
    endpoints.sensitive: false
    helloworld.greeting: yo
  deploymentProperties:
    spring.cloud.deployer.memory: 2048m

以下示例显示了该命令及其输出:release upgradespring-doc.cn

skipper:>release upgrade --release-name helloworldlocal --package-name helloworld --package-version 1.0.1 --file /home/mpollack/helloworld-upgrade-local.yml
helloworldlocal has been upgraded.  Now at version v2.

命令行选项还用于升级到软件包的较新版本。--package-version 1.0.1spring-doc.cn

当前的升级策略很简单:如果新应用程序运行状况良好,则删除旧应用程序。 没有滚动升级选项。部署所有新应用程序并检查运行状况。然后删除任何以前的版本。 在 Skipper 的未来版本中计划使用更灵活的升级策略。spring-doc.cn

现在,您可以卷曲终端节点和终端节点,如以下示例中所示(及其输出):greetingaboutspring-doc.cn

$ curl http://localhost:8100/greeting
yo
$ curl http://localhost:8100/about
Hello World v1.0.1.RELEASE

您还可以在浏览器中查看终端节点。spring-doc.cn

该命令显示每个版本名称的当前版本和版本。 在本例中, 只有一个条目,正如您在命令中看到的那样,如下所示:listDEPLOYEDDELETEDrelease listspring-doc.cn

skipper:>release list
╔═══════════════╤═══════╤═════════════╤════════╤══════════╤═════════╤═════════╤════════════════════════════════════════════════════╗
║     Name      │Version│Last updated │ Status │ Package  │ Package │Platform │                  Platform Status                   ║
║               │       │             │        │   Name   │ Version │  Name   │                                                    ║
╠═══════════════╪═══════╪═════════════╪════════╪══════════╪═════════╪═════════╪════════════════════════════════════════════════════╣
║helloworldlocal│2      │Fri Oct 27   │DEPLOYED│helloworld│1.0.1    │default  │[helloworldlocal.helloworld-v2], State =            ║
║               │       │16:39:03 IST │        │          │         │         │[helloworldlocal.helloworld-v2-0=deployed]          ║
║               │       │2017         │        │          │         │         │                                                    ║
╚═══════════════╧═══════╧═════════════╧════════╧══════════╧═════════╧═════════╧════════════════════════════════════════════════════╝

您可以使用命令获取发布的完整历史记录,如以下示例中所示(及其输出):historyspring-doc.cn

skipper:>release history --release-name helloworldlocal
╔═══════╤════════════════════════════╤════════╤════════════╤═══════════════╤════════════════╗
║Version│        Last updated        │ Status │Package Name│Package Version│  Description   ║
╠═══════╪════════════════════════════╪════════╪════════════╪═══════════════╪════════════════╣
║2      │Fri Oct 27 16:39:03 IST 2017│DEPLOYED│helloworld  │1.0.1          │Upgrade complete║
║1      │Fri Oct 27 16:37:59 IST 2017│DELETED │helloworld  │1.0.0          │Delete complete ║
╚═══════╧════════════════════════════╧════════╧════════════╧═══════════════╧════════════════╝

要查看更改的内容,您可以使用命令查看每个版本的 Skipper 清单,如以下示例所示(及其输出):manifest getspring-doc.cn

skipper:>manifest get --release-name helloworldlocal --release-version 2

---
# Source: helloworld.yml
apiVersion: skipper.spring.io/v1
kind: SpringCloudDeployerApplication
metadata:
  name: helloworld
  type: demo
spec:
  resource: maven://org.springframework.cloud.samples:spring-cloud-skipper-samples-helloworld:1.0.1.RELEASE
  applicationProperties:
    server.port: 8100
    endpoints.sensitive: false
    helloworld.greeting: yo
  deploymentProperties:
    spring.cloud.deployer.memory: 2048m
    spring.cloud.deployer.count: 1

以下示例显示了版本 1 的命令及其输出:manifest getspring-doc.cn

skipper:>manifest get --release-name helloworldlocal --release-version 1

---
# Source: helloworld.yml
apiVersion: skipper.spring.io/v1
kind: SpringCloudDeployerApplication
metadata:
  name: helloworld
  type: demo
spec:
  resource: maven://org.springframework.cloud.samples:spring-cloud-skipper-samples-helloworld:1.0.0.RELEASE
  applicationProperties:
    server.port: 8099
  deploymentProperties:

(将来的发行版中将提供一个命令。manifest diffspring-doc.cn

现在,我们可以使用该命令来部署旧版本的应用程序。 由于我们拥有该版本的清单,因此我们拥有重新部署早期版本所需的一切,如以下示例所示(及其输出):rollbackspring-doc.cn

skipper:>release rollback --release-name helloworldlocal --release-version 1
helloworldlocal has been rolled back.  Now at version v3.
历史记录现在显示新版本,即使它在应用程序行为方面与该版本相同。v3v1

该命令显示已部署的所有版本,如以下示例中所示(及其输出):release historyspring-doc.cn

skipper:>release history --release-name helloworldlocal
╔═══════╤════════════════════════════╤════════╤════════════╤═══════════════╤════════════════╗
║Version│        Last updated        │ Status │Package Name│Package Version│  Description   ║
╠═══════╪════════════════════════════╪════════╪════════════╪═══════════════╪════════════════╣
║3      │Fri Oct 27 16:42:47 IST 2017│DEPLOYED│helloworld  │1.0.0          │Upgrade complete║
║2      │Fri Oct 27 16:39:03 IST 2017│DELETED │helloworld  │1.0.1          │Delete complete ║
║1      │Fri Oct 27 16:37:59 IST 2017│DELETED │helloworld  │1.0.0          │Delete complete ║
╚═══════╧════════════════════════════╧════════╧════════════╧═══════════════╧════════════════╝

现在,您可以卷曲终端节点并查看每个终端节点的输出,如下所示:greetingspring-doc.cn

$ curl http://localhost:8099/greeting
Hello World!
$ curl http://localhost:8099/about
Hello World v1.0.0.RELEASE

9. 云铸造厂

首先,按照 在 Cloud Foundry 上安装 部分中的说明将 Skipper Server 部署到 Cloud Foundry。spring-doc.cn

默认情况下,当您启动 Skipper shell 时,它会尝试在同一台(本地)计算机上查找 Skipper 服务器。 要指定在 Cloud Foundry 上运行的 Skipper 服务器,请在启动 shell 时提供 或在 shell 启动后使用命令。 以下示例提供了 :serverUrlconfigserverUrlspring-doc.cn

java -jar spring-cloud-skipper-shell-2.11.5.jar --spring.cloud.skipper.client.serverUri=https://mlp-skipper.cfapps.io/api

以下示例使用 :configspring-doc.cn

skipper:>skipper config --uri https://mlp-skipper.cfapps.io/api
Successfully targeted https://mlp-skipper.cfapps.io/api

该命令显示 and repositories,因为它们是默认配置的。 存储库是您可以上传新软件包的位置。 存储库包含一些 “hello world” 应用程序,可帮助您入门。 以下示例显示了示例的命令和输出:repo listexperimentallocallocalexperimentalrepo listspring-doc.cn

skipper:>repo list
╔════════════╤═══════════════════════════════════════════════════════════╤═════╤═════╗
║    Name    │                            URL                            │Local│Order║
╠════════════╪═══════════════════════════════════════════════════════════╪═════╪═════╣
║experimental│https://skipper-repository.cfapps.io/repository/experimental│false│0    ║
║local       │https://d4d6d1b6-c7e5-4226-69ec-01d4:7577                   │true │1    ║
╚════════════╧═══════════════════════════════════════════════════════════╧═════╧═════╝
上面的示例假设 repository 已添加到服务器配置中。更多信息 可以从 Repositories 中找到使用存储库。experimental

以下示例显示了示例的命令和输出:package searchspring-doc.cn

skipper:>package search
╔═════════════════╤═══════╤════════════════════════════════════════════════════════════════════════════════╗
║      Name       │Version│                                  Description                                   ║
╠═════════════════╪═══════╪════════════════════════════════════════════════════════════════════════════════╣
║helloworld       │1.0.1  │The app has two endpoints, /about and /greeting in Portuguese.  Maven resource. ║
║helloworld       │1.0.0  │The app has two endpoints, /about and /greeting in English.  Maven resource.    ║
║helloworld-docker│1.0.1  │The app has two endpoints, /about and /greeting in Portuguese.  Docker resource.║
║helloworld-docker│1.0.0  │The app has two endpoints, /about and /greeting in English.  Docker resource.   ║
╚═════════════════╧═══════╧════════════════════════════════════════════════════════════════════════════════╝

该命令显示配置了服务器的平台,如以下示例中所示(及其输出):platform listspring-doc.cn

╔════╤════════════╤═════════════════════════════════════════════════════════════════════════╗
║Name│    Type    │                               Description                               ║
╠════╪════════════╪═════════════════════════════════════════════════════════════════════════╣
║pws │cloudfoundry│org = [scdf-ci], space = [space-mark], url = [https://api.run.pivotal.io]║
╚════╧════════════╧═════════════════════════════════════════════════════════════════════════╝

在前面的示例中,只有一个 Cloud Foundry 平台。spring-doc.cn

现在我们可以安装 Hello World 应用程序(具体来说,是基于 maven 的工件)。 以下示例显示了我们用于安装应用程序的命令(及其输出):package installHello Worldspring-doc.cn

skipper:>package install --release-name helloworldpcf --package-name helloworld --package-version 1.0.0 --platform-name pws --properties spec.deploymentProperties.spring.cloud.deployer.cloudfoundry.route=helloworldpcf.cfapps.io
Released helloworldpcf. Now at version v1.

设置 deployment 属性,以便在部署此应用程序的不同版本时,它们具有相同的 HTTP 路由。spring.cloud.deployer.cloudfoundry.route=helloworldpcf.cfapps.iospring-doc.cn

由于该 shell 选项的默认值为 ,因此我们使用了 command 选项。 安装 Skipper 时,您可以在 名称 下注册平台,但最佳做法是指定目标平台名称。default`he `--platform-name pwsdefaultspring-doc.cn

您可以使用命令监控部署进度,如以下示例中所示(及其输出):release statusspring-doc.cn

skipper:>release status --release-name helloworldpcf
╔═══════════════╤════════════════════════════════════════════════╗
║Last Deployed  │Thu Jan 18 13:18:44 EST 2018                    ║
║Status         │DEPLOYED                                        ║
║Platform Status│The applications are being deployed.            ║
║               │[helloworldpcf-helloworld-v1], State = [partial]║
╚═══════════════╧════════════════════════════════════════════════╝

最终,Platform Status 显示,All applications have been successfully deployed.spring-doc.cn

前面示例中的状态指示 Skipper 已告知平台进行部署。 Skipper 不会跟踪中间状态 'deploy' 或 'deleting'。 platform status 提供更精细的状态信息。DEPLOYED

该命令现在具有此已部署应用程序的新列表,如以下示例中所示(及其输出):cf appsspring-doc.cn

$ cf apps
Getting apps in org scdf-ci / space space-mark as [email protected]...
OK

name                          requested state   instances   memory   disk   urls
helloworldpcf-helloworld-v1   started           1/1         1G       1G     helloworldpcf.cfapps.io

现在,您可以卷曲终端节点和终端节点,如以下示例所示:greetingaboutspring-doc.cn

$ curl https://helloworldpcf.cfapps.io/greeting
Hello World!
$ curl https://helloworldpcf.cfapps.io/about
Hello World v1.0.0.RELEASE

应用程序的名称基于约定。<release-name>-<package-name>-v<incrementing-counter>spring-doc.cn

另请注意,我们为此应用程序指定的路由与应用程序的名称不同。 deployment 属性设置为在此应用程序的不同版本的部署中不会更改的值 — 在本例中为 .spring.cloud.deployer.cloudfoundry.routehelloworldpcf.cfapps.iospring-doc.cn

该软件包提供了一种方法,用于对用于将应用程序部署到 Cloud Foundry 的应用程序版本、应用程序属性和部署属性进行模板化。 该命令显示传递给 Spring Cloud Deployer 库的最终 YAML 文件,如以下示例所示(及其输出):manifest getspring-doc.cn

skipper:>manifest get --release-name helloworldpcf

---
# Source: helloworld.yml
apiVersion: skipper.spring.io/v1
kind: SpringCloudDeployerApplication
metadata:
  name: helloworld
  type: demo
spec:
  resource: maven://org.springframework.cloud.samples:spring-cloud-skipper-samples-helloworld:1.0.0.RELEASE
  applicationProperties:
  deploymentProperties:
    spring.cloud.deployer.cloudfoundry.route: helloworldpcf.cfapps.io

manifest 格式的灵感来自 Kubernetes Resource 文件格式。 通过查看清单,您可以看到在最终推送到 Cloud Foundry 之前使用了哪个 Maven 工件以及设置了哪些属性。 Skipper 的未来版本将使用元数据值来支持基于这些值搜索版本。spring-doc.cn

由于在 shell 中为参数指定多个扁平化的 YAML 值有点尴尬,因此您还可以在安装或升级时指定 YAML 文件的位置。 在下一个示例中,我们使用名为 的 YAML 文件来更新版本。 此应用程序包含一个名为 的 Spring Boot,因此我们将其与标准 Spring Boot 属性一起设置:。 我们还将内存从默认的 1G 提高到 2G。 文件内容如下:--propertieshelloworld-upgrade.yml@ConfigurationPropertyhelloworld.greetingendpoints.sensitive=falsehelloworld-upgrade.ymlspring-doc.cn

spec:
  applicationProperties:
    endpoints.sensitive: false
    helloworld.greeting: yo
  deploymentProperties:
    spring.cloud.deployer.cloudfoundry.route: helloworldpcf.cfapps.io
    spring.cloud.deployer.memory: 2048m

现在,您可以运行该命令,如以下示例中所示(及其输出):release upgradespring-doc.cn

skipper:>release upgrade --release-name helloworldpcf --package-name helloworld --package-version 1.0.0 --file /home/mpollack/helloworld-upgrade.yml
helloworldpcf has been upgraded.  Now at version v2.

前面的示例启动 hello world 应用程序的另一个实例,Skipper 确定何时可以停止前一个实例的实例。 如果未指定 ,它将选取包的最新版本。 您无需指定 ,因为它始终是当前应用程序的部署位置。--package-versionhelloworld--platform-namespring-doc.cn

以下示例显示了该命令及其输出:cf appsspring-doc.cn

$ cf apps
Getting apps in org scdf-ci / space space-mark as [email protected]...
OK

name                          requested state   instances   memory   disk   urls
helloworldpcf-helloworld-v1   started           1/1         1G       1G     helloworldpcf.cfapps.io
helloworldpcf-helloworld-v2   stopped           0/1         2G       1G     helloworldpcf.cfapps.io

以下示例显示了该命令及其输出:cf routesspring-doc.cn

$ cf routes
Getting routes for org scdf-ci / space space-mark as [email protected] ...

space        host                          domain      port   path   type   apps                                                      service
space-mark   helloworldpcf                 cfapps.io                        helloworldpcf-helloworld-v1,helloworldpcf-helloworld-v2

此时,Skipper 正在检查新应用程序的运行状况。 default health 检查应用程序的 HTTP 端口是否打开。 Skipper 中有一个自定义项,它会影响运行状况检查的执行方式。 该属性是升级过程等待正常运行的应用程序的最长时间。 默认值为 5 分钟。 如果部署在该时间内运行状况不佳,则 Skipper 将失败。 属性是两次健康检查之间的睡眠时间。spring.cloud.skipper.server.strategies.healthcheck.timeoutInMillisspring.cloud.skipper.server.strategies.healthcheck.sleepInMillisspring-doc.cn

当前的升级策略非常简单:如果新应用程序运行状况良好,则删除旧应用程序。 没有滚动升级选项,将部署所有新应用程序,检查运行状况,然后删除以前的版本。 未来版本中计划提供更灵活的升级策略。spring-doc.cn

现在,您可以卷曲终端节点和终端节点,如以下示例所示:greetingaboutspring-doc.cn

$ curl https://helloworldpcf.cfapps.io/greeting
yo
$ curl https://helloworldpcf.cfapps.io/about
Hello World v1.0.0.RELEASE

该命令显示每个版本名称的当前版本和版本。 在示例应用程序的以下示例中,只有一个条目,如以下示例所示:release listDEPLOYEDDELETEDspring-doc.cn

╔═════════════╤═══════╤══════════════════╤════════╤═══════════╤═══════════╤══════════╤════════════════════════════════════════╗
║    Name     │Version│   Last updated   │ Status │  Package  │  Package  │ Platform │         Platform Status                ║
║             │       │                  │        │   Name    │  Version  │   Name   │                                        ║
╠═════════════╪═══════╪══════════════════╪════════╪═══════════╪═══════════╪══════════╪════════════════════════════════════════╣
║helloworldpcf│2      │Thu Jan 18        │DEPLOYED│helloworld │1.0.0      │pws       │[helloworldpcf-helloworld-v2], State =  ║
║             │       │13:26:50 EST 2018 │        │           │           │          │[helloworldpcf-helloworld-v2-0=deployed]║
╚═════════════╧═══════╧══════════════════╧════════╧═══════════╧═══════════╧══════════╧════════════════════════════════════════╝

您可以使用该命令获取发布的完整历史记录,如以下示例中所示(及其输出):release historyspring-doc.cn

skipper:>release history --release-name helloworldpcf
╔═══════╤════════════════════════════╤════════╤════════════╤═══════════════╤════════════════╗
║Version│        Last updated        │ Status │Package Name│Package Version│  Description   ║
╠═══════╪════════════════════════════╪════════╪════════════╪═══════════════╪════════════════╣
║2      │Thu Jan 18 13:26:50 EST 2018│DEPLOYED│helloworld  │1.0.0          │Upgrade complete║
║1      │Thu Jan 18 13:18:44 EST 2018│DELETED │helloworld  │1.0.0          │Delete complete ║
╚═══════╧════════════════════════════╧════════╧════════════╧═══════════════╧════════════════╝

更典型的升级过程不是更改应用程序属性,而是更改应用程序的版本,因为代码已更改。 在以下示例中,我们现在升级版本以使用新的 Maven 构件,版本 1.0.1,该版本也对应于 Skipper 包的版本 1.0.1。 在这种情况下,我们不会添加除 route 之外的任何其他 property。 以下示例显示了用于部署版本 1.0.1 的命令(及其更新):helloworldrelease upgradespring-doc.cn

skipper:>release upgrade --release-name helloworldpcf --package-name helloworld --package-version 1.0.1 --properties spec.deploymentProperties.spring.cloud.deployer.cloudfoundry.route=helloworldpcf.cfapps.io
helloworldpcf has been upgraded.  Now at version v3.

请注意,当前版本的属性值(例如使用 2G 或问候语 being)不会被转移。 未来的版本将引入一个命令,该命令将当前版本属性传递到要创建的下一个版本。 您可以使用以下命令监控升级的状态,如以下示例中所示(及其输出):yo--reuse-propertiesstatusspring-doc.cn

skipper:>release status --release-name helloworldpcf
╔═══════════════╤════════════════════════════════════════════════╗
║Last Deployed  │Thu Jan 18 13:49:42 EST 2018                    ║
║Status         │UNKNOWN                                         ║
║Platform Status│The applications are being deployed.            ║
║               │[helloworldpcf-helloworld-v3], State = [partial]║
╚═══════════════╧════════════════════════════════════════════════╝

现在,命令显示以下输出:curlspring-doc.cn

curl https://helloworldpcf.cfapps.io/greeting
Olá Mundo!
$ curl https://helloworldpcf.cfapps.io/about
Hello World v1.0.1.RELEASE

我们的发布历史现在如下:spring-doc.cn

skipper:>release history --release-name helloworldpcf
╔═══════╤════════════════════════════╤════════╤════════════╤═══════════════╤════════════════╗
║Version│        Last updated        │ Status │Package Name│Package Version│  Description   ║
╠═══════╪════════════════════════════╪════════╪════════════╪═══════════════╪════════════════╣
║3      │Thu Jan 18 13:49:42 EST 2018│DEPLOYED│helloworld  │1.0.1          │Upgrade complete║
║2      │Thu Jan 18 13:26:50 EST 2018│DELETED │helloworld  │1.0.0          │Delete complete ║
║1      │Thu Jan 18 13:18:44 EST 2018│DELETED │helloworld  │1.0.0          │Delete complete ║
╚═══════╧════════════════════════════╧════════╧════════════╧═══════════════╧════════════════╝

接下来,我们使用该命令部署旧版本的应用程序。 由于我们拥有该版本的清单,因此我们拥有重新部署早期版本所需的一切。 以下示例显示了该命令及其输出:rollbackrelease rollbackspring-doc.cn

skipper:>release rollback --release-name helloworldpcf --release-version 2
helloworldpcf has been rolled back.  Now at version v4.

历史记录现在显示新版本,即使它在应用程序行为方面与该版本相同,如下所示:v4v2spring-doc.cn

skipper:>release history --release-name helloworldpcf
╔═══════╤════════════════════════════╤════════╤════════════╤═══════════════╤════════════════╗
║Version│        Last updated        │ Status │Package Name│Package Version│  Description   ║
╠═══════╪════════════════════════════╪════════╪════════════╪═══════════════╪════════════════╣
║4      │Thu Jan 18 13:51:43 EST 2018│DEPLOYED│helloworld  │1.0.0          │Upgrade complete║
║3      │Thu Jan 18 13:49:42 EST 2018│DELETED │helloworld  │1.0.1          │Delete complete ║
║2      │Thu Jan 18 13:26:50 EST 2018│DELETED │helloworld  │1.0.0          │Delete complete ║
║1      │Thu Jan 18 13:18:44 EST 2018│DELETED │helloworld  │1.0.0          │Delete complete ║
╚═══════╧════════════════════════════╧════════╧════════════╧═══════════════╧════════════════╝

这些命令显示以下输出:curlspring-doc.cn

$ curl https://helloworldpcf.cfapps.io/greeting
yo
$ curl https://helloworldpcf.cfapps.io/about
Hello World v1.0.0.RELEASE

10. Kuberenetes

在此示例中,我们在本地机器上运行 Skipper 服务器并部署到 minikube,它也在本地机器上运行。spring-doc.cn

1.02 中的升级方法无法正确处理版本之间的 HTTP 流量路由,因此以下表示可能并不完全准确。

Spring Cloud Deployer for Kubernetes 为应用程序(或可选的部署)创建服务、复制控制器和 Pod。 对于通过消息中间件进行通信的应用程序来说,这不是问题,将来的版本中将解决此问题。spring-doc.cn

使用选项启动 Skipper 服务器。YAML 内容如下:--spring.config.additional-location=skipper.ymlspring-doc.cn

spring:
  cloud:
    skipper:
      server:
        platform:
          kubernetes:
            accounts:
              minikube:
                namespace: default

该命令显示 and repositories,因为它们是默认配置的,如下所示:repo listexperimentallocalspring-doc.cn

skipper:>repo list
╔════════════╤═══════════════════════════════════════════════════════════╤═════╤═════╗
║    Name    │                            URL                            │Local│Order║
╠════════════╪═══════════════════════════════════════════════════════════╪═════╪═════╣
║experimental│https://skipper-repository.cfapps.io/repository/experimental│false│0    ║
║local       │https://d4d6d1b6-c7e5-4226-69ec-01d4:7577                   │true │1    ║
╚════════════╧═══════════════════════════════════════════════════════════╧═════╧═════╝

该命令显示 Name、Version 和 Description,如下所示:package searchspring-doc.cn

skipper:>package search
╔═════════════════╤═══════╤════════════════════════════════════════════════════════════════════════════════╗
║      Name       │Version│                                  Description                                   ║
╠═════════════════╪═══════╪════════════════════════════════════════════════════════════════════════════════╣
║helloworld       │1.0.1  │The app has two endpoints, /about and /greeting in Portuguese.  Maven resource. ║
║helloworld       │1.0.0  │The app has two endpoints, /about and /greeting in English.  Maven resource.    ║
║helloworld-docker│1.0.1  │The app has two endpoints, /about and /greeting in Portuguese.  Docker resource.║
║helloworld-docker│1.0.0  │The app has two endpoints, /about and /greeting in English.  Docker resource.   ║
╚═════════════════╧═══════╧════════════════════════════════════════════════════════════════════════════════╝

该命令显示服务器配置了哪些平台 — 在本例中,一个 Kubernetes 命名空间。platform listspring-doc.cn

skipper:>platform list
╔════════╤══════════╤══════════════════════════════════════════════════════════════════════════════════════╗
║  Name  │   Type   │                                     Description                                      ║
╠════════╪══════════╪══════════════════════════════════════════════════════════════════════════════════════╣
║minikube│kubernetes│master url = [https://192.168.99.100:8443/], namespace = [default], api version = [v1]║
╚════════╧══════════╧══════════════════════════════════════════════════════════════════════════════════════╝

现在,我们可以安装 Hello World 应用程序(具体而言,基于 Docker 的工件),如下所示:spring-doc.cn

skipper:>package install --release-name helloworldk8s --package-name helloworld-docker --package-version 1.0.0 --platform-name minikube --properties spec.deploymentProperties.spring.cloud.deployer.kubernetes.createNodePort=32123
Released helloworldk8s. Now at version v1.

我们使用 command 选项,因为该 shell 选项的默认值是 . 安装 Skipper 时,您可以在该名称下注册平台,但最佳实践是指定目标平台名称。--platform-name minikubedefaultdefaultspring-doc.cn

您可以使用以下命令监控进程,如下所示:release statusspring-doc.cn

skipper:>release status --release-name helloworldk8s
╔═══════════════╤══════════════════════════════════════════════════════════════════════════════════════════════════╗
║Last Deployed  │Wed Oct 25 17:34:24 EDT 2017                                                                      ║
║Status         │DEPLOYED                                                                                          ║
║Platform Status│The applications are being deployed.                                                              ║
║               │[helloworldk8s-helloworld-docker-v1], State = [helloworldk8s-helloworld-docker-v1-cch68=deploying]║
╚═══════════════╧══════════════════════════════════════════════════════════════════════════════════════════════════╝

最终,Platform Status 显示,All applications have been successfully deployed.spring-doc.cn

请注意,前面示例中的状态指示 Skipper 已告知平台进行部署。 Skipper 不跟踪中间状态(“正在部署”或“正在删除”)。DEPLOYEDspring-doc.cn

现在,命令显示此已部署应用程序的新列表,如下所示:kubectl podsspring-doc.cn

$ kubectl get pods
NAME                                       READY     STATUS    RESTARTS   AGE
helloworldk8s-helloworld-docker-v1-g8j39   0/1       Running   0          37s

$ kubectl get service
NAME                                 CLUSTER-IP   EXTERNAL-IP   PORT(S)          AGE
helloworldk8s-helloworld-docker-v1   10.0.0.202   <nodes>       8080:32123/TCP   41s
kubernetes                           10.0.0.1     <none>        443/TCP          57m

要在 minikube 上获取此应用程序的 URL,请使用以下命令,如下所示:minikube servicespring-doc.cn

$ minikube service --url helloworldk8s-helloworld-docker-v1
https://192.168.99.100:32123

现在,您可以卷曲终端节点和终端节点,如以下示例所示:greetingaboutspring-doc.cn

$ curl https://192.168.99.100:32123/greeting
Hello World!
$ curl https://192.168.99.100:32123/about
Hello World v1.0.0.RELEASE

应用程序的名称基于以下约定:。 将来的版本将更改此约定以正确处理路由。<release-name>-<package-name>-v<incrementing-counter>spring-doc.cn

该软件包提供了一种对用于将应用程序部署到 Kubernetes 的应用程序版本、应用程序属性和部署属性进行模板化的方法。 该命令显示最终的 YAML 文件,该文件将传递给 Spring Cloud Deployer 库,如以下示例所示(及其输出):manifest getspring-doc.cn

skipper:>manifest get --release-name helloworldk8s

---
# Source: template.yml
apiVersion: skipper.spring.io/v1
kind: SpringCloudDeployerApplication
metadata:
  name: helloworld-docker
spec:
  resource: docker:springcloud/spring-cloud-skipper-samples-helloworld:1.0.0.RELEASE
  applicationProperties:
  deploymentProperties:
    spring.cloud.deployer.kubernetes.createNodePort: 32123

其格式受到 Kubernetes Resource 文件格式的启发。 通过查看清单,您可以看到在最终推送到 Kubernetes 之前使用了哪些 Docker 镜像以及设置了哪些属性。 Skipper 的未来版本将使用元数据值来支持基于这些值搜索版本。spring-doc.cn

由于在 shell 中为参数指定多个扁平化的 YAML 值有点尴尬,因此您还可以在安装或升级时指定 YAML 文件的位置。 我们在更新版本时使用 YAML 文件。 此应用程序包含一个名为 的 Spring Boot,因此我们将其与标准 Spring Boot 属性一起设置:。我们还将内存从默认的 768G 降低到 1M。 下面的清单显示了所有设置:--properties@ConfigurationPropertyhelloworld.greetingendpoints.sensitive=falsespring-doc.cn

spec:
  applicationProperties:
    endpoints.sensitive: false
    helloworld.greeting: yo
  deploymentProperties:
    spring.cloud.deployer.kubernetes.createNodePort: 32124
    spring.cloud.deployer.memory: 768m

以下示例显示了该命令及其输出:release upgradespring-doc.cn

skipper:>release upgrade --release-name helloworldk8s --package-name helloworld-docker --package-version 1.0.0 --file /home/mpollack/helloworld-upgrade-k8s.yml
helloworldk8s has been upgraded.  Now at version v2.

前面的命令启动 hello world 应用程序的另一个实例。 如果未指定 ,它将选取包的最新版本。 您无需指定 ,因为它始终是当前应用程序的部署位置。--package-versionhelloworld-docker--platform-namespring-doc.cn

以下示例显示了该命令及其输出:kubectl get allspring-doc.cn

$ kubectl get all
NAME                                          READY     STATUS    RESTARTS   AGE
po/helloworldk8s-helloworld-docker-v1-g8j39   1/1       Running   0          2m
po/helloworldk8s-helloworld-docker-v2-jz85l   0/1       Running   0          50s

NAME                                    DESIRED   CURRENT   READY     AGE
rc/helloworldk8s-helloworld-docker-v1   1         1         1         2m
rc/helloworldk8s-helloworld-docker-v2   1         1         0         50s

NAME                                     CLUSTER-IP   EXTERNAL-IP   PORT(S)          AGE
svc/helloworldk8s-helloworld-docker-v1   10.0.0.202   <nodes>       8080:32123/TCP   2m
svc/helloworldk8s-helloworld-docker-v2   10.0.0.154   <nodes>       8080:32124/TCP   51s
svc/kubernetes                           10.0.0.1     <none>        443/TCP          59m

此时,Skipper 正在查看 Boot 应用程序的运行状况终端节点是否正常。 该属性设置升级过程等待正常运行的应用程序的最长时间。 默认值为 5 分钟。 如果部署在该时间内运行状况不佳,则 Skipper 将失败。 该属性设置在运行状况检查之间休眠的时间。spring.cloud.skipper.server.strategies.healthcheck.timeoutInMillisspring.cloud.skipper.server.strategies.healthcheck.sleepInMillisspring-doc.cn

当前的升级策略很简单:如果新应用程序运行状况良好,则删除旧应用程序。 没有滚动升级选项。部署所有新应用程序并检查运行状况。然后删除任何以前的版本。 未来的版本将具有更灵活的升级策略,并引入 Spring Cloud State Machine 项目来编排更新过程。spring-doc.cn

现在,您可以卷曲终端节点和终端节点,如下所示:greetingaboutspring-doc.cn

$ curl https://192.168.99.100:32124/greeting
yo
$ curl https://192.168.99.100:32124/about
Hello World v1.0.0.RELEASE

该命令显示每个发行版名称的 current 和 release。 在以下示例中,只有一个条目:release listDEPLOYEDDELETEDspring-doc.cn

skipper:>release list
╔═════════════╤═══════╤════════════════════════════╤════════╤═════════════════╤═══════════════╤═════════════╤═══════════════╗
║    Name     │Version│        Last updated        │ Status │  Package Name   │Package Version│Platform Name│Platform Status║
╠═════════════╪═══════╪════════════════════════════╪════════╪═════════════════╪═══════════════╪═════════════╪═══════════════╣
║helloworldk8s│2      │Wed Oct 25 17:36:16 EDT 2017│DEPLOYED│helloworld-docker│1.0.0          │minikube     │               ║
╚═════════════╧═══════╧════════════════════════════╧════════╧═════════════════╧═══════════════╧═════════════╧═══════════════╝

您可以使用以下命令获取发布的完整历史记录,如下所示:historyspring-doc.cn

skipper:>release history --release-name helloworldk8s
╔═══════╤════════════════════════════╤════════╤═════════════════╤═══════════════╤════════════════╗
║Version│        Last updated        │ Status │  Package Name   │Package Version│  Description   ║
╠═══════╪════════════════════════════╪════════╪═════════════════╪═══════════════╪════════════════╣
║2      │Wed Oct 25 17:36:16 EDT 2017│DEPLOYED│helloworld-docker│1.0.0          │Upgrade complete║
║1      │Wed Oct 25 17:34:24 EDT 2017│DELETED │helloworld-docker│1.0.0          │Delete complete ║
╚═══════╧════════════════════════════╧════════╧═════════════════╧═══════════════╧════════════════╝

更典型的升级过程不是更改应用程序属性,而是更改应用程序的版本,因为代码已更改。 现在,我们可以升级该版本以使用新的 Docker 工件 1.0.1 版本,该版本也对应于 Skipper 包的 1.0.1 版本。 在以下示例中,我们不添加除 :helloworldNodePortspring-doc.cn

skipper:>release upgrade --release-name helloworldk8s --package-name helloworld-docker --package-version 1.0.1 --properties spec.deploymentProperties.spring.cloud.deployer.kubernetes.createNodePort=32125
Released helloworldk8s. Now at version v3.

请注意,当前版本的属性值(如使用 2G RAM 或问候语 being)不会被转移。 未来的版本将引入一个 command 选项,该选项会将当前版本属性传递到要创建的下一个版本。 您可以使用以下命令监控升级的状态,如以下示例中所示(及其输出):yo--reuse-propertiesstatusspring-doc.cn

skipper:>release status --release-name helloworldk8s
╔═══════════════╤══════════════════════════════════════════════════════════════════════════════════════════════════╗
║Last Deployed  │Wed Oct 25 17:41:33 EDT 2017                                                                      ║
║Status         │DEPLOYED                                                                                          ║
║Platform Status│All applications have been successfully deployed.                                                 ║
║               │[helloworldk8s-helloworld-docker-v3], State = [helloworldk8s-helloworld-docker-v3-sb59j=deployed] ║
╚═══════════════╧══════════════════════════════════════════════════════════════════════════════════════════════════╝

命令显示以下输出:curlspring-doc.cn

$ curl https://192.168.99.100:32125/greeting
Olá Mundo!

$ curl https://192.168.99.100:32125/about
Hello World v1.0.1.RELEASE

以下示例显示了该命令及其输出:release historyspring-doc.cn

skipper:>release history --release-name helloworldk8s
╔═══════╤════════════════════════════╤════════╤═════════════════╤═══════════════╤════════════════╗
║Version│        Last updated        │ Status │  Package Name   │Package Version│  Description   ║
╠═══════╪════════════════════════════╪════════╪═════════════════╪═══════════════╪════════════════╣
║3      │Wed Oct 25 17:41:33 EDT 2017│DEPLOYED│helloworld-docker│1.0.1          │Upgrade complete║
║2      │Wed Oct 25 17:36:16 EDT 2017│DELETED │helloworld-docker│1.0.0          │Delete complete ║
║1      │Wed Oct 25 17:34:24 EDT 2017│DELETED │helloworld-docker│1.0.0          │Delete complete ║
╚═══════╧════════════════════════════╧════════╧═════════════════╧═══════════════╧════════════════╝

接下来,我们使用该命令部署旧版本的应用程序。 由于我们拥有该版本的清单,因此我们拥有重新部署早期版本所需的一切。 以下示例显示了 rollback 命令及其输出:rollbackspring-doc.cn

skipper:>release rollback --release-name helloworldk8s --release-version 2
helloworldk8s has been rolled back.  Now at version v4.

历史记录现在显示新版本,即使它与版本相同,如以下示例所示:v4v2spring-doc.cn

skipper:>release history --release-name helloworldk8s
╔═══════╤════════════════════════════╤════════╤═════════════════╤═══════════════╤════════════════╗
║Version│        Last updated        │ Status │  Package Name   │Package Version│  Description   ║
╠═══════╪════════════════════════════╪════════╪═════════════════╪═══════════════╪════════════════╣
║4      │Wed Oct 25 17:44:25 EDT 2017│DEPLOYED│helloworld-docker│1.0.0          │Upgrade complete║
║3      │Wed Oct 25 17:41:33 EDT 2017│DELETED │helloworld-docker│1.0.1          │Delete complete ║
║2      │Wed Oct 25 17:36:16 EDT 2017│DELETED │helloworld-docker│1.0.0          │Delete complete ║
║1      │Wed Oct 25 17:34:24 EDT 2017│DELETED │helloworld-docker│1.0.0          │Delete complete ║
╚═══════╧════════════════════════════╧════════╧═════════════════╧═══════════════╧════════════════╝

这些命令现在显示以下内容:curlspring-doc.cn

$ curl https://192.168.99.100:32124/greeting
yo
$ curl https://192.168.99.100:32124/about
Hello World v1.0.0.RELEASE

11. 基于 CF 清单的部署

以下示例介绍了管理基于 CF 清单的包的方案。spring-doc.cn

skipper:>platform list
╔═══════╤════════════╤══════════════════════════════════════════════════════════════════════════╗
║ Name  │    Type    │                               Description                                ║
╠═══════╪════════════╪══════════════════════════════════════════════════════════════════════════╣
║cf-dev │cloudfoundry│org = [scdf-ci], space = [space-ilaya], url = [https://api.run.pivotal.io]║
╚═══════╧════════════╧══════════════════════════════════════════════════════════════════════════╝

上传 test 目录下可用的日志应用程序包 。spring-cloud-skipper-server-corespring-doc.cn

skipper:>package upload --repo-name local --path spring-cloud-skipper-server-core/src/test/resources/repositories/binaries/test/log/logcf-1.0.0.zip
Package uploaded successfully:[logcf:1.0.0]
skipper:>package upload --repo-name local --path spring-cloud-skipper-server-core/src/test/resources/repositories/binaries/test/log/logcf-1.0.1.zip
Package uploaded successfully:[logcf:1.0.1]
skipper:>package search
╔═════════════════╤═══════╤════════════════════════════════════════════════════════════════════════════════╗
║      Name       │Version│                                  Description                                   ║
╠═════════════════╪═══════╪════════════════════════════════════════════════════════════════════════════════╣
║helloworld       │1.0.0  │The app has two endpoints, /about and /greeting in English.  Maven resource.    ║
║helloworld       │1.0.1  │The app has two endpoints, /about and /greeting in Portuguese.  Maven resource. ║
║helloworld-docker│1.0.0  │The app has two endpoints, /about and /greeting in English.  Docker resource.   ║
║helloworld-docker│1.0.1  │The app has two endpoints, /about and /greeting in Portuguese.  Docker resource.║
║logcf            │1.0.0  │The log sink uses the application logger to output the data for inspection.     ║
║logcf            │1.0.1  │The log sink uses the application logger to output the data for inspection.     ║
╚═════════════════╧═══════╧════════════════════════════════════════════════════════════════════════════════╝

安装版本为logcf1.0.0spring-doc.cn

skipper:>package install logcf --release-name a1 --platform-name cf-dev --package-version 1.0.0
Released a1. Now at version v1.

skipper:>release list
╔════╤═══════╤════════════════════════════╤════════╤════════════╤═══════════════╤═════════════╤═══════════════════════════════════╗
║Name│Version│        Last updated        │ Status │Package Name│Package Version│Platform Name│          Platform Status          ║
╠════╪═══════╪════════════════════════════╪════════╪════════════╪═══════════════╪═════════════╪═══════════════════════════════════╣
║a1  │1      │Thu Aug 09 12:29:02 IST 2018│DEPLOYED│logcf       │1.0.0          │cf-dev       │[a1-v1], State = [a1-v1-0=deployed]║
╚════╧═══════╧════════════════════════════╧════════╧════════════╧═══════════════╧═════════════╧═══════════════════════════════════╝

skipper:>release history a1
╔═══════╤════════════════════════════╤════════╤════════════╤═══════════════╤════════════════╗
║Version│        Last updated        │ Status │Package Name│Package Version│  Description   ║
╠═══════╪════════════════════════════╪════════╪════════════╪═══════════════╪════════════════╣
║1      │Thu Aug 09 12:29:02 IST 2018│DEPLOYED│logcf       │1.0.0          │Install complete║
╚═══════╧════════════════════════════╧════════╧════════════╧═══════════════╧════════════════╝

skipper:>manifest get a1
"apiVersion": "skipper.spring.io/v1"
"kind": "CloudFoundryApplication"
"spec":
  "resource": "maven://org.springframework.cloud.stream.app:log-sink-rabbit"
  "version": "1.3.0.RELEASE"
  "manifest":
    "memory": "1024"
    "disk-quota": "2048"
    "instances": "1"
    "services":
    - "rabbit"
    "timeout": "180"
$ cf apps
Getting apps in org scdf-ci / space space-ilaya as [email protected]...
OK

name    requested state   instances   memory   disk   urls
a1-v1   started           1/1         1G       2G     a1-v1.cfapps.io

使用版本logcf1.0.1spring-doc.cn

skipper:>release upgrade --package-name logcf --package-version 1.0.1 --release-name a1
a1 has been upgraded.  Now at version v2.

skipper:>release list
╔════╤═══════╤════════════════════════════╤════════╤════════════╤═══════════════╤═════════════╤═══════════════════════════════════╗
║Name│Version│        Last updated        │ Status │Package Name│Package Version│Platform Name│          Platform Status          ║
╠════╪═══════╪════════════════════════════╪════════╪════════════╪═══════════════╪═════════════╪═══════════════════════════════════╣
║a1  │2      │Thu Aug 09 12:33:44 IST 2018│DEPLOYED│logcf       │1.0.1          │cf-dev       │[a1-v2], State = [a1-v2-0=deployed]║
╚════╧═══════╧════════════════════════════╧════════╧════════════╧═══════════════╧═════════════╧═══════════════════════════════════╝

skipper:>release history a1
╔═══════╤════════════════════════════╤════════╤════════════╤═══════════════╤════════════════╗
║Version│        Last updated        │ Status │Package Name│Package Version│  Description   ║
╠═══════╪════════════════════════════╪════════╪════════════╪═══════════════╪════════════════╣
║2      │Thu Aug 09 12:33:44 IST 2018│DEPLOYED│logcf       │1.0.1          │Upgrade complete║
║1      │Thu Aug 09 12:29:02 IST 2018│DELETED │logcf       │1.0.0          │Delete complete ║
╚═══════╧════════════════════════════╧════════╧════════════╧═══════════════╧════════════════╝

skipper:>manifest get a1
"apiVersion": "skipper.spring.io/v1"
"kind": "CloudFoundryApplication"
"spec":
  "resource": "maven://org.springframework.cloud.stream.app:log-sink-rabbit"
  "version": "1.3.1.RELEASE"
  "manifest":
    "memory": "1024"
    "disk-quota": "2048"
    "instances": "1"
    "services":
    - "rabbit"
    "timeout": "180"
$ cf apps
Getting apps in org scdf-ci / space space-ilaya as [email protected]...
OK

name    requested state   instances   memory   disk   urls
a1-v2   started           1/1         1G       2G     a1-v2.cfapps.io

使用版本logcf1.0.1spring-doc.cn

skipper:>release rollback a1
a1 has been rolled back.  Now at version v3.

skipper:>release list
╔════╤═══════╤════════════════════════════╤════════╤════════════╤═══════════════╤═════════════╤═══════════════╗
║Name│Version│        Last updated        │ Status │Package Name│Package Version│Platform Name│Platform Status║
╠════╪═══════╪════════════════════════════╪════════╪════════════╪═══════════════╪═════════════╪═══════════════╣
║a1  │3      │Thu Aug 09 12:39:17 IST 2018│DEPLOYED│logcf       │1.0.0          │cf-dev       │               ║
╚════╧═══════╧════════════════════════════╧════════╧════════════╧═══════════════╧═════════════╧═══════════════╝

skipper:>release history a1
╔═══════╤════════════════════════════╤════════╤════════════╤═══════════════╤═════════════════╗
║Version│        Last updated        │ Status │Package Name│Package Version│   Description   ║
╠═══════╪════════════════════════════╪════════╪════════════╪═══════════════╪═════════════════╣
║3      │Thu Aug 09 12:39:17 IST 2018│DEPLOYED│logcf       │1.0.0          │Rollback complete║
║2      │Thu Aug 09 12:33:44 IST 2018│DELETED │logcf       │1.0.1          │Delete complete  ║
║1      │Thu Aug 09 12:29:02 IST 2018│DELETED │logcf       │1.0.0          │Delete complete  ║
╚═══════╧════════════════════════════╧════════╧════════════╧═══════════════╧═════════════════╝

skipper:>manifest get a1
"apiVersion": "skipper.spring.io/v1"
"kind": "CloudFoundryApplication"
"spec":
  "resource": "maven://org.springframework.cloud.stream.app:log-sink-rabbit"
  "version": "1.3.0.RELEASE"
  "manifest":
    "memory": "1024"
    "disk-quota": "2048"
    "instances": "1"
    "services":
    - "rabbit"
    "timeout": "180"


$ cf apps
Getting apps in org scdf-ci / space space-ilaya as [email protected]...
OK

name    requested state   instances   memory   disk   urls
a1-v3   started           1/1         1G       2G     a1-v3.cfapps.io

将包升级到最新版本,并将清单的内存更新为 。logcf1.0.12Gspring-doc.cn

skipper:>release upgrade --package-name logcf --release-name a1 --properties "spec.manifest.memory=2G"
a1 has been upgraded.  Now at version v4.

skipper:>release list
╔════╤═══════╤════════════════════════════╤════════╤════════════╤═══════════════╤═════════════╤═══════════════════════════════════╗
║Name│Version│        Last updated        │ Status │Package Name│Package Version│Platform Name│          Platform Status          ║
╠════╪═══════╪════════════════════════════╪════════╪════════════╪═══════════════╪═════════════╪═══════════════════════════════════╣
║a1  │4      │Thu Aug 09 12:49:49 IST 2018│DEPLOYED│logcf       │1.0.1          │cf-dev       │[a1-v4], State = [a1-v4-0=deployed]║
╚════╧═══════╧════════════════════════════╧════════╧════════════╧═══════════════╧═════════════╧═══════════════════════════════════╝

skipper:>release history a1
╔═══════╤════════════════════════════╤════════╤════════════╤═══════════════╤════════════════╗
║Version│        Last updated        │ Status │Package Name│Package Version│  Description   ║
╠═══════╪════════════════════════════╪════════╪════════════╪═══════════════╪════════════════╣
║4      │Thu Aug 09 12:49:49 IST 2018│DEPLOYED│logcf       │1.0.1          │Upgrade complete║
║3      │Thu Aug 09 12:39:17 IST 2018│DELETED │logcf       │1.0.0          │Delete complete ║
║2      │Thu Aug 09 12:33:44 IST 2018│DELETED │logcf       │1.0.1          │Delete complete ║
║1      │Thu Aug 09 12:29:02 IST 2018│DELETED │logcf       │1.0.0          │Delete complete ║
╚═══════╧════════════════════════════╧════════╧════════════╧═══════════════╧════════════════╝

skipper:>manifest get a1
"apiVersion": "skipper.spring.io/v1"
"kind": "CloudFoundryApplication"
"spec":
  "resource": "maven://org.springframework.cloud.stream.app:log-sink-rabbit"
  "version": "1.3.1.RELEASE"
  "manifest":
    "memory": "2G"
    "disk-quota": "2048"
    "instances": "1"
    "services":
    - "rabbit"
    "timeout": "180"

$ cf apps
Getting apps in org scdf-ci / space space-ilaya as [email protected]...
OK

name    requested state   instances   memory   disk   urls
a1-v4   started           1/1         2G       2G     a1-v4.cfapps.io

删除发行版spring-doc.cn

skipper:>release delete a1
a1 has been deleted.

以下示例显示了 Skipper 如何帮助管理可以使用 manifest 部署到 CF 中的任何应用程序 在本例中,我们有几个 python 包来打印问候消息。spring-doc.cn

从 test 目录上传 python 包spring-cloud-skipper-server-corespring-doc.cn

skipper:>package upload --path spring-cloud-skipper-server-core/src/test/resources/repositories/binaries/test/python/python-printer-1.0.0.zip
Package uploaded successfully:[python-printer:1.0.0]

skipper:>package upload --path spring-cloud-skipper-server-core/src/test/resources/repositories/binaries/test/python/python-printer-1.0.1.zip
Package uploaded successfully:[python-printer:1.0.1]

安装 python 软件包spring-doc.cn

skipper:>package install --package-name python-printer --package-version 1.0.0 --release-name printer --platform-name cf-dev
Released printer. Now at version v1.
skipper:>manifest get printer
"apiVersion": "skipper.spring.io/v1"
"kind": "CloudFoundryApplication"
"spec":
  "resource": "https://github.com/ilayaperumalg/sandbox/raw/master/python/1.0.0/hello.py-1.0.0.zip"
  "version": "1.0.0"
  "manifest":
    "memory": "1024"
    "disk-quota": "1024"
    "instances": "1"
    "health-check-type": "process"
    "buildpack": "python_buildpack"
    "timeout": "180"
    "command": "python hello.py"
$ cf apps
Getting apps in org scdf-ci / space space-ilaya as [email protected]...
OK

name         requested state   instances   memory   disk   urls
printer-v1   started           1/1         1G       1G     printer-v1.cfapps.io
$ cf logs printer-v1
Retrieving logs for app printer-v1 in org scdf-ci / space space-ilaya as [email protected]...

   2018-08-09T13:33:36.55+0530 [APP/PROC/WEB/0] OUT Hello!
   2018-08-09T13:33:41.55+0530 [APP/PROC/WEB/0] OUT Hello!

使用版本1.0.1spring-doc.cn

skipper:>release upgrade printer --package-name python-printer --package-version 1.0.1
printer has been upgraded.  Now at version v2.

skipper:>manifest get printer
"apiVersion": "skipper.spring.io/v1"
"kind": "CloudFoundryApplication"
"spec":
  "resource": "https://github.com/ilayaperumalg/sandbox/raw/master/python/1.0.1/hello.py-1.0.1.zip"
  "version": "1.0.1"
  "manifest":
    "memory": "1024"
    "disk-quota": "1024"
    "instances": "1"
    "health-check-type": "process"
    "buildpack": "python_buildpack"
    "timeout": "180"
    "command": "python vanakkam.py"
$ cf apps
Getting apps in org scdf-ci / space space-ilaya as [email protected]...
OK

name         requested state   instances   memory   disk   urls
printer-v2   started           1/1         1G       1G     printer-v2.cfapps.io
$ cf logs printer-v2
Retrieving logs for app printer-v2 in org scdf-ci / space space-ilaya as [email protected]...

   2018-08-09T13:36:13.39+0530 [APP/PROC/WEB/0] OUT Vanakkam!
   2018-08-09T13:36:18.40+0530 [APP/PROC/WEB/0] OUT Vanakkam!