LoginSignup
0
0

More than 5 years have passed since last update.

Google から「[Action Required] Please upgrade your App Engine Standard applications to Go version 1.9 by November 1」の連絡が来たので Golang のバージョンを上げた

Posted at

GAE(Google App Engine) で Golang 使った REST API(echo 編)で作成した、ソースコードを元に利用している、golang の バージョンを v1.8 から v1.9 にバージョンアップする。
まずは、Cloud SDK のバージョンアップから開始する。

Cloud SDK のバージョンを確認

sh
$ gcloud components list

Your current Cloud SDK version is: 172.0.1
The latest available version is: 212.0.0

┌────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│                                                   Components                                                   │
├──────────────────┬──────────────────────────────────────────────────────┬──────────────────────────┬───────────┤
│      Status      │                         Name                         │            ID            │    Size   │
├──────────────────┼──────────────────────────────────────────────────────┼──────────────────────────┼───────────┤
│ Update Available │ BigQuery Command Line Tool                           │ bq                       │   < 1 MiB │
│ Update Available │ Cloud SDK Core Libraries                             │ core                     │   8.2 MiB │
│ Update Available │ Cloud Storage Command Line Tool                      │ gsutil                   │   3.5 MiB │
│ Update Available │ gcloud app Python Extensions                         │ app-engine-python        │   6.1 MiB │
│ Not Installed    │ Cloud Bigtable Command Line Tool                     │ cbt                      │   4.8 MiB │
│ Not Installed    │ Cloud Bigtable Emulator                              │ bigtable                 │   4.3 MiB │
│ Not Installed    │ Cloud Datalab Command Line Tool                      │ datalab                  │   < 1 MiB │
│ Not Installed    │ Cloud Datastore Emulator                             │ cloud-datastore-emulator │  17.4 MiB │
│ Not Installed    │ Cloud Datastore Emulator (Legacy)                    │ gcd-emulator             │  38.1 MiB │
│ Not Installed    │ Cloud Pub/Sub Emulator                               │ pubsub-emulator          │  33.4 MiB │
│ Not Installed    │ Cloud SQL Proxy                                      │ cloud_sql_proxy          │   2.5 MiB │
│ Not Installed    │ Emulator Reverse Proxy                               │ emulator-reverse-proxy   │  14.5 MiB │
│ Not Installed    │ Google Cloud Build Local Builder                     │ cloud-build-local        │   4.4 MiB │
│ Not Installed    │ Google Container Local Builder                       │ container-builder-local  │   4.4 MiB │
│ Not Installed    │ Google Container Registry's Docker credential helper │ docker-credential-gcr    │   1.8 MiB │
│ Not Installed    │ gcloud Alpha Commands                                │ alpha                    │   < 1 MiB │
│ Not Installed    │ gcloud Beta Commands                                 │ beta                     │   < 1 MiB │
│ Not Installed    │ gcloud app Java Extensions                           │ app-engine-java          │ 118.6 MiB │
│ Not Installed    │ gcloud app PHP Extensions                            │ app-engine-php           │  21.9 MiB │
│ Not Installed    │ gcloud app Python Extensions (Extra Libraries)       │ app-engine-python-extras │  28.5 MiB │
│ Not Installed    │ kubectl                                              │ kubectl                  │  14.8 MiB │
│ Installed        │ App Engine Go Extensions                             │ app-engine-go            │ 152.8 MiB │
└──────────────────┴──────────────────────────────────────────────────────┴──────────────────────────┴───────────┘
To install or remove components at your current SDK version [172.0.1], run:
  $ gcloud components install COMPONENT_ID
  $ gcloud components remove COMPONENT_ID

To update your SDK installation to the latest version [212.0.0], run:
  $ gcloud components update

いくつかのコンポーネントが古いのでバージョンアップ

sh
$ gcloud components update


Your current Cloud SDK version is: 172.0.1
You will be upgraded to version: 212.0.0

┌──────────────────────────────────────────────────────────────────────────────┐
│                      These components will be updated.                       │
├─────────────────────────────────────────────────────┬────────────┬───────────┤
│                         Name                        │  Version   │    Size   │
├─────────────────────────────────────────────────────┼────────────┼───────────┤
│ App Engine Go Extensions                            │     1.9.67 │ 152.8 MiB │
│ BigQuery Command Line Tool                          │     2.0.34 │   < 1 MiB │
│ BigQuery Command Line Tool (Platform Specific)      │     2.0.34 │   < 1 MiB │
│ Cloud SDK Core Libraries                            │ 2018.08.13 │   8.2 MiB │
│ Cloud SDK Core Libraries (Platform Specific)        │ 2018.06.18 │   < 1 MiB │
│ Cloud Storage Command Line Tool                     │       4.33 │   3.5 MiB │
│ Cloud Storage Command Line Tool (Platform Specific) │       4.32 │   < 1 MiB │
│ gcloud app Python Extensions                        │     1.9.73 │   6.1 MiB │
│ gcloud cli dependencies                             │ 2018.08.13 │   2.4 MiB │
│ gcloud cli dependencies                             │ 2018.08.03 │   1.5 MiB │
└─────────────────────────────────────────────────────┴────────────┴───────────┘
┌───────────────────────────────────────────────┐
│      These components will be installed.      │
├──────────────────────────┬─────────┬──────────┤
│           Name           │ Version │   Size   │
├──────────────────────────┼─────────┼──────────┤
│ Cloud Datastore Emulator │   2.0.1 │ 17.4 MiB │
│ gRPC python library      │   1.9.1 │  7.6 MiB │
│ gRPC python library      │         │          │
└──────────────────────────┴─────────┴──────────┘

A lot has changed since your last upgrade.  For the latest full release notes,
please visit:
  https://cloud.google.com/sdk/release_notes

Do you want to continue (Y/n)?  Y

╔════════════════════════════════════════════════════════════╗
╠═ Creating update staging area                             ═╣
╠════════════════════════════════════════════════════════════╣
╠═ Uninstalling: App Engine Go Extensions                   ═╣
╠════════════════════════════════════════════════════════════╣
╠═ Uninstalling: BigQuery Command Line Tool                 ═╣
╠════════════════════════════════════════════════════════════╣
╠═ Uninstalling: BigQuery Command Line Tool (Platform Sp... ═╣
╠════════════════════════════════════════════════════════════╣
╠═ Uninstalling: Cloud SDK Core Libraries                   ═╣
╠════════════════════════════════════════════════════════════╣
╠═ Uninstalling: Cloud SDK Core Libraries (Platform Spec... ═╣
╠════════════════════════════════════════════════════════════╣
╠═ Uninstalling: Cloud Storage Command Line Tool            ═╣
╠════════════════════════════════════════════════════════════╣
╠═ Uninstalling: Cloud Storage Command Line Tool (Platfo... ═╣
╠════════════════════════════════════════════════════════════╣
╠═ Uninstalling: gcloud app Python Extensions               ═╣
╠════════════════════════════════════════════════════════════╣
╠═ Uninstalling: gcloud cli dependencies                    ═╣
╠════════════════════════════════════════════════════════════╣
╠═ Uninstalling: gcloud cli dependencies                    ═╣
╠════════════════════════════════════════════════════════════╣
╠═ Installing: App Engine Go Extensions                     ═╣
╠════════════════════════════════════════════════════════════╣
╠═ Installing: BigQuery Command Line Tool                   ═╣
╠════════════════════════════════════════════════════════════╣
╠═ Installing: BigQuery Command Line Tool (Platform Spec... ═╣
╠════════════════════════════════════════════════════════════╣
╠═ Installing: Cloud Datastore Emulator                     ═╣
╠════════════════════════════════════════════════════════════╣
╠═ Installing: Cloud SDK Core Libraries                     ═╣
╠════════════════════════════════════════════════════════════╣
╠═ Installing: Cloud SDK Core Libraries (Platform Specific) ═╣
╠════════════════════════════════════════════════════════════╣
╠═ Installing: Cloud Storage Command Line Tool              ═╣
╠════════════════════════════════════════════════════════════╣
╠═ Installing: Cloud Storage Command Line Tool (Platform... ═╣
╠════════════════════════════════════════════════════════════╣
╠═ Installing: gRPC python library                          ═╣
╠════════════════════════════════════════════════════════════╣
╠═ Installing: gRPC python library                          ═╣
╠════════════════════════════════════════════════════════════╣
╠═ Installing: gcloud app Python Extensions                 ═╣
╠════════════════════════════════════════════════════════════╣
╠═ Installing: gcloud cli dependencies                      ═╣
╠════════════════════════════════════════════════════════════╣
╠═ Installing: gcloud cli dependencies                      ═╣
╠════════════════════════════════════════════════════════════╣
╠═ Creating backup and activating new installation          ═╣
╚════════════════════════════════════════════════════════════╝

Performing post processing steps...done.                                                                                                                                         

==> Start a new shell for the changes to take effect.


Update done!

To revert your SDK to the previously installed version, you may run:
  $ gcloud components update --version 172.0.1

WARNING:   There are alternate versions of the following Google Cloud Platform tools on
  your system PATH. Please double check your PATH:

  /Applications/local/google-cloud-sdk/platform/google_appengine/dev_appserver.py
/Applications/local/google-cloud-sdk/platform/google_appengine/endpointscfg.py


MacBook-Pro:appengine yasu$ gcloud components list

Your current Cloud SDK version is: 212.0.0
The latest available version is: 212.0.0

┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│                                                  Components                                                 │
├───────────────┬──────────────────────────────────────────────────────┬──────────────────────────┬───────────┤
│     Status    │                         Name                         │            ID            │    Size   │
├───────────────┼──────────────────────────────────────────────────────┼──────────────────────────┼───────────┤
│ Not Installed │ Cloud Bigtable Command Line Tool                     │ cbt                      │   4.8 MiB │
│ Not Installed │ Cloud Bigtable Emulator                              │ bigtable                 │   4.3 MiB │
│ Not Installed │ Cloud Datalab Command Line Tool                      │ datalab                  │   < 1 MiB │
│ Not Installed │ Cloud Datastore Emulator (Legacy)                    │ gcd-emulator             │  38.1 MiB │       
│ Not Installed │ Cloud Pub/Sub Emulator                               │ pubsub-emulator          │  33.4 MiB │
│ Not Installed │ Cloud SQL Proxy                                      │ cloud_sql_proxy          │   2.5 MiB │
│ Not Installed │ Emulator Reverse Proxy                               │ emulator-reverse-proxy   │  14.5 MiB │
│ Not Installed │ Google Cloud Build Local Builder                     │ cloud-build-local        │   4.4 MiB │
│ Not Installed │ Google Container Local Builder                       │ container-builder-local  │   4.4 MiB │
│ Not Installed │ Google Container Registry's Docker credential helper │ docker-credential-gcr    │   1.8 MiB │
│ Not Installed │ gcloud Alpha Commands                                │ alpha                    │   < 1 MiB │
│ Not Installed │ gcloud Beta Commands                                 │ beta                     │   < 1 MiB │
│ Not Installed │ gcloud app Java Extensions                           │ app-engine-java          │ 118.6 MiB │
│ Not Installed │ gcloud app PHP Extensions                            │ app-engine-php           │  21.9 MiB │
│ Not Installed │ gcloud app Python Extensions (Extra Libraries)       │ app-engine-python-extras │  28.5 MiB │
│ Not Installed │ kubectl                                              │ kubectl                  │  14.8 MiB │
│ Installed     │ App Engine Go Extensions                             │ app-engine-go            │ 152.8 MiB │
│ Installed     │ BigQuery Command Line Tool                           │ bq                       │   < 1 MiB │
│ Installed     │ Cloud Datastore Emulator                             │ cloud-datastore-emulator │  17.4 MiB │
│ Installed     │ Cloud SDK Core Libraries                             │ core                     │   8.2 MiB │
│ Installed     │ Cloud Storage Command Line Tool                      │ gsutil                   │   3.5 MiB │
│ Installed     │ gcloud app Python Extensions                         │ app-engine-python        │   6.1 MiB │
└───────────────┴──────────────────────────────────────────────────────┴──────────────────────────┴───────────┘
To install or remove components at your current SDK version [212.0.0], run:
  $ gcloud components install COMPONENT_ID
  $ gcloud components remove COMPONENT_ID

To update your SDK installation to the latest version [212.0.0], run:
  $ gcloud components update

Cloud SDK のバージョンを確認

sh
$ gcloud components list

Your current Cloud SDK version is: 212.0.0
The latest available version is: 212.0.0

┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
│                                                  Components                                                 │
├───────────────┬──────────────────────────────────────────────────────┬──────────────────────────┬───────────┤
│     Status    │                         Name                         │            ID            │    Size   │
├───────────────┼──────────────────────────────────────────────────────┼──────────────────────────┼───────────┤
│ Not Installed │ Cloud Bigtable Command Line Tool                     │ cbt                      │   4.8 MiB │
│ Not Installed │ Cloud Bigtable Emulator                              │ bigtable                 │   4.3 MiB │
│ Not Installed │ Cloud Datalab Command Line Tool                      │ datalab                  │   < 1 MiB │
│ Not Installed │ Cloud Datastore Emulator (Legacy)                    │ gcd-emulator             │  38.1 MiB │
│ Not Installed │ Cloud Pub/Sub Emulator                               │ pubsub-emulator          │  33.4 MiB │
│ Not Installed │ Cloud SQL Proxy                                      │ cloud_sql_proxy          │   2.5 MiB │
│ Not Installed │ Emulator Reverse Proxy                               │ emulator-reverse-proxy   │  14.5 MiB │
│ Not Installed │ Google Cloud Build Local Builder                     │ cloud-build-local        │   4.4 MiB │
│ Not Installed │ Google Container Local Builder                       │ container-builder-local  │   4.4 MiB │
│ Not Installed │ Google Container Registry's Docker credential helper │ docker-credential-gcr    │   1.8 MiB │
│ Not Installed │ gcloud Alpha Commands                                │ alpha                    │   < 1 MiB │
│ Not Installed │ gcloud Beta Commands                                 │ beta                     │   < 1 MiB │
│ Not Installed │ gcloud app Java Extensions                           │ app-engine-java          │ 118.6 MiB │
│ Not Installed │ gcloud app PHP Extensions                            │ app-engine-php           │  21.9 MiB │
│ Not Installed │ gcloud app Python Extensions (Extra Libraries)       │ app-engine-python-extras │  28.5 MiB │
│ Not Installed │ kubectl                                              │ kubectl                  │  14.8 MiB │
│ Installed     │ App Engine Go Extensions                             │ app-engine-go            │ 152.8 MiB │
│ Installed     │ BigQuery Command Line Tool                           │ bq                       │   < 1 MiB │
│ Installed     │ Cloud Datastore Emulator                             │ cloud-datastore-emulator │  17.4 MiB │
│ Installed     │ Cloud SDK Core Libraries                             │ core                     │   8.2 MiB │
│ Installed     │ Cloud Storage Command Line Tool                      │ gsutil                   │   3.5 MiB │
│ Installed     │ gcloud app Python Extensions                         │ app-engine-python        │   6.1 MiB │
└───────────────┴──────────────────────────────────────────────────────┴──────────────────────────┴───────────┘
To install or remove components at your current SDK version [212.0.0], run:
  $ gcloud components install COMPONENT_ID
  $ gcloud components remove COMPONENT_ID

To update your SDK installation to the latest version [212.0.0], run:
  $ gcloud components update

全てのコンポーネントが最新の状態にアップデートされていることを確認

ソースコードを修正

GAE の仕様が変わって、「application」「version」は削除しないとdeployできないので削除
```gae_echo/app-engine.yaml
runtime: go
api_version: go1.9 // ← go1.8 から go1.9 に変更

handlers:
- url: /.*
script: _go_app
```

動作確認

sh
$ goapp serve gae_echo/app-engine.yaml
WARNING  2018-08-21 00:10:39,055 devappserver2.py:124] *** Notice ***
In a few weeks dev_appserver will default to using the Cloud Datastore Emulator. We strongly recommend you to enable this change earlier.
To opt-in, run dev_appserver with the flag --support_datastore_emulator=True
Read the documentation: https://cloud.google.com/appengine/docs/standard/python/tools/migrate-cloud-datastore-emulator
Help us validate that the feature is ready by taking this survey: https://goo.gl/forms/UArIcs8K9CUSCm733
Report issues at: https://issuetracker.google.com/issues/new?component=187272

INFO     2018-08-21 00:10:39,063 devappserver2.py:178] Skipping SDK update check.
INFO     2018-08-21 00:10:39,159 api_server.py:274] Starting API server at: http://localhost:52752
INFO     2018-08-21 00:10:39,165 dispatcher.py:270] Starting module "default" running at: http://localhost:8080
INFO     2018-08-21 00:10:39,168 admin_server.py:152] Starting admin server at: http://localhost:8000
INFO     2018-08-21 00:10:42,083 instance.py:294] Instance PID: 4062

警告が出たけど、今回は一旦スキップ

sh
$ curl http://localhost:8080/users | python -m json.tool
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100    40  100    40    0     0   2450      0 --:--:-- --:--:-- --:--:--  2500
{
    "1": {
        "id": "1",
        "name": "Wreck-It Ralph"
    }
}

動いた!

課題

でも、GAE にアップロードできなくなってる
ほんと意味ない。。。
次回その記事について記載します。
このブログによると V2 から V3 へバージョンアップされたからっぽいですね。
とりあえず、他の Web フレームワークを利用して試して見ます。

ソースコード

0
0
6

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0