Slide 1

Slide 1 text

FaaStRuby https://faastruby.io/

Slide 2

Slide 2 text

.。oO(さっちゃんですよヾ(〃l _ l)ノ゙ ☆) .。oO(Ruby をもっと dynamic に使ひたい(〃l _ l)☆)

Slide 3

Slide 3 text

FaaStRuby とは、Ruby で作れる FaaS framework です。

Slide 4

Slide 4 text

FaaS って何? Serverless Framework を本番環境に投入するために https://speakerdeck.com/ne_sachirou/serverless‑frameworkwoben‑fan‑huan‑jing‑nitou‑ ru‑surutameni

Slide 5

Slide 5 text

FaaS って何? Function を第一級市民として扱ふインフラ設計。

Slide 6

Slide 6 text

Serverless https://serverless.com/ 老舗。Polyglot。複數の cloud FaaS を扱へる。樣々な serverless resource を扱へる。

Slide 7

Slide 7 text

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

Slide 8

Slide 8 text

FaaStRuby https://faastruby.io/ Easy, easy, easy 独自 infrastructure。Heroku のように實行 service までをそなへる。

Slide 9

Slide 9 text

FaaStRuby tutorial

Slide 10

Slide 10 text

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

Slide 11

Slide 11 text

. ├── 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

Slide 12

Slide 12 text

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!

Slide 13

Slide 13 text

左が http://localhost:3000/

Slide 14

Slide 14 text

handler に渡される event #"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={}>

Slide 15

Slide 15 text

FaaStRuby で簡單に serverless backend を作れます。 ERB を書けば frontend も載せられます。

Slide 16

Slide 16 text

frontend も Ruby で書きたくありませんか?

Slide 17

Slide 17 text

Opal ですよね。 https://opalrb.com/

Slide 18

Slide 18 text

Inesita https://inesita.fazibear.me/ virtual‑dom を Ruby (Opal) で實現する。

Slide 19

Slide 19 text

Inesita tutorial

Slide 20

Slide 20 text

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"

Slide 21

Slide 21 text

. ├── 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

Slide 22

Slide 22 text

bundle exec inesita build

Slide 23

Slide 23 text

Crystal https://crystal‑lang.org/ HyperStack (a.k.a. HyperLoop) https://hyperstack.org/ : React の wrapper。「Crystal を support したい」とか言ってる。 FaaStRuby : Crystal を support してゐる。 Ruby と Crystal は仲良くしたいですね(〃l _ l) (小並感