I want to sort out out our deployment process and I was hoping to use Ant or a similar build tool to design and implement a one-click deployment of a specific SVN revision to multiple servers.
We use ColdFusion as our application server so we usually just upload a set of changed files to all our servers. There is no compile step.
The process would be as follows:
- Get a particular revision from SVN and export it to a temp dir
- Copy/FTP all the files in the directory to a set of web servers
- Switch the deployment destination as required for test / staging / production etc.
- In future we'd like to add database schema changes to this process
Is it possible to do this using Ant or are there better open source tools for the job? I'm inte开发者_StackOverflowrested in SVN intergration in particular.
I'd love to hear any experiences in this area. Thanks in advance.
Yes, there are numerous sources on this one:
http://subversion.open.collab.net/articles/IntegratingSubversionIntoYourAntBuild.html
http://ant.apache.org/manual/Tasks/ftp.html or http://www.developer.com/java/print.php/998241
Also, I'm not sure what the equivalent is in the Cold Fusion world, but you should look into Unit Testing and a linting tool. A linting tool can check for invalid syntax and basic structures. The invalid syntax part is key.. because you can have the task stop if there's a problem as opposed to deploying known-broken code.
It's just a matter of setting up the individual targets (tasks) and stringing them together in the right order.
If you are ready for a bit of learning, I would suggest you to switch to Maven and friends. Maven is basically makes the whole develop, test, deploy and manage very simple and reliable.
There are plugins that are going to help you in the whole process. SVN is intergrated with Maven so, you would not have any issues.
Here is short list
- Use Maven SCM plugin to checkout/export the code.
- Maven will perform specific build for you and package the code.
- Use Maven Cargo plugin to upload the packaged artifact/Jar/War to your server. You can restart the server as well.
- You have build-profiles in Maven, you can define build and deployment behaviors based on platform (Unix, Mac, Windows,...) and environments (dev, test, prod, etc).
- On release, you may want to bump-up the code version to next SNAPSHOT release. This is also automated in Maven.
- Maven's integration with Liquibase is just awesome. It makes your database changes to execute so reliably that you will find a difference. You will be managing DB changes same as your Java code. In small rollbackable pieces of change-sets gives a lot of confidence while working on production environment.
精彩评论