我有一个在 Cloud Run 上运行的服务,以及一个在 Compute Engine 上运行的 MYSQL、MongoDB 数据库。目前,我正在使用公共 IP 在它们之间进行连接,我想使用内部 IP 来提高性能,但我找不到解决此问题的方法,请帮助我一些想法,谢谢。
google-compute-engine google-cloud-platform google-cloud-run google-vpc
我正在使用这个Ghost 插件在 Google Drive 上存储图像数据。最近,图像已停止加载,并下载了此错误页面来代替图像:
该站点在 Google Cloud Run 上的容器化 Ghost 实例中运行,来源在这里
我是否需要在某处打开支持票来解决这个问题?有问题的网站在这里
编辑:这是用于访问保存的内容的代码。
jwtClient.authorize(function(err, tokens) {
if (err) {
return next(err);
}
const drive = google.drive({
version: API_VERSION,
auth: jwtClient
});
drive.files.get(
{
fileId: id
},
function(err, response) {
if (!err) {
const file = response.data;
const newReq = https
.request(
file.downloadUrl + "&access_token=" + tokens.access_token,
function(newRes) {
// Modify google headers here to cache!
const headers = newRes.headers;
headers["content-disposition"] =
"attachment; filename=" + file.originalFilename; …Run Code Online (Sandbox Code Playgroud) from flask import Flask, request
app = Flask(__name__)
@app.route('/', methods=['GET'])
def hello():
"""Return a friendly HTTP greeting."""
who = request.args.get('who', 'World')
return f'Hello {who}!\n'
if __name__ == '__main__':
# Used when running locally only. When deploying to Cloud Run,
# a webserver process such as Gunicorn will serve the app.
app.run(host='localhost', port=8080, debug=True)
Run Code Online (Sandbox Code Playgroud)
# Use an official lightweight Python image.
# https://hub.docker.com/_/python
FROM python:3.7-slim
# Install production dependencies.
RUN pip install …Run Code Online (Sandbox Code Playgroud) python flask gunicorn google-cloud-platform google-cloud-run
使用以下命令部署新的 Cloud Run 修订版时,
gcloud run services replace service.yaml
Run Code Online (Sandbox Code Playgroud)
部署失败并出现此错误
ERROR: (gcloud.run.services.replace) ALREADY_EXISTS: Revision named 'yourservicename-00001-soj' with different configuration already exists.
Run Code Online (Sandbox Code Playgroud)
当您按照 Google 的文档进行操作时,就会发生这种情况,该文档指示您将当前服务 YAML 描述提取到文件中,进行编辑,然后重新部署它。
借助 Google Cloud Run 第二代运行时,现在可以使用 gcsfuse 挂载 Google 存储桶。
https://cloud.google.com/run/docs/tutorials/network-filesystems-fuse
python3 示例运行良好。不幸的是,我的 Dockerfile 不断收到此错误:
bin/fusermount: failed to open /dev/fuse: Permission denied
mountWithArgs: mountWithConn: Mount: mount: running /bin/fusermount: exit status 1
Run Code Online (Sandbox Code Playgroud)
Dockerfile
# https://github.com/chiaen/docker-gcsfuse
FROM golang:1.17.5-alpine as gcsfuse
RUN apk add --no-cache git
ENV GOPATH /go
RUN go get -u github.com/googlecloudplatform/gcsfuse
FROM composer:2 as vendor
COPY composer.json composer.json
COPY composer.lock composer.lock
RUN composer install --ignore-platform-reqs --no-interaction --prefer-dist
FROM craftcms/nginx:7.4
ENV MNT_DIR /mnt/gcs
USER root
RUN apk add --no-cache mysql-client postgresql-client ca-certificates …Run Code Online (Sandbox Code Playgroud) 我在 Google Cloud Run 服务上部署了一个 docker 容器。它有一个非常基本的cloudbuild.yaml文件,可以从 git 推送到主分支触发。
我希望将云运行机的内存从512MB自动增加到8GB。我知道可以在 Cloud Run UI 中单击“EDIT @\xc2\xa0DEPLOY NEW REVISION”,然后手动选择 8gb。但我希望自动进行此设置。
\n您可以通过以下方式从 Cloud Run 获取 .yaml:
\ngcloud run services describe SERVICE --format export > service.yaml\nRun Code Online (Sandbox Code Playgroud)\ngcloud run services describe SERVICE --format export > service.yaml\nRun Code Online (Sandbox Code Playgroud)\n您可以将当前的 .yaml 半自动替换为:
\ngcloud run services replace service.yaml
但是,有什么方法可以让实际的 Cloud Build将部署容器映像service.yaml中的自定义加载到 Cloud Run步骤吗?
cloudbuild.yaml
apiVersion: serving.knative.dev/v1\nkind: Service\nmetadata:\n annotations:\n client.knative.dev/user-image: \'gcr.io/project/service:ebbe555\'\n run.googleapis.com/ingress: all\n run.googleapis.com/ingress-status: all\n …Run Code Online (Sandbox Code Playgroud) google-cloud-platform google-cloud-build google-cloud-run cloudbuild.yaml
我正在将 Django 网站迁移到 GCP 并首次使用 Google Cloud Run。体验很棒。我对域映射功能也非常满意,但我在将 www 子域转发到裸域 URL 时遇到问题。为了实现一致的页面分析,我希望浏览的访问者被https://www.mycooldomainname.com301 重定向到https://mycooldomainname.com(真实域编辑)
我将 bare 和 www 子域添加到 Cloud Run 自定义域:

并在我的注册商处添加了所需的 A、AAA 和 CNAME 记录:

传播完所有内容后,我可以访问我的网站 和https://mycooldomainname.com,https://www.mycooldomainname.com但如何配置转发/重写?
从我读到的其他帖子中,人们使用 Google Cloud DNS 实现了这一点,看起来他们使用了别名来进行转发。
在这种情况下,我尝试通过 uwsgi 进行转发:
django 应用程序通过 uwsgi 使用此配置提供服务 - 请注意重定向规则:
[uwsgi]
plugins-dir = /usr/lib/uwsgi/plugins
plugins = router_uwsgi
route-uri = ^(.*)\/\/www\.(.*)$ redirect-301:$1//$2
hook-master-start = unix_signal:15 gracefully_kill_them_all
http-socket = 0.0.0.0:8000
cheaper = 1
cheaper-algo = backlog
workers = …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用 Terraform 在 Cloud Run 中部署容器。我已经手动部署容器并正确运行。现在,我需要使用 Terraform 部署它以创建可复制的环境。我已经成功配置了几乎所有参数,除了这个。
在我手动部署的情况下,更改此参数非常容易。
但我没有在 terraform 文件、main.tf 或variables.tf 中找到配置此参数的位置。我正在使用这个模块:https://github.com/GoogleCloudPlatform/terraform-google-cloud-run
有没有人做过或者可以帮助我指出是否可能以及配置的位置。
太感谢了。
我正在写一个 go 客户端来消费
conn, err := grpc.DialContext(ctx, serverAddr, grpc.WithBlock(), grpc.WithReturnConnectionError(), getTransportCredential(false))
Run Code Online (Sandbox Code Playgroud)
上面的调用挂起直到上下文超时并返回以下错误
failed to dial: context deadline exceeded: connection error: desc = "error reading server preface: http2: frame too large"
Run Code Online (Sandbox Code Playgroud)
getTransportCredential(insecure bool)定义如下
func getTransportCredential(insecure bool) grpc.DialOption {
if insecure {
return grpc.WithTransportCredentials(insecure2.NewCredentials())
}
rootCAs, err := x509.SystemCertPool()
if err != nil {
panic(err)
}
if rootCAs == nil {
fmt.Println("SystemCertPool is nil")
rootCAs = x509.NewCertPool()
}
caCert := `-----BEGIN CERTIFICATE-----
-----END CERTIFICATE-----`
if caCert != "" {
// Append …Run Code Online (Sandbox Code Playgroud) 每当我尝试使用gcloud-cli.
这是我运行来部署我的函数的命令
\ngcloud functions deploy [cloud_funtion_name]\n--gen2 --region=us-central1\n--runtime=nodejs18\n--entry-point=[function_entry_point]\n--trigger-http\n--allow-unauthenticated\n--max-instances=83\nRun Code Online (Sandbox Code Playgroud)\n在无休止地卡在Cloud run service台阶上大约 10 分钟后,我收到此错误
Preparing function...done. \nX Deploying function... \n \xe2\x9c\x93 [Build] Logs are available at [logs_link] \n \xe2\x9c\x93 [Service] \n . [ArtifactRegistry] \n . [Healthcheck] \n . [Triggercheck] \nFailed. \nERROR: (gcloud.functions.deploy) OperationError: code=13, \nmessage=Could not create or update Cloud Run service [cloud_funtion_name].\nReconciling latest revision template. Resource readiness deadline exceeded.\n\nRun Code Online (Sandbox Code Playgroud)\n即使我删除并重新部署,也会发生这种情况。我检查了 StackOverFlow 和 Google Issue Tracker 上的几个线程,但似乎没有一个真正有帮助......
\n有人有线索吗?如果需要更多信息,我很乐意处理。
\n直到昨天下午,我都能够部署我的功能,没有任何形式的问题。\n但是一夜之间,就在昨天,我的部署开始失败,甚至更新也不再起作用。
\n我其实是一无所知。 …
typescript gcloud gcloud-cli google-cloud-functions google-cloud-run
google-cloud-run ×10
docker ×2
django ×1
flask ×1
gcloud ×1
gcloud-cli ×1
gcsfuse ×1
ghost-blog ×1
go ×1
google-vpc ×1
grpc ×1
gunicorn ×1
http2 ×1
python ×1
regex ×1
terraform ×1
typescript ×1
uwsgi ×1