缺少在GCloud上更新静态ReactJS网站的步骤 [英] Missing a step to update a static ReactJS site on GCloud

查看:64
本文介绍了缺少在GCloud上更新静态ReactJS网站的步骤的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

人们会认为,简单地替换与该应用程序关联的存储桶中的内容会更新该应用程序,但事实并非如此.


我有一个昨天部署的站点.我创建了存储桶,然后在命令行中创建了目录,然后部署了React应用程序

One would think that simply replacing the contents in the bucket associated with the app would update the app, but that is not the case.


I have a site that I deployed yesterday. I created the bucket, then in the command line created the directory, then deployed the React app doing

gsutil rsync -r gs://bucket-name ./app-name

然后我进入项目目录并完成

then I went into the project directory and did

gcloud app deploy

昨天一切都很好.但是今天我进行了更改,进入相同的目录,您根本无法再次执行gcloud app deploy.我将新的构建文件夹复制到存储桶中.但是似乎缺少了一步?我运行了与昨天相同的命令,认为 rsync 会将存储桶同步到应用程序,然后我又回到该应用程序并进行了另一次部署.但是什么都没有改变.我想走哪一步?

it all worked fine yesterday. But today i made changes, going into the same directory, you simply can't just do gcloud app deploy again. I copied the new build folder into the bucket. But there seems to be a missing step? I ran the same command as yesterday thinking maybe the rsync would sync the bucket to the app, then I went back into the app and did another deploy. yet nothing has changed. What step am i missing?


此问题与以下内容无关:如何快速更新静态网站是否位于Google Cloud Storage上?


This question is not related to: How to Quickly Update Static Site on Google Cloud Storage?

推荐答案

以下是一个实际可行的简单解决方案. Google的文档过于复杂,很少使用.而且他们的技术支持"无法解决问题.

这是我能够使用命令行实用程序在gcloud上更新我的静态站点的方式.

This is how I was able to update my static site on gcloud using the command line utility.

  • 创建一个新存储桶,最好使用 appname-v2
  • 之类的名称命名
  • 将您最近的版本复制到该存储桶中
  • 删除旧水桶
  • 在控制台的主要区域中,您可以看到应用程序目录的gsutil rsync -r gs://[bucketname] ./appname
  • cd进入目录
  • 运行gcloud app deploy
  • Create a new bucket, ideally name it with a version like appname-v2
  • Copy your recent build into that bucket
  • Delete the old bucket
  • From your main area in your console where you see your app's directory do gsutil rsync -r gs://[bucketname] ./appname
  • cd into the directory
  • run gcloud app deploy

因此,如果您的应用程序的最新版本为3,则如果应用程序的目录为stackoverflow,而存储桶为"bucket",则您的gsutil命令将类似于

So if your latest version of your app is 3, if your app's directory is stackoverflow, and your bucket is "bucket" then your gsutil command would look like

gsutil rsync -r gs://bucket-v3 ./stackoverflow

Gcloud控制台-显示存储桶版本的命名


有很多相关的问题,他们无休止地关于缓存"等问题.阅读毫无意义.只需删除旧存储桶并重新部署即可.


There are plenty of related questions, they drone on and on and on about "cache" etc. It's all pointless to read. Just delete the old bucket and redeploy.

这当然是针对小型应用程序的,有一些方法可以正确地做到这一点",但是很幸运在文档中找到了它.我认识的可以与gcloud一起使用的每个人都有几种解决方法.

Of course this was for a small app, there are ways to "properly do it" but good luck finding it in the documentation. Everyone that I know that works with gcloud has several workarounds.

这篇关于缺少在GCloud上更新静态ReactJS网站的步骤的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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