Upgrade to Pro — share decks privately, control downloads, hide ads and more …

FaaStRuby

 FaaStRuby

FaaStRuby + Inesita♥

さっちゃん

March 28, 2019
Tweet

More Decks by さっちゃん

Other Decks in Programming

Transcript

  1. Ruby on Jets http://rubyonjets.com/ Ruby on Rails on FaaS cf.

    Meguro.rb#24 serverless ruby with jets ‑ Speaker Deck https://speakerdeck.com/ohr486/serverless‑ruby‑with‑jets
  2. faastruby new-project example + d ./example + f ./example/project.yml +

    f ./example/secrets.yml + d ./example/functions/root + f ./example/functions/root/index.html.erb + f ./example/functions/root/template.rb + f ./example/functions/root/handler.rb + f ./example/functions/root/faastruby.yml + d ./example/functions/catch-all + f ./example/functions/catch-all/404.html + f ./example/functions/catch-all/handler.rb + f ./example/functions/catch-all/faastruby.yml + f ./example/public/faastruby.yml + f ./example/.gitignore Initialized empty Git repository in /Users/inoue_sachiro/dev/example/.git/ Project 'example' initialized. Now run: $ cd example $ faastruby local Then visit http://localhost:3000
  3. . ├── functions/ │ ├── catch-all/ │ │ ├── 404.html

    │ │ ├── faastruby.yml │ │ └── handler.rb │ └── root/ │ ├── faastruby.yml │ ├── handler.rb │ ├── index.html.erb │ └── template.rb ├── project.yml ├── public/ │ ├── assets/ │ │ ├── images/ │ │ │ ├── favicon-150x150.png │ │ │ ├── favicon.png │ │ │ └── logo-positive.png │ │ ├── javascripts/ │ │ │ └── main.js │ │ └── stylesheets/ │ │ └── main.css │ ├── faastruby.yml │ └── favicon.ico └── secrets.yml
  4. faastruby signup Welcome to FaaStRuby! Please enter your email address:

    Email: ~ Now type in a password. It must contain 8 to 50 characters and have at least one uppercase letter, one lowercase letter, one number and one special character @ $ ! % * ? & Password: Your password must contain 8 to 50 characters and have at least one uppercase letter, one lowercase letter, one number and one special character @ $ ! % \* ? & Please try again: ✔ Creating your account... You should have received an email with a confirmation token. If you didn't receive an email: - Make sure you sign up with the correct email address - The system won't send an email if you account status is already 'confirmed' Confirmation Token: ~ ✔ Confirming your account... Login successful!
  5. handler に渡される event #<FaaStRuby::Event:0x00007fab878551f8 @body=nil, @context="{}", @headers= {"Version"=>"HTTP/1.1", "Host"=>"localhost:3000", "Connection"=>"keep-alive",

    "Cache-Control"=>"max-age=0", "Upgrade-Insecure-Requests"=>"1", "User-Agent"=> "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.88 Safari/537.36 Vivaldi/2.5.1497.4", "Accept"=> "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8", "Accept-Encoding"=>"gzip, deflate, br", "Accept-Language"=>"ja,en-US;q=0.9,en;q=0.8", "Content-Type"=>nil, "Request-Method"=>"GET", "Content-Length"=>nil, "Remote-Addr"=>"127.0.0.1", "X-Request-Id"=>"31494a89-5b1d-4de9-a1e2-be14e44cbe35"}, @query_params={}>
  6. inesita new example create example create example/.gitignore create example/.sprockets.rb create

    example/Gemfile create example/README.md create example/app/application.rb create example/app/components/counter.rb create example/app/components/description.rb create example/app/components/home.rb create example/app/components/navbar.rb create example/app/index.html.slim create example/app/router.rb create example/app/store.rb create example/app/stylesheet.css.sass create example/config.ru create example/static/inesita-rb.png run bundle install from "./example"
  7. . ├── Gemfile ├── README.md ├── app/ │ ├── application.rb

    │ ├── components/ │ │ ├── counter.rb │ │ ├── description.rb │ │ ├── home.rb │ │ └── navbar.rb │ ├── index.html.slim │ ├── router.rb │ ├── store.rb │ └── stylesheet.css.sass ├── config.ru └── static/ └── inesita-rb.png
  8. Crystal https://crystal‑lang.org/ HyperStack (a.k.a. HyperLoop) https://hyperstack.org/ : React の wrapper。「Crystal

    を support したい」とか言ってる。 FaaStRuby : Crystal を support してゐる。 Ruby と Crystal は仲良くしたいですね(〃l _ l) (小並感