Crate - ruby based standalone executables

50 %
50 %
Information about Crate - ruby based standalone executables
Technology

Published on March 30, 2009

Author: copiousfreetime

Source: slideshare.net

Description

This is the version of my Crate talk that was given at Scotland on Rails 2009.

This talk will cover the Crate project and how it may be used to package your web application. The end result is a statically built executable of the ruby interpreter and all dependent binary extensions. The application code, ruby stdlib the web framework itself, and all assets are packed into one or more SQLite databases.

CRATE Ruby based, standalone executables Jeremy Hinegardner jeremy@copiousfreetime.org @copiousfreetime

COPIOUS FREE TIME Fedora Ruby Packaging Gems •beanstalkd •amalgalite •haproxy •crate •libtomcrypt •keybox •libtommath •launchy •nginx •heel •ragel •hitimes •tinyproxy •htauth •rabal •stickler

Crate & Amalgalite

SURVEY

PRE HISTORY RubyConf 2007

PRE HISTORY RubyConf 2007 • Sploitin’ with Ruby • Aaron Bedra

PRE HISTORY RubyConf 2007 • Sploitin’ with Ruby • Aaron Bedra • Deploying Ruby Runtimes • Bruce Williams & Rich Kilmer

STORYTIME

PERL 4, 1993

NO CONTROL

NO CONTROL • interpreters? - perl probably, python maybe, ruby most likely not

NO CONTROL • interpreters? - perl probably, python maybe, ruby most likely not • what libraries? - openssl? zlib?

NO CONTROL • interpreters? - perl probably, python maybe, ruby most likely not • what libraries? - openssl? zlib? • compiler? - quite possibly not

What do you do, when only thing you know about your target system, is the Operating System?

AND YOU LOVE RUBY.

YOU MAKE CRATE.

SO WHAT IS CRATE?

embedded Ruby

embedded Ruby + ruby extensions

embedded Ruby + ruby extensions + main wrapper

embedded Ruby + ruby extensions + main wrapper + standard library

embedded Ruby + ruby extensions + main wrapper + standard library + application code

embedded Ruby + ruby extensions + main wrapper + standard library + application code Crate based application

RUBYSCRIPT2EXE ?

http://www.erikveen.dds.nl/rubyscript2exe

SHOES ?

MY NEEDS

MY NEEDS • Minimally Invasive • do not unpack to a temporary location • small as can be

MY NEEDS • Minimally Invasive • do not unpack to a temporary location • small as can be • Wide deployment capabilities • more than linux, mac, windows, cygwin

embedded Ruby + ruby extensions + main wrapper + standard library + application code Crate based application

embedded Ruby C + ruby extensions + main wrapper + standard library + application code Crate based application

embedded Ruby C + ruby extensions + main wrapper + standard library Ruby + application code Crate based application

Statically Compile embedded Ruby C + ruby extensions + main wrapper + standard library Ruby + application code Crate based application

Statically Compile embedded Ruby C + ruby extensions + main wrapper + standard library Ruby + application code Crate based application Amalgalite

Statically Compile embedded Ruby C + ruby extensions + main wrapper + standard library Ruby + application code Crate based application Pack into Amalgalite

1 CREATE TABLE rubylibs ( 2       id            INTEGER PRIMARY KEY AUTOINCREMENT, 3       filename      TEXT UNIQUE, 4       compressed    BOOLEAN, 5       contents      BLOB 6       );

Inexact Size Measurements Executable + C Ruby libs extensions Ruby 1.8.6 2.4 M 8.4 M Crate/ruby 1.8.6 2.9 M 1.9 M

 1 module Kernel  2   # alias the original require away to use later  3   alias :amalgalite_original_require :require  4  5   #  6   # hook into the system 'require' to allow for required text or blobs from an  7   # amalgalite database.    8   #  9   def require( filename ) 10     loaded = amalgalite_original_require( filename ) 11   rescue LoadError => load_error 12     if load_error.message =~ /#{Regexp.escape filename}z/ then 13       loaded = Amalgalite::Requires.require( filename ) 14     else 15       raise load_error 16     end 17   end 18 19   private :require 20   private :amalgalite_original_require 21 end

Amalgalite ruby driver is bootstrapped in its C extension

DEMO

ISSUE #1 - AUTOLOAD

ISSUE #1 - AUTOLOAD • Problem • bypasses the require chain setup by amalgalite • used by rack, active_support, active_record

ISSUE #1 - AUTOLOAD • Problem • bypasses the require chain setup by amalgalite • used by rack, active_support, active_record • Solution • Port tree style patches? • custom gem builds?

ISSUE #2 - VIEWS

ISSUE #2 - VIEWS • Problem • layout and templates loaded from disk

ISSUE #2 - VIEWS • Problem • layout and templates loaded from disk • Solution • wait for Rails 3 • sinatra, others, make patches for upstream, if needed.

ISSUE #3 - CLASS RELOADING • Problem • Development mode reloads classes • Solution ( for now ) • production mode when running as crate based apps

QUESTIONS?

Add a comment

Related presentations

Presentación que realice en el Evento Nacional de Gobierno Abierto, realizado los ...

In this presentation we will describe our experience developing with a highly dyna...

Presentation to the LITA Forum 7th November 2014 Albuquerque, NM

Un recorrido por los cambios que nos generará el wearabletech en el futuro

Um paralelo entre as novidades & mercado em Wearable Computing e Tecnologias Assis...

Microsoft finally joins the smartwatch and fitness tracker game by introducing the...

Related pages

The Ruby Toolbox - Packaging to Executables

... tools and resources for Ruby developers with popularity ratings based on Github watchers ... Packaging to Executables. 0; ... standalone executables, ...
Read more

RubyInstaller for Windows

This is a self-contained Windows-based installer that includes the Ruby ... RubyInstaller 2.0.0 ... If you're looking to create Ruby on Rails ...
Read more

use pyinstaller to create standalone executables · Issue ...

use pyinstaller to create standalone executables #213. Closed ThomasWaldmann opened this Issue Sep 20, 2015 · 21 comments Labels bug enhancement. ...
Read more

Generating Standalone Executable file Using Matlab Coder ...

Generating Standalone Executable file Using ... I want to create a Standalone executable file from my Matlab code. ... Based on your location, ...
Read more

C compiler cannot create executables - Google Groups

... and I want to build Ruby from source with the Mingw64 compiler ... C compiler cannot create executables ... and you can build a standalone 64bit ...
Read more

Types of Executables | Linux.org

These text-based executables are called scripts. Scripts are not stand-alone executables like compiled executables. ... Ruby - #!/usr/bin/env ...
Read more

Bundler: The best way to manage a Ruby application's gems

Bundler provides a consistent environment for Ruby projects by tracking ... The executables installed into bin ... Create a rubygem with Bundler.
Read more

Crate.IO

While Crate can be a standalone database it also runs ... AVUXI uses Crate to analyze 20 million geolocation events a day providing location based ...
Read more