Works Ubuntu Apache Passenger
Works Ubuntu Apache Passenger
Works Ubuntu Apache Passenger
Install MySQL:
• sudo apt-get install mysql-server libmysqlclient-dev
• wget http://rubyforge.org/frs/download.php/70696/rubygems-1.3.7.tgz
• tar -xzf rubygems-1.3.7.tgz
• sudo ruby rubygems-1.3.7/setup.rb
• rm -R rubygems*
• nano ~/.gemrc
Add these two lines:
• install: --no-ri --no-rdoc
• update: --no-ri --no-rdoc
At the bottom of Apache’s config file, tell it to load the Passenger module you just
installed by copy/pasting output from the Phusion Passenger installer that looked
something like this (varies depending on ruby install and passenger install):
------------------------------------------
LoadModule passenger_module /opt/local/lib/ruby/gems/1.8/gems/passenger-2.2.15
/ext/apache2/mod_passenger.so
PassengerRoot /opt/local/lib/ruby/gems/1.8/gems/passenger-2.2.11
PassengerRuby /opt/local/bin/ruby
------------------------------------------
# only check for restart.txt et al up to once every 5 seconds, instead of once per processed request
PassengerStatThrottleRate 5
# Keep the spawners alive, which speeds up spawning a new Application listener after a period of
inactivity at the expense of memory.
RailsAppSpawnerIdleTime 0
# Additionally keep a copy of the Rails framework in memory. If you're using multiple apps on the same
version of Rails, this will speed up the creation of new RailsAppSpawners. This isn't necessary if you're
only running one or 2 applications, or if your applications use different versions of Rails.
RailsFrameworkSpawnerIdleTime 0
• cd /etc/apache2
• ls (Take notice of the general layout of Apache’s folders.)
• cd sites-available
• sudo nano MyWebsiteName
Content Example:
------------------------------------------
<VirtualHost *:80>
ServerName cfrghq.forces.ca
DocumentRoot /home/ubuntu/rails-sites/software/current/public/
<Directory /home/ubuntu/rails-sites/software/current/public/ >
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
------------------------------------------
Restart Apache:
Git:
Before we get started with Git, lets make sure your development machine can access github. If
you haven’t created an account yet, what are you waiting for? :)
Once you have logged in to github, add your development machine’s public key to your account
settings. Github help section can guide you through this.
In the directory of your rails application, initialize an empty git repository on the local machine:
• git init
This creates a series of files for git under the hidden folder ‘.git’ within your application’s folder.
If you want to tell git to exclude any of your application’s files from being seen by git (for
example; large files, databases), you can add them now by creating a file hidden file ‘.gitignore’
in the root of your application’s directory.
• git add .
Tell git where your repository is. In this case we’re using a github account:
Push all the files from your first commit to your git repository’s master branch:
Now you need to add your server’s public key to github so it can access the repository too:
• http://help.github.com/linux-key-setup/
• mysql -u ‘root’ -p
> enter MySQL root password:
> create database ApplicationsDatabaseProd;
> exit
Capistrano:
In your application’s directory, get Capistrano to create the files it requires (Capfile,
config/deploy.rb). Capfile is just an initialization file for Capistrano. Your deploy.rb file contains
the Capistrano settings.
# ApacheBench: (concurrent requests: 50) (number of total requests : 2000) (url to your
website). Use the following command:
Content Example:
------------------------------------------
auto eth0
iface eth0 inet static
address 192.168.0.100
netmask 255.255.255.0
network 192.168.0.0
broadcast 192.168.0.255
gateway 192.168.0.1
------------------------------------------
Annex B: Configuring SSH on a fresh Ubuntu install
Install SSH:
Content Example:
------------------------------------------
Host MyServersAliasName
Hostname 192.168.0.10
User ubuntu
------------------------------------------
Now you can use “ssh MyServersAliasName” to connect.
Configure SSH:
On the server:
• mkdir .ssh
If a public rsa key file exists (id_dsa.pub), copy it to the server so you can login without entering
a password:
• scp ~/.ssh/id_dsa.pub MyServersAliasName:.ssh/authorized_keys