appengine-plugins icon indicating copy to clipboard operation
appengine-plugins copied to clipboard

how to choose the environment in app engine gradle plugin ?

Open pradeepsimba opened this issue 2 years ago • 4 comments

I am using this plugin apply plugin: 'com.google.cloud.tools.appengine' .

I want to deploy my spring boot app on app engine's standard envronment. But , I have some doubts.

where do I represent the environment name ?

This is my project : https://github.com/Jeevasimba/appengine_example

my gradle file : https://github.com/Jeevasimba/appengine_example/blob/main/build.gradle

my YAML file : https://github.com/Jeevasimba/appengine_example/blob/main/src/main/appengine/app.yaml

what is difference between appengineDeploy and appengineDeployAll ?

image

I am new to gcloud app engine's standard environment .

### I referred online to deploy in standard env.

step 1: enable 'App engine Api'

step 2: INSTALL this sdk in projects terminal.

# Install the gcloud CLI
gcloud components install app-engine-java cloud-sdk

step 3: choosing server location

    # Create a new App Engine standard environment app
    gcloud app create

step 4: deploying

gradle appengineDeploy       

my doubt is where do I mention the environment's name as standard ?

This is my project : https://github.com/Jeevasimba/appengine_example. are there any mistake I have done in my project ?

is there any sample project with spring boot with gradle build for app engine's standard environment in github ?

help me to solve this problem !!!

pradeepsimba avatar Oct 12 '23 11:10 pradeepsimba

You already specified the standard env in src/main/appengine/app.yaml.

runtime: java11
env: standard
instance_class: B8

But the current App Engine standard env doc doesn't mention the env element, so I'm guessing it defaults to standard when it's missing. OTOH, the flexible doc does say env: flexible is required.

env: flex Required: Select the flexible environment.


appengineDeployAll runs all the deploy tasks: appengineDeployCron, appengineDeployDispatch, appengineDeployDos, appengineDeployIndex, appengineDeployQueue, and most importantly, appengineDeploy. That is, it deploys all the YAML config files together with the app.

chanseokoh avatar Oct 12 '23 14:10 chanseokoh

gradle.build

    buildscript {
        repositories {
            mavenCentral()
        }
        dependencies {
            classpath 'com.google.cloud.tools:appengine-gradle-plugin:2.4.5'
        }
    }
    
    plugins {
        id 'java'
        id 'org.springframework.boot' version '2.5.4'
        id 'io.spring.dependency-management' version '1.0.11.RELEASE'
    }
    
    apply plugin: 'com.google.cloud.tools.appengine'
    
    repositories {
        mavenCentral()
        maven { url "https://packages.jetbrains.team/maven/p/ij/intellij-dependencies" }
        flatDir {
            dirs 'lib'
        }
        google()
    }
    
    dependencies {
        testImplementation platform('org.junit:junit-bom:5.9.1')
        testImplementation 'org.junit.jupiter:junit-jupiter'
    
        implementation 'com.google.firebase:firebase-database:20.0.1'
        implementation 'com.google.firebase:firebase-admin:9.0.0'
        // https://mvnrepository.com/artifact/org.json/json
        implementation group: 'org.json', name: 'json', version: '20230618'
    
        implementation 'org.springframework.boot:spring-boot-starter-web'
        implementation 'org.springframework.boot:spring-boot-starter'
        testImplementation 'org.springframework.boot:spring-boot-starter-test'
    }
    
    test {
        useJUnitPlatform()
    }
    
    appengine {
        deploy {
            stopPreviousVersion = true
        }
    }

below code is a common way to configure an App Engine app to stop the previous version when the new version is deployed using the gcloud command-line tool.

appengine {
    deploy {
        stopPreviousVersion = true
    }
}

If I push new code to github it will automatically deploy it on gcloud and stop the previous version app.

How do I do this with this plugin ?

pradeepsimba avatar Oct 13 '23 06:10 pradeepsimba

How do I do this with this plugin ?

appengine {
	deploy {
		stopPreviousVersion = true
	}
}

stjasink avatar Dec 20 '23 09:12 stjasink

Hi @pradeepsimba, did @stjasink and @chanseokoh suggestion work for you?

diegomarquezp avatar Jun 25 '24 20:06 diegomarquezp