---
title: Pivotal Application Service (PAS) on AzureをCLIで2.4から2.5にバージョンアップするメモ
tags: ["Azure", "Cloud Foundry", "Pivotal Cloud Foundry", "Ops Manager", "PAS"]
categories: ["Dev", "PaaS", "CloudFoundry", "PCF"]
date: 2019-05-22T18:57:26Z
updated: 2019-05-22T18:59:43Z
---

[Pivotal Application Service (PAS) 2.4をCLIでAzureにインストールするメモ](https://blog.ik.am/entries/481)でインストールしたPAS 2.4を[PAS 2.5](https://docs.pivotal.io/pivotalcf/2-5)にバージョンアップします。

バージョンアップ前のCFのバージョンは`cf curl /v2/info`で確認できます。

```sh
$ cf curl /v2/info
{
   "name": "Pivotal Application Service",
   "build": "2.4.7-build.16",
   "support": "https://support.pivotal.io",
   "version": 0,
   "description": "https://docs.pivotal.io/pivotalcf/2-3/pcf-release-notes/runtime-rn.html",
   "authorization_endpoint": "https://login.sys.pas.ik.am",
   "token_endpoint": "https://uaa.sys.pas.ik.am",
   "min_cli_version": "6.23.0",
   "min_recommended_cli_version": "6.23.0",
   "app_ssh_endpoint": "ssh.sys.pas.ik.am:2222",
   "app_ssh_host_key_fingerprint": "8d:b3:95:84:6b:65:c3:f0:64:cc:b3:18:25:3a:07:1b",
   "app_ssh_oauth_client": "ssh-proxy",
   "doppler_logging_endpoint": "wss://doppler.sys.pas.ik.am:443",
   "api_version": "2.125.0",
   "osbapi_version": "2.14",
   "routing_endpoint": "https://api.sys.pas.ik.am/routing"
}
```

前回同様に`$HOME/install-pas`で作業します。また、念のため環境変数`OM_XXXXXX`を再設定しておきます。


```sh
cd $HOME/install-pas

export OM_DECRYPTION_PASSPHRASE=pasw0rd
export OM_PASSWORD=pasw0rd
export OM_SKIP_SSL_VALIDATION=true
export OM_TARGET=$(terraform output ops_manager_dns)
export OM_USERNAME=admin
```

PAS 2.5.4のTileをダウンロードしておきます。

```sh
cd /tmp
pivnet download-product-files -p elastic-runtime -r 2.5.4 --glob=cf-*.pivotal
cd -
```
**目次**
<!-- toc -->

#### Ops Managerのアップデート

**重要**: バージョンアップ作業をする前に、次のコマンドで必ずOps Managerの設定のエクスポートをおこなって下さい。

```sh
om export-installation -o installation.zip
```

[Ops Manager 2.5.4のプロダクトページ](https://network.pivotal.io/products/ops-manager#/releases/371351)から、"Pivotal Cloud Foundry Ops Manager YAML for Azure"をダウンロードして、OpsManager VMイメージのURLを取得します。

`terraform.tfvars`の`ops_manager_image_uri`を取得したURLで上書きします。

```sh
ops_manager_image_uri = "https://opsmanagersoutheastasia.blob.core.windows.net/images/ops-manager-2.5.4-build.189.vhd"
```

この変更をTerraformで反映します。

```sh
terraform plan -out plan template/terraforming-pas
terraform apply plan
```

新しいOps Manager VMが新しいバージョンに差し代わります。

先ほどエクスポートした設定を新しいバージョンにインポートします。

```sh
om import-installation -i installation.zip
```

これでOps Managerのアップデートが完了です。ブラウザで確認すると、PASのバージョンは`v2.4.7`のままで、Ops Managerのバージョンが`v2.5.4-build.189`になっていることがわかります。

![image](https://user-images.githubusercontent.com/106908/58190490-929c6480-7cf7-11e9-84a4-4f12e00cf5f1.png)


#### PASのアップデート

次にPASを2.5にアップデートします。

```sh
om upload-product -p /tmp/cf-2.5.4-build.5.pivotal
```

ステージします。

```sh
export PRODUCT_NAME=cf
export PRODUCT_VERSION=2.5.4

om stage-product -p ${PRODUCT_NAME} -v ${PRODUCT_VERSION}
```

ブラウザで確認するとPAS Tileがオレンジ色になっています。これはPAS Tileに入力項目に不足があることを意味します。
BOSH Director Tileは緑色なので2.5へのバージョンアップに伴う設定追加は不要です。

![image](https://user-images.githubusercontent.com/106908/58191585-d5f7d280-7cf9-11e9-898d-16588a15fa27.png)

Tileをクリックすると、"Cloud Controller"の項目に不足があることがわかります。

![image](https://user-images.githubusercontent.com/106908/58191639-f6279180-7cf9-11e9-8485-360d972c2d8d.png)

`Type "X" to acknowledge that you have no applications running with cflinuxfs2. If you are upgrading from 2.4, please read this documentation closely for steps to verify all apps have been migrated: https://docs.pivotal.io/pivotalcf/2-5/upgrading/checklist.html#cflinuxfs3`の項目が不足しています。このフィールドに`X`を入力する必要があります。

![image](https://user-images.githubusercontent.com/106908/58191680-0f304280-7cfa-11e9-95d4-a24979842a98.png)

> この項目はPAS 2.4でアプリケーション用コンテナイメージのベースであるstackがcflinuxfs3 (Ubuntu 18)のみになり、cflinuxfs2 (Ubuntu 14)は削除されるので、全てのアプリケーションがcflinuxfs3に以降したことを確認したらXを明示的に入力してほしいという項目です。

この項目を`pas/config.yml`に設定するにはプロパティ名を知る必要があります。フォームのフィールドに対するプロパティ名を知る、手っ取り早い方法はChromeのDeveloper ToolででHTMLの要素を見ることです。

> PAS 2.6では不足しているプロパティ名を`om`コマンドで取得できるようになります。

![image](https://user-images.githubusercontent.com/106908/58191740-2f600180-7cfa-11e9-8bb3-5f4be0965e6b.png)

設定すべきプロパティ名は`.properties.stack_migration_acknowledgement`であることがわかります。

これを`pas/config.yml`の`product-properties`に追加します。

```yaml
product-properties:
  # 途中略
  .properties.stack_migration_acknowledgement:
    value: X
# ...
```

また、PASでは`consul_server`が`resource-config`から消えるので、以下のように`consul_server`の項目を削除して下さい。

```yaml
resource-config:
  # ...

  # PAS 2.5で項目がなくなるので削除
  # consul_server:
  #   instances: 0
```

`pas/config.yml`の変更を`om`コマンドで

```sh
om configure-product \
  --config ./pas/config.yml \
  --vars-file ./pas/vars.yml
```

ブラウザにアクセスするとPAS Tileも緑色になっていることがわかります。

![image](https://user-images.githubusercontent.com/106908/58192265-494e1400-7cfb-11e9-9399-959d1a4df28f.png)

以上で設定は完了です。Apply Changesしてアップデートを行います。

```sh
om apply-changes
```

これも2時間強かかります...

![image](https://user-images.githubusercontent.com/106908/58200800-9f788280-7d0e-11e9-8951-f6bfdafef4f0.png)

完了して、再度CFバージョンを確認するとバージョンアップしていることがわかります。

```
$ cf curl /v2/info
{
   "name": "Pivotal Application Service",
   "build": "2.5.4-build.5",
   "support": "https://support.pivotal.io",
   "version": 0,
   "description": "https://docs.pivotal.io/pivotalcf/2-5/pcf-release-notes/runtime-rn.html",
   "authorization_endpoint": "https://login.sys.pas.ik.am",
   "token_endpoint": "https://uaa.sys.pas.ik.am",
   "min_cli_version": "6.23.0",
   "min_recommended_cli_version": "6.23.0",
   "app_ssh_endpoint": "ssh.sys.pas.ik.am:2222",
   "app_ssh_host_key_fingerprint": "8d:b3:95:84:6b:65:c3:f0:64:cc:b3:18:25:3a:07:1b",
   "app_ssh_oauth_client": "ssh-proxy",
   "doppler_logging_endpoint": "wss://doppler.sys.pas.ik.am:443",
   "api_version": "2.131.0",
   "osbapi_version": "2.14",
   "routing_endpoint": "https://api.sys.pas.ik.am/routing"
}
```

2.5 -> 2.6へのバージョンアップ方法も基本的には同じです。
