Table of Contents
Rails application
The accelerator comes with Rails 1.2.5 and Ruby 1.8.6 installed.
Preflight
Installation
- Configure your Facebook application to point to http://xxxxxxxx.fb.joyent.us
- SFTP to your server with user xxxxxxxx server xxxxxxxx.fb.joyent.us.
- Place your rails application into /home/xxxxxxxx/web
Migration
- To create a database in a browser log into http://xxxxxx.fb.joyent.us:10000/ as admin and please follow these instructions.
- Run rake
- From Virtualmin
- Log into https://xxxxxxxx.fb.joyent.us:10000 as admin
- Select Webmin from the left-hand navibation
- Select System
- Select Running Processes
- In Command to run enter:
cd /home/xxxxxx/web && rake db:migrate RAILS_ENV=production
- Select “Run”
- From SSH
ssh xxxxxxxx@xxxxxxxx.fb.joyent.us cd web rake db:migrate RAILS_ENV=production
Running Rails Application
Your out of the box choices are: Lighttpd, Mongrel or Mongrel cluster. You have root and are free to install any stack. Here we cover Mongrel cluster. If you wish to use Mongrel or Lighttpd, then select that option from Bootup Action. If you want to do something else, then select Add a new bootup action. The rails guide covers how to get Mongrel up and running.
Mongrel Cluster
- Log into https://xxxxxxxx.fb.joyent.us:10000 as admin
- Click Service in the left-hand navigation, then click Bootup Action
- From the top of boot-up actions page, click Add New Mongrel Cluster.
- Enter a short name (letters, digits, '-' or '_' are allowed, but not spaces) into the Action name field.
- Enter a description into Description.
- Choose whether you want the action to start (and keep running) right away using the Started? option. You'll most likely want to leave this as Yes
- Enter the mongrel cluster file name in Cluster yml file field. This is typically /home/xxxxxxxx/web/config/mongrel_cluster.yml
- Enter rails application root into Rails root directory field. This is typically /home/xxxxxxxx/web/.
- Click Create.
- Select your newly created action to see that the mongrels did start up correctly. Besides the Started processes you should see the list of running processes and their statistics.
Example Mongrel_cluster.yml
port: "8000" environment: production address: 127.0.0.1 pid_file: log/mongrel.pid log_file: log/mongrel.log servers: 2
Apache VirtualHost
- SSH onto your Accelerator
SSH admin@xxxxxxxx.fb.joyent.us
- Edit the configuration file
nano /opt/local/etc/httpd/virtualhosts/xxxxxxxx.conf
- Replace the contents with this:
- replace YOUR-PUBLIC-IP with the IP from your welcome email
- replace xxxxxxxx with your name
<VirtualHost YOUR-PUBLIC-IP:80> ServerName xxxxxxxx.fb.joyent.us DocumentRoot /home/xxxxxxxx/web/public <Directory "/home/xxxxxxxx/web/APP/public/"> Options FollowSymLinks AllowOverride None Order allow,deny Allow from all </Directory> RewriteEngine On RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f RewriteRule ^/(.*)$ balancer://app1-mongrels%{REQUEST_URI} [P,QSA,L] <Proxy balancer://app1-mongrels> BalancerMember http://127.0.0.1:8000 BalancerMember http://127.0.0.1:8001 </Proxy> ProxyPass /images ! ProxyPass /stylesheets ! ProxyPass / balancer://app1-mongrels ProxyPassReverse / balancer://app1-mongrels ProxyPreserveHost On </VirtualHost>
- Restart apache
su - admin sudo svcadm restart apache
Memcache
The gems are already installed all you need to do is to start the server
From Virtualmin
- In a browser log into http://xxxxxxxx.fb.joyent.us:10000/ as admin
- Select Webmin below Joyent Accelerator
- From the left-hand navigation select System
- Select Service Management Facility
- Select Include Disabled Services at the top
- Check memcache
- Select Enable pushbutton at the top and to the right of Apply to Checked Items
From SSH
- From your local machine,
ssh admin@xxxxxxxx.fb.joyent.us
- enable memcache
sudo svcadm enable memcache
On my fb dev accelerator this service is named memcached.