dev、test、pre和prod是什么意思?
开发环境(dev):开发环境是程序猿们专门⽤于开发的服务器,配置可以⽐较随意,为了开发调试⽅便,⼀般打开全部错误报告。
测试环境(test):⼀般是克隆⼀份⽣产环境的配置,⼀个程序在测试环境⼯作不正常,那么肯定不能把它发布到⽣产机上。
灰度环境(pre):灰度环境,外部⽤户可以访问,但是服务器配置相对低,其它和⽣产⼀样。 <;很多企业将test环境作为Pre环境 >
⽣产环境(prod):是值正式提供对外服务的,⼀般会关掉错误报告,打开错误⽇志。
三个环境也可以说是系统开发的三个阶段:开发->测试->上线,其中⽣产环境也就是通常说的真实环境。
⼤多数⼈都知道四个环境指的是什么,但是很多⼈却不知道为什么要这么区别,甚⾄为了省事就只有dev和pro环境。如果项⽬没有上线之前没有问题,如果项⽬上线之后就会有⾮常⿇烦的事情发⽣。下⾯我们针对这四种环境,来分析⼀下对应的各种场景。
如果我们只有dev和pro环境,pro突然发现bug,需要紧急处理,只有两个环境,这个时候我们要如何解决呢several什么意思
⾸先dev现在已经更新到1.1.0,⽽pro现在才1.0.0,所以这个时候我们需要重新创建⼀个brunch分⽀,这边我们可以叫做1.0.0.1,然后修改代码之后需要放到dev环境上⾯进⾏测试,这个时候就会变成如下所⽰状态:
然后测试通过之后,我们需要将1.0.0.1发布到pro环境,然后合并1.0.0.1的代码到1.1.0中,最后将dev环境修改为1.1.1,如下所⽰:
在dev1.0.0.1测试期间,所以开发⼯作全部得停⽌,必须等测试通过发布到⽣产上⾯才可以,如果仅仅只有两个环境,代价实在是太⼤了!!
如果我们多了⼀个test环境情况就会好很多了,⽐如上⾯说所的问题,我们就可以这么来处理。
我们可以在test1.0.0上⾯直接修改,修改后的版本是1.0.0.1,测试通过之后直接发布到pro环境即可。然后再将test中1.0.0.1代码合并到1.1.0,最后dev的版本升⼀级就可以了。
这样的好处就是不会影响dev开发环境,不管怎么修改test,都不会造成dev暂停。
如果test环境和pro环境版本不同步,还是会有问题存在,⽐如test环境在测试1.0.1版本的代码⽽⽣产上⾯运⾏的是pro环境的代码,这个时候pro出现问题修改的时候就会⽐较⿇烦。
这个时候和之前的做法⼀样,创建⼀个新的brunch分⽀(1.0.0.1)然后在1.0.0.1中修复bug,然后发布到test最新版本中,测试通过之后发布到pro环境中。然后就是复杂的合代码操作了,将1.0.0.1代码合并到1.0.1中,将dev的1.1.0添加上修复的代码变成1.1.1。
这种情况下,⾸先在test测试期间,1.0.1的测试⼯作会停⽌,其次步骤太繁琐,所以这边我们新增了pre环境。
我们只要保证pre的版本和pro环境的版本⼀致,就可以解决上⾯的问题了。如上图所⽰,我们只需要在pre的1.0.0环境上⾯修复bug就可以了,修复好之后发布到pro环境就可以了,然后将代码同步到test和dev中即可。
这样以后不管pro遇到什么问题,我们都可以按照上⾯的步骤来解决。
总结:
四个环境最⼤的好处就是各司其职,既不会影响开发,也不会影响测试⼯作。⽽且增加⼀个pre环境也可以尽可能的模仿pro的真实环境,让测试结果更加准确。
⼀开始,你可能觉得你只需要⼀个环境,well, at most two: ⼀个Dev环境(aka ur PC) + one server. 但是随着项⽬的发展,可能需要更多的环境,那它们是什么,⼜有什么⽤处呢?
1. 环境的定义
Environment – In hosted software (eg web site/application, database not shrinkwrap software) development, environment refers to a server tier designated to a specific stage in a release process.
2. a typical product release cycle
Development Environment
This is where the software is developed. In some situations this could be the developer’s desktop, in other situations this would be a server shared by several developers working together on the same p Testing Environment
After the application was developed to an agreed stage it is released to the testing environment. This
is where the testers ensures the quality of the application, open bugs and review bug fixes. This env User Acceptance Test Environment (UAT)
In a client-vendor projects, the software then moves from internal testing (done by the vendor’s testers) to client testing. This is where the client’s testers verify the quality of the application and s Staging Environment (AKA pre production)
The staging site is used to assemble, test and review new versions of a website before it goes into production. The staging phase of the software lifecycle is often tested on hardware that mirrors hardwa Production Environment
This is where the application goes out to the world and become production. Content can be updated from the staging environment in to Production Environment, when available, as well as new
So, how many do I need?
Note that small to medium software projects might not need all environments, on the other hand, from time to time you might want to add additional environments (for example to accommodate separate To make things even more complex, you might not need to have all these environments up
and running on the same time – you might want to buy the Staging Environment hardware only after the first re 3. Conclusion
The main purpose of these environments is to improve the development, testing, and release processes in client-server applications.
There is no magic number of environments that make everything work OK. hopefully, with this article, you can determine what best suites your project.
It is the job of the architect, project manager, operations manager or change manager (pick one) to determine which environments are needed, to make sure these environments are in place and on time View Code
·