如何使用Gradle运行/部署Google AppEngine托管的VM [英] How to run/deploy Google AppEngine Managed vms using Gradle

查看:170
本文介绍了如何使用Gradle运行/部署Google AppEngine托管的VM的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已将具有自定义运行时的托管VM作为AppEngine应用程序推送,运行和测试.现在,我想使其成为多模块,默认模块是配置为可与Android一起使用的Google Cloud Endpoint.因此,我将Gradle用作构建系统.

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.

现在,我注意到Google已将graco-appengine-plugin的gcloud预览应用程序运行/部署进行了一些初始提交:

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

如何使用此扩展程序?我会像这样在我的build.gradle中添加一个部分吗?

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?
        }

    }
}

还是我完全理解错了?

请指导我如何使用它.

此外,我该如何特别为不基于标准Java运行时的自定义vm"设置build.gradle规则? (因为我不能只将app.yaml和Dockerfile打包到war文件夹中)

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)

推荐答案

我暂时避免这种情况,该插件的gcloud部分仍在制定中.至于服务器"标志,请从文档真的不需要指定它.

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. 现在(从命令行)直接使用gcloud.

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

您可以尝试在Gradle中执行一个Exec任务以调用您的gcloud,可以通过执行AppEnginePlugin.getExplodedAppDirectory(project).absolute path

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

您必须添加 Exec任务挂接到您的构建文件中.它可能看起来像这样:

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
}

这篇关于如何使用Gradle运行/部署Google AppEngine托管的VM的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆