Heroku+Git+Sinatraã§ç°¡åWebã¢ããª
æè¿ãEC2ã¨ãGAEã¨ããç°¡åWebãããã¤ãµã¼ãã¹ãæµè¡ãã§ãããããããç¡æã§ç°¡åã«ä½¿ããRubyã®ãµã¼ãã¹ãåºãããã§ããããããHerokuï¼ãã¼ãªã¼ã¯ã¨èªããããï¼ãç¡æã§ä½¿ããç°å¢ã¯ã容é5MBã¨å°ãªãã§ãããå人ã§ç°¡åãªãµã¼ãã¹ãããã ããªãååãã¨æãã¾ããSSLã使ããã¿ããã§ãã®ã§ã
Herokuã§å®¹éã»æ§è½ä»¥å¤ã§é¸ã¹ããµã¼ãã¹ã¯ãããªæãã
詳ãããã¨ã¯åèãªã³ã¯å
ã«ãä»»ãããã¨ãã¦ãã¡ãã£ãã試ãã¦ã¿ã¾ããã
å¿ è¦ãªç°å¢
æä½éã以ä¸ãå¿ è¦ã§ãã
- Herokuã¢ã«ã¦ã³ã
- Git
- SSHéµ
gemã§ä»¥ä¸ãå ¥ãã¦ããã¾ãããã
$ sudo gem install heroku sinatra
æé
1. é©å½ã«ãã£ã¬ã¯ããªãåã£ã¦ã以ä¸ã®ãã¡ã¤ã«ãä½ãã¾ãã
myhello.rb
require 'rubygems' require 'sinatra' get '/' do 'Hello, world!' end
config.ru
require 'myhello' ; run Sinatra::Application
2. gitã¨herokuã³ãã³ãã§ãããã¤
é ã«ã³ãã³ããæã£ã¦ããã¾ããããéä¸ã§å ¥åãæ±ãããããé©å½ã«çãã¾ãããã
$ git init $ git add . $ git commit -m "initial commit" $ heroku create $ git push heroku master
3. 確èª
éä¸ã§ããããã¤å
ã®URLãåºåããã¦ããã¯ããªã®ã§ããã©ã¦ã¶ã®ã¢ãã¬ã¹ãã¼ã«å
¥åãã¦ç¢ºèªãã¾ãã
GUIç°å¢ã§ãã£ã¦ãã人ã¯ã
$ heroku open
ã§ããããããã§ããç°¡åã§ããã
ãµããã¡ã¤ã³ã®å¤æ´ãã§ãã¦ã
$ heroku rename newname
ã¨ãããããããã¯Webã®èªåã®ã¢ã«ã¦ã³ããã¼ã¸ããã§ãã¾ãã