I've been trying to understand how to setup systems from
the ground up on Ubuntu. I just installed redis
onto
the box and here's how I did it and some things to look
out for.
To install:
class ActiveRecord::Base | |
mattr_accessor :shared_connection | |
@@shared_connection = nil | |
def self.connection | |
@@shared_connection || ConnectionPool::Wrapper.new(:size => 1) { retrieve_connection } | |
end | |
end | |
ActiveRecord::Base.shared_connection = ActiveRecord::Base.connection |
if (uname -a | grep '12.0.0 Darwin' >/dev/null); then | |
CC=/usr/bin/gcc-4.2 CPPFLAGS=-I/opt/X11/include rvm --install --create --disable-tcl --disable-tk use <ruby version>@<gemset name> | |
else | |
rvm --install --create --disable-tcl --disable-tk use <ruby version>@<gemset name> | |
fi | |
if ! which bundle >/dev/null; then | |
gem install bundler --pre --no-ri --no-rdoc && bundle install | |
fi |
require 'rubygems' | |
require 'eventmachine' | |
$stdout.sync = true | |
$stderr.sync = true | |
EM.run { | |
EM.add_periodic_timer(0.1) { | |
$stdout.write "stdout\n" |
[client] | |
port = 3306 | |
socket = /var/run/mysqld/mysqld.sock | |
[mysqld] | |
port = 3306 | |
datadir = /var/lib/mysql | |
socket = /var/run/mysqld/mysqld.sock | |
max_connections = 500 |
# libevent | |
cd /usr/local/src | |
wget https://github.com/downloads/libevent/libevent/libevent-2.0.20-stable.tar.gz | |
tar xvfz libevent-2.0.*-stable.tar.gz | |
cd libevent-2.0.20-stable/ | |
./configure | |
make | |
make install |
require 'rubygems' | |
require 'eventmachine' | |
require 'socket' | |
module RPCServer | |
include EM::P::ObjectProtocol | |
def post_init | |
@obj = Hash.new | |
end | |
def receive_object method |
(I guarantee nothing. No warranty I am not responsible blah blah blah. Seems to work great for me so far. Thanks to Tyler Bird who I forked this from.)
This installs a patched ruby 1.9.3-p392 with the railsexpress patchsets: https://github.com/skaes/rvm-patchsets
#!/usr/bin/env bash | |
apt-get -y update | |
apt-get -y upgrade | |
apt-get -y install build-essential zlib1g-dev libssl-dev libreadline-gplv2-dev libyaml-dev libffi-dev | |
apt-get -y install autoconf curl git-core bzip2 | |
apt-get -y autoremove | |
apt-get -y clean | |
cd /usr/local/src | |
wget ftp://ftp.ruby-lang.org/pub/ruby/2.0/ruby-2.0.0-p247.tar.gz | |
tar -xvzf ruby-2.0.0-p247.tar.gz |