How to run/deploy Google AppEngine Managed vms using Gradle

ぃ、小莉子 提交于 2019-12-08 04:13:23

问题


I've pushed, run and tested a managed VM with custom runtime as an AppEngine application. Now I want to make it multi-module, with the default module being a Google Cloud Endpoint configured to work with Android. Hence, I'm using Gradle as my build system.

Now, I noticed that Google has made some initial commits for gcloud preview app run/deploy into the gradle-appengine-plugin: https://github.com/GoogleCloudPlatform/gradle-appengine-plugin/commit/2e4a2b8abb7ec7905012f1f9c12adea7010a41b7

How do I use this extension? Do I add a section to my build.gradle like this?

appengine {
    endpoints {
        getClientLibsOnBuild = true
        getDiscoveryDocsOnBuild = true
    }
    gcloud {
        project = 'projectId?'
        app {
            dockerHost = tcp://192.168.59.103:2376
            version = 1.4.1
            server = //What goes here?
        }

    }
}

Or have I got it entirely wrong?

Please guide me on how to use this.

Also, how in specific do I setup the build.gradle rules for a "custom vm" which is not based off of a standard java runtime? (Since I can't just package an app.yaml and Dockerfile into a war folder)


回答1:


I would avoid this for now, the gcloud part of the plugin is still being worked out. As for the "server" flag, from the docs, you don't really need to specify that.

There are two options you can try for running the deploy though:

  1. Use gcloud directly for now (from the command line).

  2. You could try an Exec task in Gradle to call into your gcloud, You can get the webapp directory by doing AppEnginePlugin.getExplodedAppDirectory(project).absolute path

You'd have to add the Exec task to your build file to hook it in. It might look like this :

build.gradle

task gcloudExec1(type:Exec) {
    commandline 'gcloud', 'preview', 'app', 'deploy'
    args "--dockerHost=tcp:"
    args "--version=1.4.1"
    ....
    args AppEnginePlugin.getExplodedAppDir(project).absolutepath
}


来源:https://stackoverflow.com/questions/28379036/how-to-run-deploy-google-appengine-managed-vms-using-gradle

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!