質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.49%
Google API

Googleは多種多様なAPIを提供していて、その多くはウェブ開発者向けのAPIです。それらのAPIは消費者に人気なGoogleのサービス(Google Maps, Google Earth, AdSense, Adwords, Google Apps,YouTube等)に基づいています。

Java

Javaは、1995年にサン・マイクロシステムズが開発したプログラミング言語です。表記法はC言語に似ていますが、既存のプログラミング言語の短所を踏まえていちから設計されており、最初からオブジェクト指向性を備えてデザインされています。セキュリティ面が強力であることや、ネットワーク環境での利用に向いていることが特徴です。Javaで作られたソフトウェアは基本的にいかなるプラットフォームでも作動します。

Google

Googleは、アメリカ合衆国に位置する、インターネット関連のサービスや製品を提供している企業です。検索エンジンからアプリケーションの提供まで、多岐にわたるサービスを提供しています。

Q&A

解決済

2回答

2597閲覧

GoogleAppEngineへのデプロイ

kiyoooo

総合スコア12

Google API

Googleは多種多様なAPIを提供していて、その多くはウェブ開発者向けのAPIです。それらのAPIは消費者に人気なGoogleのサービス(Google Maps, Google Earth, AdSense, Adwords, Google Apps,YouTube等)に基づいています。

Java

Javaは、1995年にサン・マイクロシステムズが開発したプログラミング言語です。表記法はC言語に似ていますが、既存のプログラミング言語の短所を踏まえていちから設計されており、最初からオブジェクト指向性を備えてデザインされています。セキュリティ面が強力であることや、ネットワーク環境での利用に向いていることが特徴です。Javaで作られたソフトウェアは基本的にいかなるプラットフォームでも作動します。

Google

Googleは、アメリカ合衆国に位置する、インターネット関連のサービスや製品を提供している企業です。検索エンジンからアプリケーションの提供まで、多岐にわたるサービスを提供しています。

0グッド

0クリップ

投稿2019/07/19 10:56

前提・実現したいこと

GCPのGAEのフレキシブル環境、スタンダード環境でAppEngineへデプロイしたいです。
EclipseからAppEngineにデプロイするために、一度source repositriesへプッシュしてから
デプロイしようとしています。
その際、CloudBUildでビルドをする際に以下のようなエラーが出てしまいました。

発生している問題・エラーメッセージ

FETCHSOURCE
Initialized empty Git repository in /workspace/.git/
From https://source.developers.google.com/p/XXXX/r/coffee

  • branch AAAAA -> FETCH_HEAD

HEAD is now at b0be42f slsl
BUILD
Already have image (with digest): gcr.io/cloud-builders/gcloud
Services to deploy:

descriptor: [/workspace/app.yaml]
source: [/workspace]
target project: [XXXX]
target service: [default]
target version: [20190101]
target url: [https://XXXX.appspot.com]

Do you want to continue (Y/n)?
WARNING: Unable to verify that the Appengine Flexible API is enabled for project [XXXX]. You may not have permission to list enabled services on this project. If it is not enabled, this may cause problems in running your deployment. Please ask the project owner to ensure that the Appengine Flexible API has been enabled and that this account has permission to list enabled APIs.
Beginning deployment of service [default]...
Building and pushing image for service [default]
ERROR: gcloud crashed (InvalidBuildError): Field [timeout] was provided, but should not have been. You may be using an improper Cloud Build pipeline.

If you would like to report this issue, please run the following command:
gcloud feedback

To check gcloud for common problems, please run the following command:
gcloud info --run-diagnostics
ERROR
ERROR: build step 0 "gcr.io/cloud-builders/gcloud" failed: exit status 1

該当のソースコード

app.yaml

runtime: custom
env: flex
cloudbuild.yaml

steps:

  • name: "gcr.io/cloud-builders/gcloud"
    args: ["app", "deploy"]

timeout: "1600s"

試したこと

Field [timeout] was provided, but should not have been.
とあるので、app.yamlのtimeoutを削除しましたが、ビルドが止まらなくなるだけした・・

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

guest

回答2

0

自己解決

Eclipse上でGCPプロジェクトを立ち上げて正常に起動するにはファイルの追加はcloudbuild.yamlだけで大丈夫でした。
今回TetsProjectという名前でEclipse上でプロジェクトを作成しました。
appengine-web.xmlの場所を指定してあげてください。
cloudbuild.yaml↓

steps:

  • name: "gcr.io/cloud-builders/gcloud"
    args: ["app", "deploy", "TestProject/src/main/webapp/WEB-INF/appengine-web.xml"]

timeout: "1600s"

またServletがないという404エラーも発生していたため対処法を記述しておきます。
Eclipse上で作成したプロジェクトを右クリックし、「プロパティ」→「Javaのビルドパス」
ソースタブの「デフォルト出力フォルダー」を下記のようにに変更してください。

TestProject/src/main/webapp/WEB-INF/classes

また「ビルドパス上のソースフォルダー」もTestProject/src/main/javaの出力フォルダーを上記のデフォルト出力フォルダーに変更してください。

GCPやEclipseの理解が甘かったためなかなか解決できませんでした。。
勉強不足です。。

投稿2019/09/04 00:56

kiyoooo

総合スコア12

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

0

WARNING: Unable to verify that the Appengine Flexible API is enabled for project [XXXX]. You may not have permission to list enabled services on this project. If it is not enabled, this may cause problems in running your deployment. Please ask the project owner to ensure that the Appengine Flexible API has been enabled and that this account has permission to list enabled APIs.

とあるので AppEngine Flexible API を有効にしてみるとどうでしょうか?

https://console.cloud.google.com/apis/library/appengineflex.googleapis.com?q=AppEngine

投稿2019/07/19 20:04

teikoku-penguin

総合スコア314

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

kiyoooo

2019/07/22 04:56

回答ありがとうございます。 説明が不足しており申し訳ございません。APIを有効にしておりますが、 WARNINGでAPIが有効化されていないと表示されてしまいます。
kiyoooo

2019/07/24 00:53

上記の方法を試してみたところ、Dockerfileが必要というエラーが表示されました。 そこからDockerfileを追加したところ、GCPサイトのトラブルシューティングにapp.yamlに下記のような記述の追加が必要と書かれていました。 readiness_check: path: "/readiness_check" check_interval_sec: 5 timeout_sec: 4 failure_threshold: 2 success_threshold: 2 app_start_timeout_sec: 300 この記述を追加したところ、 ERROR: (gcloud.app.deploy) Error Response: [4] Your deployment has failed to become healthy in the allotted time and therefore was rolled back. If you believe this was an error, try adjusting the 'app_start_timeout_sec' setting in the 'readiness_check' section. というエラーが出てしまいました・・
teikoku-penguin

2019/07/24 11:37

timeout_sec: 4 を長めに設定してみて下さい 4秒ではビルドできないと思います
kiyoooo

2019/07/24 13:07

何度も回答ありがとうございます。 ERROR: (gcloud.app.deploy) Error Response: [13] Flex operation projects/XXXX/regions/asia-northeast1/operations/2ecfcbc3-c556-4fea-9ed3-8c204b26dd9a error [INTERNAL]: An internal error occurred while processing task /appengine-flex-v1/insert_flex_deployment/flex_create_resources>2019-07-24T13:03:28.025Z24651.ow.1: Deployment Manager operation steel-spark-244108/operation-1563973409235-58e6cef7ee11f-b9db3888-49321065 errors: [code: "RESOURCE_ERROR" location: "/deployments/aef-default-20190724t130258/resources/aef-default-20190724t130258-hcs" message: "{\"ResourceType\":\"compute.v1.httpsHealthCheck\",\"ResourceErrorCode\":\"400\",\"ResourceErrorMessage\":{\"code\":400,\"errors\":[{\"domain\":\"global\",\"message\":\"Invalid value for field \'resource.timeoutSec\': \'6\'. TimeoutSec should be less than checkIntervalSec.\",\"reason\":\"invalid\"}],\"message\":\"Invalid value for field \'resource.timeoutSec\': \'6\'. TimeoutSec should be less than checkIntervalSec.\",\"statusMessage\":\"Bad Request\",\"requestPath\":\"https://www.googleapis.com/compute/v1/projects/XXXX/global/httpsHealthChecks\",\"httpMethod\":\"POST\"}}" ] ERROR ERROR: build step 0 "gcr.io/cloud-builders/gcloud" failed: exit status 1 というエラーが出ました。。 timeout_secは6、10を試してみましたが、上記のようなエラーが出てしまいます。
teikoku-penguin

2019/07/25 10:07

timeout_sec は check_interval_sec より小さい値である必要があると書いてありますね
kiyoooo

2019/07/26 00:30

timeout_sec を check_interval_sec より小さい値で設定してもタイムアウトしてしまいます。 errorとして ERROR: (gcloud.app.deploy) Error Response: [4] Your deployment has failed to become healthy in the allotted time and therefore was rolled back. If you believe this was an error, try adjusting the 'app_start_timeout_sec' setting in the 'readiness_check' section. とあるのでtimeout_secとcheck_interval_secの値を調整しているところです。。
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.49%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問