Assembla home | Assembla project page
 

Typo Tool configuration

With the following instructions, we keep blogs in /var/www/typo directory, hide them behind *.typo.assembla.com domain, the current Typo version is 2.6.0, the tool server is stagingtools.assembla.com, the Breakout server is stage.assembla.com and assume that the control server, MySQL and Apache2 are configured. We use an Apache technique called mass virtual hosting.

Rewrite configuration

Create *.typo.assembla.com, an A DNS entry, pointing to the server IP.

Make sure that mod_rewrite is enabled:

# a2enmod rewrite

Reload the web server:

# /etc/init.d/apache2 force-reload

Create /etc/apache2/sites-available/typo containing:

<Directory "/var/www/typo/">
  Options ExecCGI FollowSymLinks
  AllowOverride all
  Allow from all
  Order allow,deny
</Directory>
        
UseCanonicalName Off
RewriteEngine On

RewriteMap lowercase int:tolower

RewriteCond ${lowercase:%{SERVER_NAME}} ^[a-zA-Z0-9-]+\.typo\.assembla\.com$

RewriteRule ^(.+) ${lowercase:%{SERVER_NAME}}$1 [C]
RewriteRule ^([a-zA-Z0-9-]+)\.typo\.assembla\.com/(.*) /var/www/typo/$1/public/$2 [L]
RewriteRule ^([a-zA-Z0-9-]+)\.typo\.assembla\.com/dispatch.fcgi(.*) /var/www/typo/$1/public/dispatch.fcgi/$2 [L]

Enable the site:

# a2ensite typo

Reload the web server:

# /etc/init.d/apache2 reload

Trying to access http://test.typo.assembla.com/, you should get:

Not Found

The requested URL / was not found on this server.

Create an environment for the Typo:

# mkdir -p -m 755 /var/www/typo/
# cd /var/www/
# svn co http://svn.assembla.com/svn/appshare/breakout/vendor/tools/typo/
A  typo/setup-database.sh
A  typo/typo-2.6.0
A  typo/typo-2.6.0/app
A  typo/typo-2.6.0/app/models
A  typo/typo-2.6.0/app/models/user.rb
A  typo/typo-2.6.0/app/models/configuration.rb
A  typo/typo-2.6.0/app/controllers
A  typo/typo-2.6.0/app/controllers/accounts_controller.rb
A  typo/typo-2.6.0/app/controllers/articles_controller.rb
A  typo/typo-2.6.0/app/apis
A  typo/typo-2.6.0/app/apis/user_api.rb
A  typo/typo-2.6.0/config
A  typo/typo-2.6.0/config/environment.rb
A  typo/typo-2.6.0/config/database.yml.rhtml
Checked out revision 602.
# cd /var/www/typo
# wget -q -O - http://rubyforge.org/frs/download.php/7005/typo-2.6.0.tgz | tar zxfk -
tar: typo-2.6.0/app/controllers/accounts_controller.rb: Cannot open: File exists
tar: typo-2.6.0/app/controllers/articles_controller.rb: Cannot open: File exists
tar: typo-2.6.0/app/models/configuration.rb: Cannot open: File exists
tar: typo-2.6.0/app/models/user.rb: Cannot open: File exists
tar: typo-2.6.0/config/environment.rb: Cannot open: File exists
tar: Error exit delayed from previous errors
# chown -R www-data: /var/www/typo
# chmod +x /var/www/typo/setup-database.sh

The control server configuration

Change the Typo section in the control server configuration:

typo:
  database_prefix: typo_
  base_dir: /var/www/typo/
  version: 2.6.0
  script: setup-database.sh
  base_url: http://INSTANCE_URL.SERVER/

Set the server suffix:

server: assembla.com

Run or restart the control server:

# cd /var/www/control
# su www-data -c ruby control.rb

The Breakout configuration

Add to config/environments/user_environment.rb:

    # URL for the control server DRb.
    :control_url => 'druby://stagingtools.assembla.com:8887',

    # URL for the remote access.
    :web_services_url => 'http://stage.assembla.com/backend/user',

    # URL for the login.
    :login_url => 'http://stage.assembla.com/user/login/'

Add to, depending on your enviroment, config/environments/production.rb or config/environments/development.rb:

ActionController::CgiRequest::DEFAULT_SESSION_OPTIONS.update(
  :session_domain => '.assembla.com'
)