Rails 5 is here!

Posted in Rails by

 

Rails 5 screenshot

Rails 5 was recently released, and is now available as a one-click install in our control panel! This release has a ton of new features, including built-in WebSockets support via Action Cable, an API mode to build backends for web and native client apps, and much more.

Our installer sets up Rails with Ruby 2.2.5, served with Passenger 5 on Nginx 1.10. This stack is available on our CentOS6 and CentOS7 servers – customers on CentOS5 servers who wish to install Rails 5 should request a migration to the newer OS via our control panel.

Why are you still reading this? Go install Rails 5 and build something cool today!

-
-

One-click installers: Ruby

Posted in Rails by

For our second post taking a closer look at the one-click installers available with the WebFaction control panel, it’s time to look at running Ruby applications. For Ruby developers, we have two key installers: Ruby on Rails and Passenger.

Ruby on Rails

Ruby on Rails, commonly known as just Rails, is the dominant web application framework for Ruby. Rails comes with a variety of components that make it easy to route requests, render pages, or store information in a database. It’s backed by a large community, and many supporting libraries.

See the WebFaction Rails documentation for more information on deploying your Rails project, common configuration and installation tasks, and troubleshooting.

Passenger

Phusion Passenger is an application server that supports Ruby Rack applications. Rack is a common interface to connect Ruby applications with web servers. It’s the lingua franca of Ruby web applications, including Rails and Sinatra. So the Passenger one-click installer can be used to run arbitray Ruby web applications.

Ruby is exceptionally popular for creating web applications, and these one-click installers are a quick way to get started. Try one out and, if you need any help, join us in the Q&A Community

-
-

A look at our Ruby setup

Posted in Rails by

It’s been a while since the last installment in our series of in-depth looks at the setup on WebFaction servers, so today we thought we’d take a close look at Ruby. Ruby has become a popular choice for web development and we’re pleased to support this powerful, dynamic open-source language.

To start off, let’s do a quick mic check with Ruby’s interactive interpreter, irb:

$ irb
irb(main):001:0> def hi(name)
irb(main):002:1> puts "Hello, #{name}!"
irb(main):003:1> end
=> nil
irb(main):004:0> hi("WebFactioneers")
Hello, WebFactioneers!
=> nil
irb(main):005:0> exit

Ruby’s installed on all of our servers; version 1.8.7 is the default ruby interpreter. For example, on web310:

$ ruby --version
ruby 1.8.7 (2011-06-30 patchlevel 352) [x86_64-linux]

That’s not the only version available, however. Ruby 1.8.7 Enterprise Edition is available as ruby1.8.7ee and Ruby 1.9.3 is available as ruby1.9. Or you can run Ruby 1.8.7 explicitly as ruby1.8.7.

$ ruby1.8.7ee --version
ruby 1.8.7 (2009-12-24 patchlevel 248) [x86_64-linux], MBARI 0x6770, Ruby Enterprise Edition 2010.01

$ ruby1.9 --version
ruby 1.9.3p125 (2012-02-16 revision 34643) [x86_64-linux]

$ ruby1.8.7 --version
ruby 1.8.7 (2011-06-30 patchlevel 352) [x86_64-linux]

Of course, we wouldn’t leave you on your own with just an interpreter. RubyGems, the Ruby package manager, is installed for your convenience, along with a few handy gems, such as the build tool rake.

One of the easiest ways to use Ruby on the web is with the Passenger and Rails one-click installers. They both provide ruby and gem (and other executables) in the /home/<username>/webapps/<app>/bin directory. Consider this Rails app, for instance:

$ cd ~/webapps/myrailsapp/bin/

$ ls
bundle
erb
erubis
gem
irb
passenger
passenger-config
passenger-install-apache2-module
passenger-install-nginx-module
passenger-make-enterprisey
passenger-memory-stats
passenger-status
rackup
rails
rake
rake2thor
rdoc
restart
ri
ruby
sass
sass-convert
scss
start
stop
testrb
thor
tilt
tt

But it’s not too convenient to type out whole paths for your application when it’s time to install a gem or two or run some rake commands. Instead, we recommend that you temporarily change your environment, like this:

$ export GEM_HOME=$HOME/webapps/myrailsapp/gems
$ export RUBYLIB=$HOME/webapps/myrailsapp/lib
$ export PATH=$HOME/webapps/myrailsapp/bin:$PATH

Those changes only apply during the current session; the next time you log in, the environment variables will go back to their defaults. Once the environment is ready, then it’s a simple matter of installing the gem you need:

$ gem install oauth
Fetching: oauth-0.4.7.gem (100%)
Successfully installed oauth-0.4.7
1 gem installed
Installing ri documentation for oauth-0.4.7...
Installing RDoc documentation for oauth-0.4.7...

And now it’s ready to use in the application.

For a more complete demonstration of a Rails application, you might want to give the Redmine one-click installer a try. Redmine is a Rails application as well as a handy project management tool.

We hope that this post has given you some ideas about how you can use Ruby with WebFaction. For more information, please see the Ruby on Rails documentation. If you have any questions, let us know in the comments or join us in the Q&A communtity.

-
-

Welcoming Rails 3.2.1 and Ruby 1.9.3

Posted in Rails by

As you may have noticed, a new installer has appeared in the control panel for Rails 3.2.1:

Not only does the new installer include the latest iteration of Rails, but it also sports a shiny new version of Ruby, 1.9.3. Ruby-1.9.3 is now installed on all WebFaction servers:

[demo@web310 ~]$ ruby1.9 -v
ruby 1.9.3p0 (2011-10-30 revision 33570) [x86_64-linux]

The 1.9-series Ruby features various bug fixes and library changes you might expect from a Ruby release, but it also introduces some important language changes. For example, Ruby 1.9 introduces a new syntax for creating anonymous functions:

howdy = lambda {|name| puts "Howdy, #{name}."}  # old style
hi = -> (name) {puts "Hi, #{name}."}            # new style

Ruby 1.9 introduces some other syntax and API changes, including changes to string encoding. So check out the Ruby NEWS file for more information.

Meanwhile, Rails 3.2 isn’t missing out on the fun, bringing some handy improvements, too. Highlights include a faster development mode and faster request routing. Another useful feature of Rails 3.2 is easy query explanations. In development mode, ActiveRecord queries that take longer than one half second to finish are automatically explained. In general, a new explain method makes it easier to track down slow queries and investigate indices.

To learn more about the latest developments in Ruby, check out the complete Ruby on Rails 3.2 Release Notes document.

When you’re ready, give the new Rails installer a try. If you have any questions, join us in the Q&A Community.

-
-

Rails 3 has landed!

Posted in Rails by

The long-awaited release of Rails 3 has finally arrived and with it a new one-click installer on the control panel.

Rails 3 is the culmination of two years of effort and a merge of the Rails and Merb projects. This major release sports numerous improvements, such as:

  • script/rails: the rails command replaces the individual commands in the scripts directory. For example, rails console replaces script/console.
  • Javascript framework agnosticism: Rails 3 lets you use Prototype, jQuery, and other Javascript tools as you need them.
  • Improved security: cross-site scripting (XSS) protection is included by default with Rails 3.
  • Easier email: Action Mailer has been redone with improved syntax and new options.

But that’s merely a small taste of what’s changed in the latest version of Rails. Check out the complete release notes for details on everything that’s changed since Rails 2.

When you’re ready, give the new one-click installer a try and join us in the forum to share what you think of this latest generation of Rails.

-
-