2
votes

I have a spring boot gradle project, I'm developing in eclipse and pushing to a cloud repository. I configured a cloud build trigger to kick off a gradle build and deploy to the app engine (standard). According to the build log, every step is successful, but when I hit the URL, I get a 404, don't know why.

When I do a gradle appengineDeploy from my laptop, I'm able to deploy to the app engine and my service comes up. This leads me to believe that my cloudbuild.yaml file is not correct.

cloudbuild.yaml

steps:
  - name: 'gcr.io/cloud-builders/gradle'
    args: ['build']
  - name: 'gcr.io/cloud-builders/gcloud'
    args: ['app', 'deploy', 'src/main/webapp/WEB-INF/appengine-web.xml']
timeout: '1600s'

src/main/webapp/WEB-INF/appengine-web.xml

<appengine-web-app xmlns="http://appengine.google.com/ns/1.0">
  <application>my_project_id</application>
  <version>1</version>
  <threadsafe>true</threadsafe>
  <runtime>java8</runtime>
  <system-properties>
    <property name="java.util.logging.config.file" value="WEB-INF/classes/logging.properties"/>
  </system-properties>    
</appengine-web-app>

build.gradle

buildscript {
    ext {
        springBootVersion = '2.0.6.RELEASE'
    }
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
        classpath 'com.google.cloud.tools:appengine-gradle-plugin:1.+' 
    }
}

apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'org.springframework.boot'
apply plugin: 'io.spring.dependency-management'
apply plugin: 'com.google.cloud.tools.appengine'
apply plugin: 'war'

group = 'my-group'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = 1.8

repositories {
    mavenCentral()
}


dependencies {
    compileOnly('javax.servlet:javax.servlet-api:3.1.0')
    compileOnly('org.slf4j:jul-to-slf4j')
    implementation('org.springframework.boot:spring-boot-starter-data-jpa')
    implementation('org.springframework.cloud:spring-cloud-gcp-starter-sql-mysql:1.0.0.RELEASE')
    implementation('org.springframework.boot:spring-boot-starter-web') {
       exclude group: 'org.springframework.boot', module: 'spring-boot-starter-tomcat'
    }
    implementation('com.google.appengine:appengine-api-1.0-sdk:+')
}

buildlog

Step #0: BUILD SUCCESSFUL in 53s
Step #0: 4 actionable tasks: 4 executed
Finished Step #0
Starting Step #1
Step #1: Already have image (with digest): gcr.io/cloud-builders/gcloud
Step #1: Services to deploy:
Step #1: 
Step #1: descriptor: [/workspace/src/main/webapp/WEB-INF/appengine-web.xml]
Step #1: source: [/workspace/src/main/webapp]
Step #1: target project: [dev-poc-220521]
Step #1: target service: [default]
Step #1: target version: [20181111t040050]
Step #1: target url: [https://dev-poc-220521.appspot.com]
Step #1: 
Step #1: 
Step #1: Do you want to continue (Y/n)? 
Step #1: Beginning deployment of service [default]...
Step #1: #============================================================#
Step #1: #= Uploading 5 files to Google Cloud Storage =#
Step #1: #============================================================#
Step #1: File upload done.
Step #1: Updating service [default]...
Step #1: .......................................................done.
Step #1: Setting traffic split for service [default]...
Step #1: ........done.
Step #1: Deployed service [default] to [https://dev-poc-220521.appspot.com]
Step #1: 
Step #1: You can stream logs from the command line by running:
Step #1: $ gcloud app logs tail -s default
Step #1: 
Step #1: To view your application in the web browser run:
Step #1: $ gcloud app browse --project=dev-poc-220521
Finished Step #1
1
check your server logs app engine -> services -> tools -> logsCaner
Did you ever find an answer to this? I've been working on this same issue all day on a nodejs projectCodeOwl

1 Answers

0
votes

Did you check port settings in server.port=<some_port_number> in application.properties? I had the same issue and when I remove custom port number it works as expected.