Deploying Ruby on Rails as a standalone exe

I'm trying to deploy a ruby on rails application. It uses sqlite3 for a database. What I would like to do is distribute it as a windows executable. It should be in such a way that the user can click on the application and everything will load and a full screen browser window will appear. This way the user will know nothing about it being a browser and need no ruby components installed to run the application.

Has anyone done anything like this?

I'm trying to deploy a ruby on rails application.

<snip>

Has anyone done anything like this?

Conor, once you have compacted your Rails app into an exe, you could do something as simple as make a second executable (maybe a batch file or the equivalent of a windows shortcut) that calls your Rails App.exe and then invokes the web browser to launch and point to it.

I think I know what you are trying to achieve here, and getting the rails app into an exe is the challenging part (that is properly solved by the linked article). Getting a browser to launch and point somewhere is easy. Doing the tasks independently is very easy to accomplish, trying to get the Rails App.exe to launch browsers as well could overcomplicate a non-trivial task.

As others have mentioned, you may have issues with post-install setup, like configuring/pointing to/creating your sqlite databases. You might also want to do things like install-as-service, or ensure that RailsApp.exe runs on bootup.

As an aside, has anyone got some metrics on the size of the resulting Rails2Exe executable? I have considered compiling ruby/rails to executables as a way of potentially getting around the size of a rails/ruby app distribution, if it ever became an issue. (like if we needed to do things like deploy over the network).

There are other potential benefits - this can obfuscate your source, and even trivialise your Rails install if you need to ship it to people who thing Ruby is a wedding anniversary and Rails are things that trains run on.

@Richard:

“There are other potential benefits - this can obfuscate your source, and even trivialise your Rails install if you need to ship it to people who thing Ruby is a wedding anniversary and Rails are things that trains run on.”

It actually just TARs up the source, wraps it with an executable, and extracts the whole thing to a temp folder in order to run. Anyone willing to look for the temp folder would see your source.

I spent some time with this approach only to find out that it doesn’t quite work because there are lots of different configuration issues you need to deal with such as logging, locations of database files, etc. Not good for mass deployment, that’s for sure.

If you want a way to send apps to folks who know nothing about Ruby, you could use an installer created with the free InnoSetup program. You can bundle all of the necessary gems with the installer and have the installer do the gem installs. Make the installer invoke One-Click Ruby installer if you want a push-button solution. Then just have your installer copy the required files, invoke mongrel_rails service::install at the end of the setup.

I’m already doing this now and it’s pretty easy.

It actually just TARs up the source, wraps it with an executable, and extracts the whole thing to a temp folder in order to run. Anyone willing to look for the temp folder would see your source.

Aw crap. I was looking at Ruby *compilers* at the time too and must have got them confused.

If you want a way to send apps to folks who know nothing about Ruby, you could use an installer created with the free InnoSetup program. You can bundle all of the necessary gems with the installer and have the installer do the gem installs. Make the installer invoke One-Click Ruby installer if you want a push-button solution. Then just have your installer copy the required files, invoke mongrel_rails service::install at the end of the setup.

Nods. Its something I have to consider down the road anyway. I did think it would be easier to do this if your Rails app was an exe as well, but I will have to search more.

I am primarily interested in Rails App as exe, to see if I can get the distribution size down. Code obfuscation is nice too.

In my case, I also need to consider Mac OS/Linux/other *NIX packaging/ installation systems. And I need to make it scriptable so I can bundle up my Rails app at the tail end of a build process.

I'm already doing this now and it's pretty easy.

Certainly mongrel+sqlite makes Rails installation a *lot* easier.