Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/selenium/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Google compute engine Bitbucket(https)中的启动脚本无法下载,但在实例重置时可以工作_Google Compute Engine - Fatal编程技术网

Google compute engine Bitbucket(https)中的启动脚本无法下载,但在实例重置时可以工作

Google compute engine Bitbucket(https)中的启动脚本无法下载,但在实例重置时可以工作,google-compute-engine,Google Compute Engine,我正在使用Go[1]的计算引擎API和我制作的名为vmproxy[2]的工具以编程方式启动一个新实例 我的问题是,如果我使用指向的启动脚本url启动一个可抢占的VM,构建脚本将无法下载。我可以在串行控制台输出中看到启动脚本元数据在那里,并且它试图用curl下载,但这部分失败了 但是,如果我通过开发人员控制台重置实例,脚本将正确下载并运行良好 我用于设置实例的代码是: // Ronolinux is a VM Proxy that runs an live systems build on Com

我正在使用Go[1]的计算引擎API和我制作的名为vmproxy[2]的工具以编程方式启动一个新实例

我的问题是,如果我使用指向的启动脚本url启动一个可抢占的VM,构建脚本将无法下载。我可以在串行控制台输出中看到启动脚本元数据在那里,并且它试图用curl下载,但这部分失败了

但是,如果我通过开发人员控制台重置实例,脚本将正确下载并运行良好

我用于设置实例的代码是:

// Ronolinux is a VM Proxy that runs an live systems build on Compute Engine
var (
    Ronolinux = &vmproxy.VM{
        Path: "/",
        Instance: vmproxy.Instance{
            Name:        "ronolinux-buildd",
            Zone:        "us-central1-f",
            Image:       vmproxy.ResourcePrefix + "/debian-cloud/global/images/debian-8-jessie-v20150915",
            MachineType: "n1-standard-1",
            Metadata: map[string]string{
                "startup-script-url": "https://bitbucket.org/ronoaldo/debian-custom/raw/tip/tools/autobuild",
                "shutdown-script": `!#/bin/bash
gsutil cp /var/log/startupscript.log gs://ronoaldo/ronolinux/build-$(date +%Y%m%d%H%M%S).log
`,
            },  
            Scopes: []string{ storageReadWrite },
        },  
    }   
)
[1]


[2]

如果您的启动脚本未托管在云存储上,则下载可能会随机失败。如果查看串行控制台输出,请确保水平滚动,因为它不会缠绕长线。在我的例子中,错误行很长,这隐藏了消息的真正结尾:

(... long curl on-line progress output )
curl: (7) Failed to connect to bitbucket.org port 443: Connection timed out
(...)
您的主机必须在10秒内作出响应。在我的例子中,第一次引导通常无法联系Bitbucket,因此无法下载脚本;虚拟机重置也让一切正常,因为谷歌云以外的网络延迟可能更好

为了避免这些问题,我最终将脚本托管在云存储上