Deployment Instructions - smashingboxes/box_cutter GitHub Wiki

First Time Deployment

  1. Create deployer user and generate a key
ssh root@your-server-ip
adduser deployer --ingroup sudo
vi /etc/ssh/sshd_config
# PasswordAuthentication no
su deployer
mkdir ~/.ssh/
sudo cp /root/.ssh/authorized_keys ~/.ssh/
sudo chown deployer:sudo ~/.ssh/authorized_keys
ssh-keygen -t rsa
cat ~/.ssh/id_rsa.pub
  1. Copy paste the content of that file (id_rsa.pub) and update your project settings on github:

https://github.com/smashingboxes/insert_app_name/settings/keys

  1. Edit the config/deploy.rb with the correct settings

  2. Run:

cap deploy:install
cap deploy:setup
# edit shared/config/env_config.yml on the server
cap deploy:cold

Update deployment

cap deploy

This will fetch the latest from github

Manual restart

see cap -T

Example:

cap unicorn:stop unicorn:start

Troubleshoot

Man in the middle

If you change the ip of a server but not its name you might get such warning. To get rid of it, use

ssh-keygen -R old_ip

Problem with rbenv

Make sure you have your user using bash shell and that there is a home folder with a bashrc file. This is really only a problem if you created your deployer user manually (not using the above command)