Setting_up_a_Rails_Development_Server

Post on 14-Dec-2014

394 views 0 download

Tags:

description

 

transcript

Setting up a Rails Development Server

Robert Dempsey & Joe Block

Development Environment

• Ubuntu 5.10

• Ruby 1.8.4 / Ruby Gems

• MySQL 5

• Rails 1.1.2

• Lighttpd a.k.a. Lighty

• Subversion

Ubuntu 5.10

Why Choose Ubuntu 5.10

• Good documentation

• Apt-get and synaptic package manager

• Strong device support

• No viruses

• Easy to install ruby and rails!

Installing Ubuntu 5.10

• Download and burn the latest iso image

• When you get to the installation prompt, hit enter

• Wait a bit for the install to finish

• Ready for customization

Customizing your install

• /etc/apt/sources.list– Uncomment the universe repository– deb http://de.archive.ubuntu.com/ubuntu/

dapper main restricted– deb http://de.archive.ubuntu.com/ubuntu/

dapper universe multiverse

• Turn on ssh access to the server– apt-get install openssh-server

Created /etc/apt/preferences with:

Package: *Pin: release a=breezy, v=5.10Pin-Priority: 900

Package: *Pin: release a=breezy-security, v=5.10Pin-Priority: 900

Package: *Pin: release a=breezy-updates, v=5.10Pin-Priority: 900

Package: *Pin: release a=dapperPin-Priority: 90

Additional Packages

• apt-get install gcc g++ libtool libreadline5 libreadline5-dev zlib1g-dev libssl-dev libgdbm-dev libgdbm3 libgdbm-dev zlibc zlib-bin libmysqlclient14-dev subversion subversion-tools libsvn0-dev libsvn0 xtail rrdtool mysql-server mytop make

Ruby 1.8.4 and Ruby Gems

Installing Ruby 1.8.4

• apt-get install -t dapper irb irb1.8 libpgsql-ruby1.8 libreadline-ruby1.8 libredcloth-ruby1.8 libruby libruby1.8 libyaml-ruby ruby1.8-examples rdoc1.8 ri1.8 libmysql-ruby1.8 libgdbm-ruby1.8 imagemagick librmagick-ruby1.8 librmagick-ruby-doc xml-core libmysqlclient14-dev

• sudo ln -s /usr/bin/ruby1.8 /usr/local/bin/ruby• sudo ln -s /usr/bin/ri1.8 /usr/local/bin/ri• sudo ln -s /usr/bin/rdoc1.8 /usr/local/bin/rdoc

Installing Ruby Gems

• Download rubygems

• Do “sudo ruby setup.rb" in the source directory.

• sudo gem update –include-dependencies

MySQL 5

Why Choose MySQL

• Easy to use and develop for

• Lots of good documentation

• Most hosting providers provide it free

Installing MySQL

• apt-get install -t dapper mysql-server mysql-client mytop

• Set mysql password to “foo”

• sudo mysqladmin -u root password foo

Rails 1.1.2

Installing Rails 1.1.2

• sudo gem install rails --include-dependencies

Lighttpd a.k.a. Lighty

Why Choose Lighty

• FastCGI

• Virtual hosts

• Fast and secure application controlled downloads

• Works on Linux, Unix and Windows

• Flexible and configurable

• Good docs and support

Installing Lighty

• apt-get install libfcgi-dev libfcgi-ruby• apt-get install libpcre3 libpcre3-dev bzip2 libbz2-

dev• wget http://www.lighttpd.net/download/lighttpd-

1.4.11.tar.gz• tar xvzf lighttpd-1.4.11.tar.gz• ./configure• time make• sudo make install

Subversion

Why Versioning is Good

• Online backups

• The “oh shit” factor

• Supports multiple developers– Mac: Subversion– Windows: Subversion / Tortoise SVN

• Most rails hosting companies have it built-in

Configuring Subversion

• adduser repouser

• Log in as repouser

• mkdir ~repouser/sources

• svnadmin create ~repouser/sources

• Edit the configuration file to change the access rules. Set ~repouser/sources/conf/svnserve.conf

Subversion continued…

• [general]

• anon-access = read

• auth-access = write

• realm = YourName Rails Repouser

• password-db = passwd

Setting up the repository

• mkdir -p foo/yourapp

• mkdir -p foo/ yourapp/trunk

• mkdir -p foo/ yourapp/branches

• mkdir -p foo/ yourapp/tags

• cd foo

• svn import . file:///home/repository/sources

Results

What we got…

• A ready to go, stable and robust rails development server that supports multiple developers on mixed platforms

Conclusions

Life is good!

• Easy and worth it

• Took about 10 minutes to install

• Can use it to show clients your progress or for in-house testing

Resources

Resource List• Ubuntu 5.10

– http://www.ubuntu.com• Ruby 1.8.4 / Ruby Gems

– http://www.ruby-lang.org– http://rubyforge.org

• MySQL 5– http://www.mysql.com

• Rails 1.1.2– http://www.rubyonrails.org

• Lighttpd a.k.a. Lighty– http://www.lighttpd.net

• Subversion– http://subversion.tigris.org

Thank You!