用于将Web应用程序从开发阶段传递到生产的最佳实践是什么?

时间:2023-02-10 20:04:01

Our Development environment has many layers and is complicated to replicate or even backup effectively. Basically the File system (ie. /usr/appdir/webapp...) has other applications serving our web application, those application we update doing svn updates from their repository.

我们的开发环境有很多层,复制甚至有效备份都很复杂。基本上,文件系统(即/ usr / appdir / webapp ...)有其他应用程序为我们的Web应用程序提供服务,我们更新的应用程序从其存储库执行svn更新。

The use of the web application itself (as a user) will affect both the file system and the database. So backing up the system is a matter of having a copy of both the file system and database (mysqldump) at the same point in time. One of the two by itself will not be a complete backup since the application is very dynamic itself.

Web应用程序本身(作为用户)的使用将影响文件系统和数据库。因此备份系统就是在同一时间点同时拥有文件系统和数据库(mysqldump)的副本。由于应用程序本身非常动态,因此其中一个本身不会是完整的备份。

When we deploy an webapp to staging for one of our customers to test and enter data, then we have an environment that now is difficult to sync back from our development environment, or even to take it to production. Since we will make change request from the customer in development, but the customer itself will make changes in staging.

当我们为我们的一个客户部署webapp来测试和输入数据时,我们的环境现在很难从我们的开发环境中同步回来,甚至无法将其投入生产。由于我们将在开发过程中向客户提出变更请求,但客户本身将对升级进行更改。

At this moment we are using freezing periods, where we ask our customers to make changes to development environments or even directly to production (before going live completely).

此时我们正在使用冻结期,我们要求客户对开发环境进行更改,甚至直接进行生产(完全上线之前)。

I am wondering if their is a best practice on how to have a effective process to pass from dev --> staging --> production? Or if you might have some pointers.

我想知道他们是否是关于如何从dev - > staging - > production获得有效流程的最佳实践?或者,如果你可能有一些指针。

2 个解决方案

#1


From the sound of it, your problem is complicated by the nature of your application.

从它的声音来看,您的问题因应用程序的性质而变得复杂。

Firstly, does your application make a distinction between files that are part of the application, and files that are mere data? If not, unless you have a very compelling reason for not doing so, a change of that nature should make version control of your filesystem much simpler - then it would make sense to have the application parts under version control, but not the data parts.

首先,您的应用程序是否区分了属于应用程序的文件和仅仅是数据的文件?如果没有,除非你有一个非常令人信服的理由不这样做,改变这种性质应该使你的文件系统的版本控制更加简单 - 那么将应用程序部分置于版本控制之下是有意义的,而不是数据部分。

Secondly, I have always found keeping filesystem data in sync with database data a pain. One solution (which may be a more extensive refactoring) is to make one generate-able from the other. Could you somehow store the filesystem stuff in your database linked to the relevant data, that could populate the filesystem from a script? If your files are too big, in many cases having representative files for the purposes of development and testing will suffice.

其次,我总是发现保持文件系统数据与数据库数据同步是一件痛苦的事。一种解决方案(可能是更广泛的重构)是使一个可以从另一个生成。你能以某种方式将文件系统内容存储在数据库中,链接到相关数据,这可能会从脚本中填充文件系统吗?如果您的文件太大,在许多情况下,为了开发和测试而具有代表性文件就足够了。

Alternatively, you could have a separate repository for data, which can take a valid snapshot of a set of data (both database and filesystem) which can be stored and managed separately to your application code (although this approach will bring other problems...)

或者,您可以拥有一个单独的数据存储库,它可以获取一组数据(包括数据库和文件系统)的有效快照,这些数据可以单独存储和管理到您的应用程序代码(尽管这种方法会带来其他问题...... )

If the design issues here are immutable, I can't think of a better idea than your freezing periods.

如果这里的设计问题是不可改变的,我想不出比冻结期更好的想法。

#2


I typically don't make any changes in the QA/staging environment. Any change gets made in the development environment and then pushed to both QA/staging and production. Normally, I don't use live data in QA/staging either if I can avoid it. In cases where I do have live data in QA/staging, I'll use something like SQL Data Compare (from Red Gate) to manage the migration of new data from the QA/staging environment to production.

我通常不会在QA /暂存环境中进行任何更改。在开发环境中进行任何更改,然后将其推送到QA / staging和production。通常情况下,如果可以避免,我不会在QA /分期中使用实时数据。如果我在QA / staging中有实时数据,我会使用SQL Data Compare(来自Red Gate)来管理从QA / staging环境到生产的新数据迁移。

Also, I maintain separate configurations for dev/QA/production in source code control. It's a bit of a pain to have to remember to make changes in all configs when the change affects them all, but there are enough differences that it is easier to do this than to update the config for QA/production when the app gets published/installed.

另外,我在源代码控制中为dev / QA / production维护单独的配置。当变化影响所有配置时,必须记住在所有配置中进行更改是有点痛苦的,但是有足够的差异,这比在应用程序发布时更新QA /生产的配置更容易做到这一点/安装。

#1


From the sound of it, your problem is complicated by the nature of your application.

从它的声音来看,您的问题因应用程序的性质而变得复杂。

Firstly, does your application make a distinction between files that are part of the application, and files that are mere data? If not, unless you have a very compelling reason for not doing so, a change of that nature should make version control of your filesystem much simpler - then it would make sense to have the application parts under version control, but not the data parts.

首先,您的应用程序是否区分了属于应用程序的文件和仅仅是数据的文件?如果没有,除非你有一个非常令人信服的理由不这样做,改变这种性质应该使你的文件系统的版本控制更加简单 - 那么将应用程序部分置于版本控制之下是有意义的,而不是数据部分。

Secondly, I have always found keeping filesystem data in sync with database data a pain. One solution (which may be a more extensive refactoring) is to make one generate-able from the other. Could you somehow store the filesystem stuff in your database linked to the relevant data, that could populate the filesystem from a script? If your files are too big, in many cases having representative files for the purposes of development and testing will suffice.

其次,我总是发现保持文件系统数据与数据库数据同步是一件痛苦的事。一种解决方案(可能是更广泛的重构)是使一个可以从另一个生成。你能以某种方式将文件系统内容存储在数据库中,链接到相关数据,这可能会从脚本中填充文件系统吗?如果您的文件太大,在许多情况下,为了开发和测试而具有代表性文件就足够了。

Alternatively, you could have a separate repository for data, which can take a valid snapshot of a set of data (both database and filesystem) which can be stored and managed separately to your application code (although this approach will bring other problems...)

或者,您可以拥有一个单独的数据存储库,它可以获取一组数据(包括数据库和文件系统)的有效快照,这些数据可以单独存储和管理到您的应用程序代码(尽管这种方法会带来其他问题...... )

If the design issues here are immutable, I can't think of a better idea than your freezing periods.

如果这里的设计问题是不可改变的,我想不出比冻结期更好的想法。

#2


I typically don't make any changes in the QA/staging environment. Any change gets made in the development environment and then pushed to both QA/staging and production. Normally, I don't use live data in QA/staging either if I can avoid it. In cases where I do have live data in QA/staging, I'll use something like SQL Data Compare (from Red Gate) to manage the migration of new data from the QA/staging environment to production.

我通常不会在QA /暂存环境中进行任何更改。在开发环境中进行任何更改,然后将其推送到QA / staging和production。通常情况下,如果可以避免,我不会在QA /分期中使用实时数据。如果我在QA / staging中有实时数据,我会使用SQL Data Compare(来自Red Gate)来管理从QA / staging环境到生产的新数据迁移。

Also, I maintain separate configurations for dev/QA/production in source code control. It's a bit of a pain to have to remember to make changes in all configs when the change affects them all, but there are enough differences that it is easier to do this than to update the config for QA/production when the app gets published/installed.

另外,我在源代码控制中为dev / QA / production维护单独的配置。当变化影响所有配置时,必须记住在所有配置中进行更改是有点痛苦的,但是有足够的差异,这比在应用程序发布时更新QA /生产的配置更容易做到这一点/安装。