Last active
October 1, 2015 12:28
-
-
Save mechiland/1992381 to your computer and use it in GitHub Desktop.
Ubuntu Server Setup
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
INSTALL EVERYTHING | |
apt-get install build-essential bison openssl libreadline6 libreadline6-dev libcurl4-openssl-dev git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-0 libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev curl nodejs mysql-server mysql-client libmysqlclient-dev redis-server nginx | |
nginx will NOT start automatically, you should run /etc/init.d/nginx start | |
ADD USER | |
useradd -m -g staff -s /bin/bash deployer | |
passwd deployer | |
adduser deployer rvm | |
adduser deployer sudo | |
You could make him the owner of the folder/files: | |
mkdir /var/apps | |
chown -R deployer /var/apps | |
Chances are that the owner already has read/write/execute permissions set, if not: | |
chmod -R 755 /var/apps | |
RVM (use sudo to install for the system) | |
sudo bash < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer) | |
rvm install 1.9.3 | |
PRE-DEPLOY | |
bundle exec rake assets:precompile | |
RAILS_ENV=production foreman start | |
KILL UNICORN SERVER | |
kill -QUIT <pid> | |
(to restart: kill -USR2 <pid>) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if ENV['MY_RUBY_HOME'] && ENV['MY_RUBY_HOME'].include?('rvm') | |
begin | |
rvm_path = File.dirname(File.dirname(ENV['MY_RUBY_HOME'])) | |
rvm_lib_path = File.join(rvm_path, 'lib') | |
$LOAD_PATH.unshift rvm_lib_path | |
require 'rvm' | |
RVM.use_from_path! File.dirname(File.dirname(__FILE__)) | |
rescue LoadError | |
# RVM is unavailable at this point. | |
raise "RVM ruby lib is currently unavailable." | |
end | |
end | |
ENV['BUNDLE_GEMFILE'] = File.expand_path('../Gemfile', File.dirname(__FILE__)) | |
require 'bundler/setup' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cat .ssh/id_rsa.pub | ssh b@B 'cat >> .ssh/authorized_keys' |
There is an excellent article describing the deployment process: http://rubysource.com/deploying-your-rails-app-to-the-cloud-with-unicorn-nginx-and-capistrano/
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Note once mysql is installed, make sure it's running using utf8: