Date post: | 29-Jan-2018 |
Category: |
Technology |
Upload: | jeremy-hinegardner |
View: | 2,969 times |
Download: | 0 times |
COPIOUS FREE TIME
Fedora Packaging
•beanstalkd•haproxy•libtomcrypt•libtommath•nginx•ragel•tinyproxy
Ruby Gems
•amalgalite•crate•keybox•launchy•heel•hitimes•htauth•rabal•stickler
Crate&
Amalgalite
SURVEY
PRE HISTORYRubyConf 2007
PRE HISTORYRubyConf 2007
• Sploitin’ with Ruby
• Aaron Bedra
PRE HISTORYRubyConf 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
+ main wrapper+ ruby extensions
embedded Ruby
+ standard library+ main wrapper+ ruby extensions
embedded Ruby
+ standard library+ main wrapper
+ application code
+ ruby extensions
embedded Ruby
+ standard library+ main wrapper
+ application codeCrate based application
+ ruby extensions
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
+ standard library+ main wrapper
+ application codeCrate based application
+ ruby extensions
Cembedded Ruby
+ standard library+ main wrapper
+ application codeCrate based application
+ ruby extensions
CRuby
embedded Ruby
+ standard library+ main wrapper
+ application codeCrate based application
+ ruby extensions
CRuby
Statically Compile
embedded Ruby
+ standard library+ main wrapper
+ application codeCrate based application
+ ruby extensions
CRuby
Statically Compile
Amalgalite
embedded Ruby
+ standard library+ main wrapper
+ application codeCrate based application
+ ruby extensions
CRuby
Statically Compile
Pack into Amalgalite
embedded Ruby
+ standard library+ main wrapper
+ application codeCrate based application
+ ruby extensions
1 CREATE TABLE rubylibs (2 id INTEGER PRIMARY KEY AUTOINCREMENT,3 filename TEXT UNIQUE,4 compressed BOOLEAN,5 contents BLOB6 );
Executable + C extensions
Ruby libs
Ruby 1.8.6
Crate/ruby 1.8.6
2.4 M 8.4 M
2.9 M 1.9 M
Inexact Size Measurements
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_error12 if load_error.message =~ /#{Regexp.escape filename}\z/ then13 loaded = Amalgalite::Requires.require( filename )14 else15 raise load_error16 end17 end18 19 private :require20 private :amalgalite_original_require21 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?