2014-10-09 22:52:32 +00:00
|
|
|
# Production Install (Ubuntu 14.04 x64 or Debian 7)
|
2014-03-23 00:22:25 +00:00
|
|
|
|
|
|
|
## Capistrano setup
|
|
|
|
|
2014-03-25 11:15:49 +00:00
|
|
|
SSH as a user with sudo access, update package lists and upgrade packages (new install only)
|
2014-03-23 00:22:25 +00:00
|
|
|
|
|
|
|
sudo apt-get update
|
|
|
|
sudo apt-get upgrade
|
|
|
|
|
2014-03-25 11:15:49 +00:00
|
|
|
Either use an existing sandboxed user account, or create a deploy user and disable password authentication. Instead, authenticate with a keypair.
|
2014-03-23 00:22:25 +00:00
|
|
|
|
|
|
|
sudo adduser deploy
|
|
|
|
sudo passwd -l deploy
|
|
|
|
|
2014-03-25 11:15:49 +00:00
|
|
|
## Install Apache
|
2014-03-23 04:13:19 +00:00
|
|
|
|
2014-03-25 11:15:49 +00:00
|
|
|
sudo apt-get install apache2 apache2-mpm-prefork
|
2014-03-23 04:13:19 +00:00
|
|
|
|
2014-03-25 11:15:49 +00:00
|
|
|
Now create the required directories, e.g. `/var/www/virtual/ensl.org/deploy`
|
2014-03-23 00:22:25 +00:00
|
|
|
|
2014-03-23 01:22:47 +00:00
|
|
|
## Install MySQL & Memcached
|
2014-03-23 00:56:13 +00:00
|
|
|
|
2014-03-25 11:15:49 +00:00
|
|
|
You may need to re-configure MySQL. Use `sudo dpkg-reconfigure mysql-server-5.5`
|
|
|
|
|
2014-03-23 01:22:47 +00:00
|
|
|
sudo apt-get install mysql-server mysql-client libmysqlclient-dev memcached
|
2014-03-23 00:56:13 +00:00
|
|
|
|
|
|
|
Login to mysql as root, and create the database and user account:
|
|
|
|
|
|
|
|
CREATE DATABASE `ensl`;
|
|
|
|
CREATE USER 'xxx'@'localhost' IDENTIFIED BY 'xxx';
|
|
|
|
GRANT ALL PRIVILEGES ON ensl.* TO 'xxx'@'localhost' WITH GRANT OPTION;
|
|
|
|
|
2014-03-23 01:22:47 +00:00
|
|
|
## Install rbenv, ruby, bundler and Image Magick
|
2014-03-23 00:22:25 +00:00
|
|
|
|
2014-03-25 11:15:49 +00:00
|
|
|
As a user with sudo, install dependencies
|
2014-03-23 00:22:25 +00:00
|
|
|
|
2014-03-25 11:15:49 +00:00
|
|
|
sudo apt-get install git-core curl zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev imagemagick libmagickwand-dev
|
2014-03-23 00:22:25 +00:00
|
|
|
|
|
|
|
Switch user to deploy, and install rbenv
|
|
|
|
|
|
|
|
su deploy
|
|
|
|
cd ~
|
|
|
|
git clone git://github.com/sstephenson/rbenv.git .rbenv
|
|
|
|
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
|
|
|
|
echo 'eval "$(rbenv init -)"' >> ~/.bashrc
|
|
|
|
exec $SHELL
|
|
|
|
|
|
|
|
git clone git://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build
|
|
|
|
echo 'export PATH="$HOME/.rbenv/plugins/ruby-build/bin:$PATH"' >> ~/.bashrc
|
|
|
|
exec $SHELL
|
|
|
|
|
2014-10-09 22:52:32 +00:00
|
|
|
rbenv install 2.1.3
|
|
|
|
rbenv global 2.1.3
|
2014-03-23 00:22:25 +00:00
|
|
|
|
|
|
|
echo "gem: --no-ri --no-rdoc" > ~/.gemrc
|
|
|
|
gem install bundler
|
|
|
|
|
|
|
|
## Install the ENSL site
|
|
|
|
|
2014-10-09 22:52:32 +00:00
|
|
|
Create the `.env` file by copying `.env.example` with the appropriate credentials.
|
2014-03-23 01:22:47 +00:00
|
|
|
|
2014-10-09 22:52:32 +00:00
|
|
|
cp /var/www/virtual/ensl.org/deploy/shared/.env.example /var/www/virtual/ensl.org/deploy/shared/.env
|
2014-03-25 11:15:49 +00:00
|
|
|
|
|
|
|
# Deployment
|
|
|
|
|
|
|
|
Use capistrano to deploy:
|
2014-03-31 21:33:16 +00:00
|
|
|
|
2014-10-09 22:52:32 +00:00
|
|
|
bundle exec cap production deploy
|