Skip to content

Instantly share code, notes, and snippets.

@mustmodify
Last active January 26, 2018 21:08
Show Gist options
  • Save mustmodify/40611a252f8bfbf9ab47 to your computer and use it in GitHub Desktop.
Save mustmodify/40611a252f8bfbf9ab47 to your computer and use it in GitHub Desktop.
ruby + nginx + puma
brand new slice as root:
One of these...
echo "America/New_York" > /etc/timezone
sudo dpkg-reconfigure --frontend noninteractive tzdata
or
sudo timedatectl set-timezone America/New_York
and then `date` should show EST/EDT
apt-get -y update
apt-get -y install build-essential zlib1g-dev libssl-dev libxml2-dev libxslt-dev libreadline6-dev libyaml-dev libmysqlclient-dev
# set the time
sudo apt-get install ntp
Change the contents of /etc/ntp.conf to include additional server lines:
server ntp.ubuntu.com
server pool.ntp.org
Consider using upstart instead of systemv:
http://notesofaprogrammer.blogspot.com/2016/09/running-upstart-on-ubuntu-1604-lts.html
# set up security
wget -O ruby-install.tar.gz https://github.com/postmodern/ruby-install/archive/v0.5.0.tar.gz
tar -xzvf ruby-install.tar.gz
cd ruby-install/
sudo make install
install chruby:
wget -O chruby-0.3.8.tar.gz https://github.com/postmodern/chruby/archive/v0.3.8.tar.gz
tar -xzvf chruby-0.3.8.tar.gz
cd chruby-0.3.8/
sudo make install
ruby-install rbx 2.4.1
apt-get install git
apt-get install mysql-server mysql-client
apt-get install vim
Install Redis if needed:
sudo apt-get install tcl
wget http://download.redis.io/redis-stable.tar.gz
tar xvzf redis-stable.tar.gz
cd redis-stable
make
make install
[setup upstart if desired](https://gist.github.com/bdotdub/714533)
Two options:
* create or append to /etc/bash.bashrc OR create /etc/profile.d/chruby.sh
if [ -n "$BASH_VERSION" ] || [ -n "$ZSH_VERSION" ]; then
source /usr/local/share/chruby/chruby.sh
source /usr/local/share/chruby/auto.sh
fi
create /etc/gemrc:
install: --no-rdoc --no-ri
logout. login.
chruby rbx-2.4.1
gem install bundler
gem install psych # whatever
logout.
Login as production. You should have chruby.
ssh-keygen
- move key to github
add these to ~/.bashrc at/near the top:
source ~/.default_ruby
export RAILS_ENV=production
set up your database. Move over production data if needed.
cap production deploy:setup
create /shared/config/database.yml
cap production deploy
- then go in and allow SSH to connect to github
cap production deploy
install nginx based on instructions here:
follow instructions here: http://ruby-journal.com/how-to-setup-rails-app-with-puma-and-nginx/
change ssh port?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment