The way developers deploy code to web servers is changing. Gone are the days of remembering which files you’ve changed and manually dragging and dropping files around an FTP client. This deployment method is risky - it’s easy to miss a file and therefore break your entire application. FTP is also insecure - no encryption is used when sending your login credentials to the server, or for file transfers. Also, what happens when a visitor is using your application whilst you are uploading - some files might not be fully uploaded and your application will fail.
There are numerous alternatives to FTP, but I’m going to show you how to get started with Capistrano “A remote server automation and deployment tool written in Ruby”. In short, Capistrano allows you to write scripts to execute code on remote servers (and your local machine). We can use this technique to pull code from a version control repository onto our web server and run other commands.
Before we get started, I’m going to make a few assumptions:
First off, install Capistrano by running the following command in your terminal:
gem install capistrano
Next up we’re going to install another gem that makes Capistrano a bit friendlier for non-Rails projects, Lee Hambley’s Railsless Deploy:
gem install railsless-deploy
That’s it - everything we need should now be installed.
#web development #php