Skip to content

Instantly share code, notes, and snippets.

@bswinnerton
Last active August 29, 2015 13:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bswinnerton/9728913 to your computer and use it in GitHub Desktop.
Save bswinnerton/9728913 to your computer and use it in GitHub Desktop.
upstream app {
# Path to Unicorn SOCK file, as defined previously
server unix:/tmp/unicorn.babblings.sock fail_timeout=0;
}
server {
listen 80;
server_name ror-study-group-3;
# Application root, as defined previously
root /var/www/babblings;
try_files $uri/index.html $uri @app;
location @app {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_pass http://app;
}
error_page 500 502 503 504 /500.html;
client_max_body_size 4G;
keepalive_timeout 10;
}
apt-get update
apt-get install build-essential openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev automake libtool bison nodejs subversion
wget http://cache.ruby-lang.org/pub/ruby/2.1/ruby-2.1.1.tar.gz
tar xvf ruby-2.1.1.tar.gz
cd ruby-2.1.1/
./configure
make
make install
gem install bundler
mkdir /var/www/
cd /var/www/
git clone https://github.com/bswinnerton/babblings.git
cd babblings/
apt-get install postgresql-server-dev-9.1 postgresql
su - postgres
vi config/database.yml
bundle install
RAILS_ENV='production' rake db:create
sudo -u postgres psql template1
RAILS_ENV='production' rake db:migrate
RAILS_ENV='production' rake db:seed
apt-get install imagemagick
vi config/initializers/secret_token.rb
RAILS_ENV='production' rake db:seed
RAILS_ENV='production' rails server -p 80
RAILS_ENV='production' rake assets:precompile
RAILS_ENV='production' rails server -p 80
vi config/unicorn.rb
unicorn_rails
RAILS_ENV='production' unicorn_rails
apt-get install nginx
vi /etc/nginx/sites-available/babblings.conf
RAILS_ENV='production' unicorn_rails -c config/unicorn.rb -D
man ps
ps -ef | grep unicorn
ls -l /etc/nginx/sites-available/
ls -l /etc/nginx/sites-enabled/
rm /etc/nginx/sites-enabled/default
ln -s /etc/nginx/sites-enabled/default /etc/nginx/sites-available/babblings.conf
ln -s /etc/nginx/sites-available/babblings.conf /etc/nginx/sites-enabled/default
ls -l /etc/nginx/sites-enabled/
service nginx restart
exit
# Set the working application directory
# working_directory "/path/to/your/app"
working_directory "/var/www/babblings"
# Unicorn PID file location
# pid "/path/to/pids/unicorn.pid"
pid "/var/www/babblings/unicorn.pid"
# Path to logs
# stderr_path "/path/to/log/unicorn.log"
# stdout_path "/path/to/log/unicorn.log"
stderr_path "/var/www/babblings/log/unicorn.log"
stdout_path "/var/www/babblings/log/unicorn.log"
# Unicorn socket
#listen "/tmp/unicorn.babblings.sock"
listen "/tmp/unicorn.babblings.sock"
# Number of processes
# worker_processes 4
worker_processes 2
# Time-out
timeout 30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment