人们可能会认为简单地替换与应用程序关联的存储桶中的内容就会更新应用程序,但事实并非如此。
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
然后我进入项目目录并做了
gcloud app deploy
昨天一切正常。但今天我做了更改,进入同一个目录,你根本不能这样做gcloud app deploy
再次。我将新的构建文件夹复制到存储桶中。但好像少了一步?我运行了与昨天相同的命令,想也许rsync会将存储桶同步到应用程序,然后我返回应用程序并进行另一次部署。但一切都没有改变。我缺少哪一步?
This question is not related to:
How to Quickly Update Static Site on Google Cloud Storage?
下面是一个实际有效的简单解决方案。谷歌的文档过于复杂而且没什么用处。他们的“技术支持”无法解决问题。
这就是我如何使用命令行实用程序更新 gcloud 上的静态站点。
- 创建一个新存储桶,最好将其命名为类似版本应用程序名称-v2
- 将您最近的构建复制到该存储桶中
- 删除旧的存储桶
- 从控制台的主要区域中您可以看到应用程序的目录
gsutil rsync -r gs://[bucketname] ./appname
-
cd
进入目录
- run
gcloud app deploy
因此,如果您的应用程序的最新版本是 3,如果您的应用程序的目录是 stackoverflow,并且您的存储桶是“bucket”,那么您的gsutil
命令看起来像
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 的人都有几种解决方法。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)