SVN solution for website development and deployment

Here's the situation: we have several developers with varying degrees of command line experience, and we are building a solution for deploying our websites. Production environment - 2 boxes of SUSE Linux. The development environment is also SUSE Linux. Each developer has / will have a copy of the SVN tree in his home directory for development and testing.

The goal is to have a release system that is easy to use and easy to handle that will work with multiple production servers. This would be a bonus if it were not for the web developer (still an encoder, and not just in the web world) that could easily return any of the websites. In an optimal world, a release will be as simple as running one team on the website you want to release. This command will update production servers and leave a return path in it.

Our current deployment solution is a bit uncomfortable, quite difficult to get back and slow down like dirt. We are currently checking all files using SVN. Then a script is executed that essentially creates the tag in SVN. Then a second script is executed, which goes to each of the 2 production servers and launches "svn up".

Any suggestions?

+4
source share
7 answers

I am a .net guy and therefore work with things in the Windows world ... said that although the technologies that I work with daily to manage the build processes came from your world! (Linux / java technologies are in brackets, but I have included their equivalent for Windows readers) I use CruiseControl.NET ( CruiseControl ), VisualSVN ( SVN ), Tortoise and NAnt ( Ant ) to take care of all my build needs.

All my assemblies are usually automatically placed and marked during registration. This is done using CruiseControl as it controls my original control (SVN or SubVersion). When CruiseControl (CC) sees that the new code has been verified, it will execute the CC project, which in turn is called on the Ant script on the build server.

Ant script does a few things for me in the general assembly. It will check a copy of the latest code and transfer it to the build server. He will then build the code to make sure that something is at least compiled. Then it installs a clean copy of my database and executes any sql scripts to build the base db to the current version. Then I run all my unit test projects. Then I run integration tests, which, among other things, check my repository level to make sure the code still matches my end (I usually use ORM in my projects, so they rarely go out of sync ... but this is a good step in the process). After all the tests have passed (or failed), I roll back the database to a clean state and run the scripts to bring it to the current version (this is important because it provides the team with a clean database that will evolve against the click of a button). If the assembly was successful, I distribute the code to the development server (I also have one deployment of clicks on intermediate servers and production servers). If you want to mark your code base with every check, you can do it here.

Once all this is complete, I like to run some analysis of my code using NDepend , NDoc and NCover . NDepend is a code analysis tool to make sure everything in the architecture is correct, that the naming standards are what they should be, and TOTALLY MORE. NDoc retrieves all code comments and generates MSDN style documentation for my code. NCover tells me if I have proper unit test coverage for my code.

Then I have a custom Ant task that I wrote that analyzes all my code for various // TODO and // CodeDebt tags to generate another report, to tell me (usually at the end of the sprint) just how much crap is accumulating in my code base . This can then be taken into account in the next sprint.

All of these reports are either included in the email of the assembly, which is issued or linked too appropriately.

Keep in mind that all of the above happens for every check ... and without having to click at least one button! This is true continuous integration and should be the goal of every build wizard.

CruiseControl has a web console that also allows non-web developers (anyone really) to log in and execute this click without having to check the code ... caused by forcing the assembly.

Given this structure, you can also easily drop the click while everything is under version control. You will need another Ant script that will execute the same process, but with an additional first task is that it will have to get the latest version of the code, and not the latest to complete the build process. All Ant tasks can be reused for another purpose.

+2
source

Capistrano is a great solution. Although it was developed for the Ruby on Rails platform, I have successfully used it in a number of PHP projects. It automates actions performed through SSH. Deployments are atomic because each deployment is checked in a new directory.

The current copy is included using a symbolic link. The latest version of the source pulled from Subversion. You can also configure static configuration files for use in a production environment.

Capistrano also supports rollbacks, although you should be careful here if you make database changes between deployments. Consider using something like dbdeploy or rails migrations to solve this problem.

+2
source

Just to make it simple, give SpringLoops a try. This is a hosted svn service with deployment (and return) options to different servers . It is very easy to use and configure, the free version allows you to deploy it on only one server, but if you are willing to pay, you can deploy them on different servers (i.e., installation, development and production).

You can get 30 days of any packages for free so you can test as many servers as you need. I am not related to spring break. I just use it and find it useful and simple.

+1
source

One of the things you may come across is back and forth through different database structures in different versions. Moreso if you have the initialization data that is required in it. I remember that there are similar questions if you are looking for, but not quite like that.

0
source

Have you looked at existing build tools like ant / phing or even a CI solution like xinc or phpUnderControl ?

0
source

In my experience, the β€œreturn” function is almost impossible to support, since there is no easy way to handle destructive updates. However, you can definitely do better than just svn up . At the very least, you will want to run the script after checking the code that the application can fix (make changes to the database, etc.). You probably want to do an actual atom update as well, so I would recommend that you svn export to a temporary folder and then update the symbolic link to point to the folder as soon as you are done. You will probably also want to stop any services during the launch of patches.

You could use something like Capistrano to pack everything in a nice package. It comes with a cute guitarist (Webistrano).

0
source

May I suggest that if you deploy files to your production servers, then the puppet is a great configuration management tool and can also be used to deploy your content from subversion (or git). Lookup puppet and vcsdeploy module http://www.practicalclouds.com/content/guide/pclouds-vcsdeploy-deploy-stuff at the dollhouse.

0
source

Source: https://habr.com/ru/post/1286696/


All Articles