Installation installs all required software and code. From then on all code updates - including database migrations - are much easier as we no longer need to install Ruby, Nginx, MySQL, etc.:
git pull, run databases migrations if necessary with
bundle exec rake db:migrate, if necessary update the installed Ruby gems via
bundle update, and then restart the Rails application server with
Capistrano greatly simplifies the code updates via git, database migrations and server restarts on a remote machine. Capistrano assumes that the server has been provisioned using Vagrant/Chef or via manual installation (see Installation). Capistrano runs on your local machine.
To use Capistrano you need Ruby (at least 1.9.3) installed on your local machine. If you haven't done so, install Bundler to manage the dependencies for Lagotto:
gem install bundler
Then go to the Lagotto git repo that you probably have already cloned in the installation step and install all required dependencies.
git clone git://github.com/articlemetrics/lagotto.git cd lagotto bundle install
Edit the deployment configuration for a production server in the
.env file in the local Lagotto root folder. The samae file needs to go to
/var/www/lagotto/shared/.env on the production server.
We deploy Lagotto with
bundle exec cap production deploy
You can replace
production with other environments, e.g.
staging. You can pass in environment variables, e.g. to deploy a different git branch:
cap production deploy BRANCH_NAME=develop, or to deploy using a different
DOTENV=example cap production deploy.
The first time this command is run it creates the folder structure required by Capistrano, by default in
/var/www/lagotto. To make sure the expected folder structure is created successfully you can run:
bundle exec cap production deploy:check