ã¯ããã«
å æ¥åå ãã第2å ã³ã³ããåä»®æ³åã®æ å ±äº¤æä¼ï¼ æ±äº¬ã®ä¸ã§ @matsumotory ãããç´¹ä»ããã¦ãã mod_mruby ã試ãã¦ã¿ããã¨æãã
ã¨ãããã試ãã¨ããæã«ã¯ docker
ãã¨ã¦ã便å©ã ãªã¼ã¨ãããã¨ã§ããã¡ãã®ã³ã³ããã¤ã¡ã¼ã¸ã使ã£ã¦è©¦ãã
æé
README.md ã«å¾ã£ã¦å°å ¥ããã
ã³ã³ãããèµ·åãã¦å¿ è¦ãªããã±ã¼ã¸ãã¤ã³ã¹ãã¼ã«
docker run -i -t inokappa/wheezy-basic /bin/bash
ä»å㯠Debian 7.1
ç°å¢ã§è©¦ãã
sudo apt-get update sudo apt-get install apache2 sudo apt-get install git sudo apt-get install apache2-prefork-dev sudo apt-get install rake sudo apt-get install bison sudo apt-get install libcurl4-openssl-dev sudo apt-get install libhiredis-dev sudo apt-get install libmarkdown2-dev sudo apt-get install libcap-dev sudo apt-get install libcgroup-dev
è£è¶³ã¨ä¿®æ£
sudo apt-get install libcgroup
ã¯ééãã
ã½ã¼ã¹ã³ã¼ãã git clone ãã
cd /root git clone git://github.com/matsumoto-r/mod_mruby.git
ãã«ãç¨ã®ã·ã§ã«ã¹ã¯ãªãããå®è¡ãã
cd mod_mruby sh build.sh
æ£å¸¸ã«çµäºãã㨠/etc/apache2/mods-enabled
以ä¸ã« mruby.load
ãçæããã¦ãããã¾ãã/usr/lib/apache2/modules/mod_mruby.so
ãçæããã¦ãããã¨ã確èªããã
LoadModule mruby_module /usr/lib/apache2/modules/mod_mruby.so
ä¸è¨ã®ããã«ãªã£ã¦ããã®ã§ãããã« AddHandler mruby-script .rb
ã追å ãã¦ä¸è¨ã®ããã«ãªç¶æ
ã«ãã¦ããã
LoadModule mruby_module /usr/lib/apache2/modules/mod_mruby.so AddHandler mruby-script .rb
ã¾ããtest.rb
ãããã¥ã¡ã³ãã«ã¼ãã«ã³ãã¼ãã¦ããã
cd /root/mod_mruby/test cp test.rb /var/www/
apache ã® configtest ã§ç¢ºèª
apachectl configtest
以ä¸ã®ããã« warning
ãåºãããããã©æ¾ç½®...
/usr/sbin/apachectl: 87: ulimit: error setting limit (Operation not permitted) apache2: Could not reliably determine the server's fully qualified domain name, using ::1 for ServerName Syntax OK
ä¸æ¦ãã³ã³ãããã exit
ããã
ã³ã³ããã¤ã¡ã¼ã¸ãä½æãã
docker ps -a
ã«ã¦å
ã»ã©ã®ã³ã³ããã® ID
ã確èªãã¦ã³ã³ããã¤ã¡ã¼ã¸ãã³ãããããã
docker commit ${ID} ${image/name}
ã³ã³ããã¤ã¡ã¼ã¸ãèµ·åãã
docker run -i -t -p 80 ${image/name} /bin/bash
ãã°ã¤ã³å¾ã« Apache
ãèµ·åããã
sudo /etc/init.d/apache2 start
確èª
docker ps ã§ãã¼ãã確èªãã
docker ps
ã§ã³ã³ããå
ã® 80
ãã¼ãã¨ç´ä»ãã¦ãããã¼ãã確èªããã
ID IMAGE COMMAND CREATED STATUS PORTS 89f052176180 inokappa/wheezy-apache-mod-mruby:latest /bin/bash 27 minutes ago Up 27 minutes 49153->80
ä¸è¨ã®ä¾ã§ã¯ 49153->80
ã¨ãªã£ã¦ããã®ã§ docker0 ã® IP:49153
ã§ã¢ã¯ã»ã¹ãããã¨ã«ãªãã
ã¢ã¯ã»ã¹ãã¦ã¿ã
å
ã»ã©è¨ç½®ãã test.rb
ã«ã¢ã¯ã»ã¹ãã¦ã¿ãã
ãããã¢ã¯ã»ã¹åºæ¥ãã
æå¾ã«
- è¥å¹²ããã«ãã«æéãè¦ããï¼é¢é£ããããã±ã¼ã¸ã®å°å
¥ã§...ï¼ãç°¡åã«
mod_mruby
ã試ããã¨ãåºæ¥ã