It is not just a long process but a boring indeed to repeat all the manual process to deploy changes on the server every time. Most of the developers are required do it on the daily basis and multiple times a day. Developers who very lazy and who don’t want to go through the lengthy manual procedure every day for deployment for those developers there is CAPISTRANO – Remote Server Automation Tool.
What is Capistrano:
1. Deploy web application on N number of server simultaneously.
2. Automatic task execution on the server.
3. Script Execution on the server over SSH.
4. Store previous release log.
5. Parameterize multiple environments.
6. Parameterize multiple Git branches.
Advantages of Capistrano:
1. Less/Zero Down Time:
If you are deploying your code on a remote server by the manual process then definitely you will get downtime while assets compilation, migration and etc. If you are using Capistrano you will get Zero/less downtime. Because Capistrano creates the symlink of the last release after completion of all processes. So the task assets compilation does not affect the current release. This is one of the significant benefits of Capistrano.
2. Deploy over multiple remote server:
By using Capistrano you can deploy your code on N numbers of remote server simultaneously. If you want to deploy over multiple remote servers then the best way to do this thing is Capistrano. By using Capistrano you don’t need to deploy code on remote server individually Capistrano does it simultaneously on all remote servers.
If you deploy your code by using manual process then you have to follow the lengthy procedure. You are required to deploy your code individually on the remote server that process takes too much time and very boring process to deploy code on a very remote server. By using Capistrano you just to configure multiple servers in deploy.rb or respected environment file under deploy folder. And now by just single command code is deployed overall remote server. This is another main advantage of Capistrano.
3. Task Execution:
Task execution in the manual process is a very lengthy process. In the manual process you have to do SSH login first then you can execute a task on the remote server. So that manual process takes some time and that may cause downtime. If you are using Capistrano then you just have to mention task in deploy.rb file and that tasks are executed automatically before/after deployment.
For example: If you have to update CronTab after deployment and if you are using a manual process for deployment then all you have to do is SSH login then you can update crontab on a remote server. Instead of the manual process if you are using Capistrano for that you have to just create a task in deploy.RB file and set the execution of that after deploying like this way.
4. Easy Rollback:
Rollback our last/specific deployment release on the remote server is very easy by using Capistrano. Capistrano is store/log number of release that you specify in your configuration. You just need one command for rollback to a specific release or last release so rollback is very easy and less time to consume as compared to a manual process. In the manual process, you have to do SSH login on the remote server and then reset our commit to last/specific commit and that process takes much time as compared to Capistrano rollback and you have too many steps for rollback. So this is also the main benefit if you are using Capistrano for deployment over remote server.
5. Parameterize multiple environments:
Deployment over different environments is not an easy task by manual process. Because you have to remember all remote server IP or host and every time you have to do SSH login on all environment then take a pull and follow all manual process. So, instead of doing this lengthy and boring process you can use Capistrano to configure/create all environments files in Deploy folder with environment name.
Once you create all environment files you just have to add the related remote server IP or Host in related environment files.
Now if you want to then you just have to enter one command.
To just replace “production” with “staging” or related environment