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

-
-

Welcoming Ruby 2.0

Posted in General by

Today we’re happy to announce that the recently released Ruby 2.0 is now available on all of our servers. You can run Ruby 2.0 today as ruby2.0. Here it is on Web310:

$ ruby2.0 -v
ruby 2.0.0p0 (2013-02-24 revision 39474) [x86_64-linux]

Ruby 2.0 comes with a number of new features, performance improvements, and built-in library changes.

One of the more prominent new features is an addition to the language syntax: keyword arguments. Sometimes known as named parameters, keyword arguments provide a more explicit way of using arguments and setting defaults. Here’s a little example:

$ irb2.0
irb(main):001:0> def greet(greeting: 'Hello',  name: 'WebFactioneers')
irb(main):002:1>   puts "#{greeting}, #{name}!"
irb(main):003:1> end
=> nil
irb(main):004:0> greet(name: 'readers')
Hello, readers!
=> nil
irb(main):005:0> greet(greeting: 'Howdy')
Howdy, WebFactioneers!
=> nil
irb(main):006:0> # you can even change the order
irb(main):007:0* greet(name: 'readers', greeting: 'Salutations')
Salutations, readers!
=> nil

For more details about Ruby 2.0, including a description of potential incompatibilities with previous Ruby versions, please see the official release notes. Try out Ruby 2.0 with your WebFaction account and, if you have any questions, join us in the Q&A Community.

-
-

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.

-
-

Introducing Passenger

Posted in Ruby by

Recently, we quietly added an important pair of new apps to our complement of one-click installers based on Phusion Passenger. Passenger’s also known as mod_rails ormod_rack, but in the time I’ve spent playing with it, I’ve come to call it nifty.

Passenger is a module which works with nginx to make it easy to setup and run a wide variety of web applications, but Passenger shines while running Ruby and Ruby on Rails applications. But as you’re about to find out, it’s capable of a lot more.

In the control panel you’ll find two new application types available for installation:

  • Passenger 2.2.8 (nginx 0.7.64/Ruby Enterprise Edition 1.8.7)
  • Rails 2.3.5 (nginx 0.7.64/Passenger 2.2.8/Ruby Enterprise Edition 1.8.7)

The Rails application is a new (and, in many respects, improved) way of setting up your Rails applications; the Passenger application is a more generalized tool for deploying other kinds of applications.

Gems, Rack, and You

One of the great things about both new applications is how easy it is to install Ruby Gems. For example, here’s how I installed Sinatra, a light-weight web application framework:

[ddbeck@web100 ~]$ cd webapps/passenger_app/
[ddbeck@web100 passenger_app]$ export GEM_HOME=$PWD/gems
[ddbeck@web100 passenger_app]$ export PATH=$PWD/bin:$PATH
[ddbeck@web100 passenger_app]$ gem install sinatra
Successfully installed sinatra-0.9.4
1 gem installed
Installing ri documentation for sinatra-0.9.4...
Installing RDoc documentation for sinatra-0.9.4...

Another great feature of Passenger is that it supports the Rack interface which allows Ruby and Ruby frameworks to easily work with web servers. For example, I can use the Sinatra framework I just installed to create a simple web application:

[ddbeck@web100 passenger_app]$ mkdir frank
[ddbeck@web100 passenger_app]$ mkdir frank/public
[ddbeck@web100 passenger_app]$ mkdir frank/tmp
[ddbeck@web100 passenger_app]$ touch frank/config.ru
[ddbeck@web100 passenger_app]$ touch frank/myapp.rb 

Then I paste the following code (from Sinatra’s Getting Started guide) into myapp.rb:

require 'rubygems' require 'sinatra' get '/' do 'Hello WebFactioneers!' end 

Next, I put these lines into my config.ru:

require 'rubygems' require 'sinatra' require 'myapp' run Sinatra.application 

Finally, I update this line in ~/webapps/passenger_app/nginx/conf/nginx.conf:

root /home/ddbeck/webapps/passenger_app/hello_world/public; 

to:

root /home/ddbeck/webapps/passenger_app/frank/public; 

and reboot my application with ./bin/restart and voila!

[ddbeck@web100 passenger_app]$ curl ddbeck.webfactional.com Hello, WebFactioneers! 

With the flexibility and other improvements that Passenger provides, we invite you to give the new apps a try. We can’t wait to see what uses you find.

-
-