简体   繁体   English

仅将更改的 Git 文件从中央存储库 (GCP) 上传或获取到 VM 服务器

[英]Upload or fetch only changed Git file from central repository (GCP) to VM Server

We are having several client VMs that run some stuff based on config files we provide, and we store all our config files in ONE central repository in GCP.我们有几个客户端虚拟机,它们根据我们提供的配置文件运行一些东西,我们将所有配置文件存储在 GCP 的一个中央存储库中。

So Suppose, whenever we change ONE config file, eg config_file_1 we push it to that GCP central repository and then we manually go to the correspondent VM that is using this config_file_1 and we update it因此假设,每当我们更改一个配置文件时,例如config_file_1我们将其推送到该 GCP 中央存储库,然后我们手动转到使用此config_file_1的相应 VM 并更新它
actually VMs are using only one file from GCP central repository that we have实际上,VM 仅使用我们拥有的 GCP 中央存储库中的一个文件

eg:例如:
VM 1 uses config_file_1 VM 1 使用config_file_1
VM 2 uses config_file_6 VM 2 使用config_file_6
VM 3 uses config_file_9 VM 3 使用config_file_9

[May be we will maintain the table which VM using which file]

We want some mechanism to automate this stuff,我们想要一些机制来自动化这些东西,
So if we change config_file_9 and push that changed file to GCP via GIT then automatically VM 3 should update config_file_9因此,如果我们更改config_file_9并通过 GIT 将更改后的文件推送到 GCP,那么 VM 3 应自动更新config_file_9

Things that we think might help but not satisfying us:我们认为可能对我们有帮助但不能让我们满意的事情:
-- may be using GCP PubSub, we will have subscriber on each VM (but seems complicated) -- 可能正在使用 GCP PubSub,我们将在每个 VM 上都有订阅者(但看起来很复杂)
-- using may be git-ftp (don't know it will work or not, like in multiple VM) -- 使用可能是git-ftp (不知道它是否会起作用,就像在多个 VM 中一样)
-- automatic git pull/fetch particular file on VM (don't know it will work or not, like in multiple VM) -- 在 VM 上自动 git pull/fetch 特定文件(不知道它是否有效,就像在多个 VM 中一样)

So, we need help from you, what could be the best approach to deal with this problem according to you?那么,我们需要您的帮助,根据您的说法,处理这个问题的最佳方法是什么?
Thank you for your time and consideration.感谢您的时间和考虑。

"1) Using one Git repository for multiple VM configuration files is not a good idea. Git is a source code control system. You push and pull repositories. Although you can fetch a single file, your repositories (local and remote) will quickly get out of sync - unless you are only doing pulls. Then you will need to write a GitHub WebHook to notify the VM that the repository has changed. "1) 对多个 VM 配置文件使用一个 Git 存储库不是一个好主意。Git 是一个源代码控制系统。您可以推送和拉取存储库。虽然您可以获取单个文件,但您的存储库(本地和远程)将很快获得不同步 - 除非你只做拉取。那么你需要编写一个 GitHub WebHook 来通知 VM 存储库已更改。

  1. I recommend storing your configuration files on Google Cloud Storage.我建议将您的配置文件存储在 Google Cloud Storage 上。 Then just copy the file needed by the VM during VM startup script or manually via a shell script.然后只需在 VM 启动脚本或通过 shell 脚本手动复制 VM 所需的文件。 If you need auto update then you will need to implement some form of Cloud Storage Event to notify the VM of file change."如果您需要自动更新,则需要实施某种形式的云存储事件来通知虚拟机文件更改。”
  • @John Hanley. @约翰汉利。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM