SAAS 工作流程的版本控制

发布于 2024-11-05 04:46:33 字数 1000 浏览 3 评论 0原文

如果这已经被涵盖了,我很抱歉,但我可以诚实地说,我已经花了至少 3 天的时间试图提出一个版本控制解决方案,而我的头快要爆炸了。

我也浏览了一下颠覆书,但还是很困惑。

基本上我有一个一直在稳定增长的 SAAS 应用程序。目前,实际上只有 1 名开发人员(我)在开发该应用程序,但如果人们对它的兴趣持续存在,我可能不得不开始招聘。

该应用程序是用 PHP 编写的,使用 MySQL 数据库,并托管在 bog 标准 LAMP 堆栈上。

目前我的开发机器上安装了 GIT,但是我缺乏理解意味着我的提交是不规则的并且通常是不相关的,并且我遇到了它不跟踪目录更改的问题。

我主要关心的是部署到我们的生产服务器。我们的每个客户都有自己的应用程序文件夹和数据库。

目前,当我们运行更新时,我们必须编写一个自定义更新脚本:

1.Duplicates clients installation into a backup folder
2.Removes the live installation folder
3.Copies the new updated installation folder
4.Copies the users config files from the backup to the live install
5.Tells the operator to make the changes to the users database using a third party app
6.Cleans up.

5 个用户很无聊,但现在我们接近 50 个,这绝对是一场噩梦。

为了使事情变得复杂(并且更安全),每个安装文件夹都包含唯一的数据库设置,这意味着数据库架构只能从该应用程序内部更新。

我一直在考虑建立一个 gitorious 服务器,但我想在挖掘之前寻求一些关于如何继续的建议我自己更深了。

谢谢

I am sorry if this has been covered, but I can honestly say I have spent at least 3 solid days trying to come up with a version control solution and my head is about to explode.

I have also skimmed through the subversion book but I am still very confused.

Basically I have a SAAS application that has been growing steadily. Currently its really only 1 developer (me) working on the app, but if the interest in it continues I might have to start hiring.

The application is written in PHP, uses a MySQL database and is hosted on a bog standard LAMP stack.

Currently I have GIT installed on my development machine however my lack of understanding has meant that my commits are irregular and often irrelevant and I am having problems with it not tracking changes to directories.

My main concern is deploying to our production server. Our clients each have their own application folders and their own databases.

Currently when we run an update we have to write a custom update script that:

1.Duplicates clients installation into a backup folder
2.Removes the live installation folder
3.Copies the new updated installation folder
4.Copies the users config files from the backup to the live install
5.Tells the operator to make the changes to the users database using a third party app
6.Cleans up.

It was boring with 5 users, but now we are approaching 50 and its an absolute nightmare.

To make things complicated (and a little more secure) each install folder contains unique database settings which means database schema's can only be updated from within that application.

I have been looking into setting up a gitorious server but thought I would seek some advice on how to proceed before i dig myself any deeper.

Thanks

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

青衫儰鉨ミ守葔 2024-11-12 04:46:33

也许您可以将应用程序文件保存在用户主目录之外的单独目录中,并在每个用户目录中创建一个指向您的应用程序的符号链接?示例:

ln -s /var/myapp/publicfiles /home/someuser/lib

这样您只需更新代码一次,然后更新每个用户的架构。 publicfiles 目录可以从 git 存储库更新,因此不需要手动复制文件。

Maybe you could keep your application files in a separate directory outside the users' home directories and create a symbolic link in each user directory that will point to your application? Example:

ln -s /var/myapp/publicfiles /home/someuser/lib

That way you would only need to update the code once and then update the schema for each user. The publicfiles directory could be updated from a git repository so no manual file copying would be needed.

拥抱我好吗 2024-11-12 04:46:33

对于源代码

如果每个客户端都有不同的配置,并且源文件可能略有不同,您可能需要为每个客户端保留一个单独的 git 存储库,并使用 rebase 从主存储库引入更改。

即,在服务器上有一个目录,保存主存储库(一个 git 存储库)。您将更改推送到此主存储库中,然后为每个客户端执行rebase操作。

在每个客户端中,您可以签入其他文件,或更改现有文件。变基的工作方式是撤消本地更改,从主服务器中提取所有更改,然后重新应用本地更改。因此本质上,本地更改/配置会覆盖主配置(通用配置)。

  • 注意:如果您可以将每个客户端文件与源树的其余部分分开,则可以使用 Kaivosukeltaja 的符号链接方法。但是,您可能仍然希望对这些每个客户端文件进行版本控制,除非它们以某种方式由应用程序本身进行管理。

对于数据库

您可能想要使用某种类似于 Rails(也可能是其他)的迁移文件。在源代码树中,有一个迁移文件目录(可能是 SQL 命令),用于对数据库进行必要的更改(最好同时拥有“向前迁移”和“向后迁移”文件)。

原则上,您可以使用 post-rebase 挂钩来自动运行脚本并应用新的迁移脚本来更新数据库。在实践中,我会对客户数据更加小心。

For the source code

If each client has a different configuration and potentially slightly different source files, you might want to keep a separate git repository for each client and use rebase to bring in the changes from the master repository.

I.e., have a directory - on the server - holding the master repository (a bare git repository). You push changes into this master repository, then perform a rebase operation for each client.

In each client you can check in additional files, or change existing files. The way rebase works, is by undoing the local changes, pulling all changes from the master and then re-applying the local changes. So essentially, the local changes/configuration overrides the master (common configuration).

  • Note: If you can separate the per-client files from the rest of the source tree you can use Kaivosukeltaja's method of symbolic links. However, you probably still want to version these per-client files, unless they are somehow managed by the application itself.

For the database

You probably want to use some sort of migration files similar to Rails (and probably others). In your source code tree, have a directory of migration files (probably SQL commands) making the necessary changes to the database (it's best if you also have both a 'migrate forward' and a 'migrate back' files).

In principle, you can have a post-rebase hook to automatically run a script and apply the new migration scripts to update the database. In practice, I'd be more careful with client data.

如歌彻婉言 2024-11-12 04:46:33

我认为你的问题是你拥有的部署数量。这就是造成最大噩梦的原因。然而,这种形式仍然是可以管理的。基本上,您想要做的是:

  1. 为每个部署克隆 git 存储库 对
  2. 每个部署进行任何自定义编辑
  3. 对于每个软件升级,您将遍历每个部署并合并来自默认(主)存储库的更改。

这应该合并更改,而不会弄乱应用程序中的任何内容。唯一的变化是编写一个脚本,可以在部署新代码后执行数据库升级/迁移。

I think your problem here is the # of deployments you have. That's what's causing the biggest nightmare. However, it's still manageable in this form. Basically, what you want to do is:

  1. Make a clone of your git repository for every deployment
  2. Make any custom edits for each deployment
  3. For every software upgrade, you'll go through each deployment and merge changes in from the default (master) repository.

This should merge in changes without messing up anything within the application. The only change then is writing a script that can do your database upgrades/migrations after the new code is deployed.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文