Tech Support

Deployment

How can I access my account using SSH?

The SSH services run at ssh.railscluster.nl on port 2222. Use the following to log in from the command line:
ssh account@ssh.railscluster.nl -p 2222

What is a suitable Capistrano recipe?

The following recipe can be used as starter:

# replace ACCOUNT with your account name
set :user, "ACCOUNT"

set :deploy_to, "/home/#{user}/web_root"
set :use_sudo, false

ssh_options[:port] = 2222
default_run_options[:pty] = false

server "ssh.railscluster.nl", :app, :web, :db, :primary => true

namespace :deploy do
  task :start, :roles => :app do
    run "touch #{current_release}/tmp/restart.txt"
  end

  task :stop, :roles => :app do
    # Do nothing.
  end

  task :restart, :roles => :app do
    run "touch #{current_release}/tmp/restart.txt"
  end
end

If you use Github you can use the following lines in the Capistrano recipe. Note, that you also need to add ssh keys to Github. Github Help has a tutorial for this.

set :scm, "git"
set :branch, "master"
default_run_options[:pty] = true
default_environment["PATH"] = "/opt/ruby-enterprise/bin:/usr/local/bin:/usr/bin:/bin"
#If you use submodules:
set :git_enable_submodules, 1

#set this to fit your github account
set :repository,  "URL"
set :user, "USER"
set :scm_passphrase, "PASSWORD"

How can I make restarts faster?

Do not vendorize the Ruby on Rails framework, e.g. remove the vendor/rails directory if you have one. RailsCluster keeps all older versions of Ruby on Rails installed, so you do not need it and startup times will decrease.

The cluster checks if your application should be restarted at least every ten seconds.

Where should I place my web application?

The most recent version of Ruby on Rails and Rack applications should be placed in ~/web_root/current, such that ~/web_root/current/public is present.

PHP applications should be placed in ~/web_root/current/public.

For deployment, we recommend you to use Capistrano. The capistrano and capistrano-ext gems are available by default on RailsCluster.

Why is my connection being reset while deploying?

To solve this problem, force the SSH to frequently send a keep-alive packet. This can be done by adding the following snippet to ~/.ssh/config on the machine deploying the application:

ServerAliveInterval 15

Why don’t I have access to my application?

Problem: Forbidden - You don't have permission to access / on this server.
Solution: File permissions are not set correctly, you have not uploaded a full application, or you are missing an index.html file in your public directory. Please ensure that files are chmod 644, directories chmod 755 and that the application or ~/web_root/current/public/index.html is present and complete.

How do I restart my application?

To restart an application on RailsCluster you can force a restart by using the Capistrano recipe above. Alternatively you can execute the command touch ~/web_root/current/tmp/restart.txt in SSH.

How can I execute cron scripts?

The following two items need to be considered:

  • Configure the correct path to Ruby. Without this path you will not be able to execute Rake commands or use the installed RubyGems.
  • Use /usr/local/bin/cluster_task to ensure that scripts do not run twice and in parallel. This improves performance and avoids race conditions in your application.

Example:

PATH=/opt/ruby-enterprise/bin:/usr/local/bin:/usr/bin:/bin
0 * * * * /usr/local/bin/cluster_task rake cron:hourly

Or using nicknames:

PATH=/opt/ruby-enterprise/bin:/usr/local/bin:/usr/bin:/bin
@hourly /usr/local/bin/cluster_task rake cron:hourly

How can I execute Rake commands with Capistrano?

Add the following to the Capistrano recipe: default_run_options[:pty] = false

Why do I get Net::SFTP::StatusException errors when doing Capistrano SFTP uploads?

Add the following to your Capistrano recipe: set :deploy_to, "/home/#{user}/web_root"

Which frameworks can be used on RailsCluster?

Since RailsCluster is powered by Phusion Passenger, it supports every framework that implements the Rack interface. This means that, aside from Ruby on Rails applications, RailsCluster also supports applications built on Camping, Halcyon, Mack, Merb, Ramaze and Sinatra.

Top

Databases

Which database should I use?

For every account, RailsCluster creates a MySQL and a PostgreSQL database. Aside from the common differences between MySQL and PostgreSQL, there is also a difference of infrastructure on RailsCluster. MySQL has a master-slave configuration with automatic failover, while PostgreSQL has a load-balancing multi-master configuration with degeneration.
As a consequence of this difference, PostgreSQL performs read operations two times faster, but write operations 7-15% slower. The profile of the web application is therefore important when deciding which database to use.

Which MySQL database engine should I use?

When you have chosen to use a MySQL database, we strongly recommend you to use the InnoDB database engine. InnoDB relations are transactional and designed to preserve the database integrity. MyISAM relations don’t offer this feature, therefore neither MyISAM nor RailsCluster can guarantuee no corruption will occur in case a node of the cluster drops out.

Which database versions does RailsCluster use?

At the moment, MySQL 5.1 is provided. The server has been optimized for InnoDB tables.
At the moment, PostgreSQL 8.4 is provided.

I can’t connect to the MySQL server!

Problem: 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (13)
Solution: MySQL runs on a separate host named ‘mysql’. Therefore, make sure the host is set correctly in database.yml:

production:
  host: mysql

I can’t connect to the PostgreSQL server!

Problem: could not connect to server: No such file or directory Is the server running locally and accepting connections on Unix domain socket "/tmp/.s.PGSQL.0"?
Solution: PostgreSQL runs on a separate host named ‘postgresql’. Therefore, make sure the host is set correctly in database.yml:

production:
  host: postgresql
Top

Daemons

Do you support background daemons?

Yes, we support background daemons at an extra monthly fee. We supply you with scripts and privileges to start and stop the daemons in a clustered fashion. Daemons that are known to work well include Ferret, memcached and Sphinx. Please contact us for more information.

How do I control my background daemons?

If you have the privileges to use background daemons, then you can use cluster_service [daemon] {start|stop|restart|status}.

How can I connect to my background daemons?

If you have the privileges to use background daemons and have started the daemon successfully, then you can connect to the daemon on daemon.railscluster.nl. Access is only available from within the RailsCluster platform.

Please pay careful attention to the specific port that your daemon is running on. This was provided to you when we enabled your account for background daemons. You can also check the configuration in ~/bin/cluster_[daemon]_wrapper or ~/etc/[daemon].conf depending on the specific daemon.

Top