-
Notifications
You must be signed in to change notification settings - Fork 30
Install
matsumoto-r edited this page Sep 9, 2014
·
27 revisions
docker run -d --name name1 matsumotory/mod-mruby
docker run -d --name name2 matsumotory/mod-mruby
docker run -d --name name3 matsumotory/mod-mruby
docker run -d -p 80:80 --link name1:proxy1 --link name2:proxy2 --link name3:proxy3 matsumotory/ngx-mruby
curl http://127.0.0.1/mruby-proxy
git clone git@github.com:matsumoto-r/mod_mruby.git
cd mod_mruby
# Edit apache config and Ruby script
vi docker/conf/mruby.conf
vi docker/hook/$(your_script).rb
docker build -t local/mod-mruby .
docker run -d -p 80:80 local/mod-mruby
curl http://127.0.0.1/mruby-hello
- Install ngx_mruby and mod_mruby using docker (in Japanese)
- Install mod_mruby using Docker (in Japanese)
- Install mod_mruby using Test-Kitchen into Vagrant (in Japanese)
- Install mod_mruby on AWS (in Japanese)
- Install mod_mruby on CentOS6 using Docker
git clone git://github.com/matsumoto-r/mod_mruby.git
- if you want more features, you can get mrbgems and write to build_config.rb
Downloading latest Apache httpd and test mod_mruby in your environment.
cd mod_mruby
sh test.sh
Please see test page if you want to know more details
sh build.sh
APXS_PATH_ENV='--with-apxs=/usr/local/apache/bin/apxs' \
APACHECTL_PATH_ENV='--with-apachectl=/usr/local/apache/bin/apachectl' \
sh build.sh
- Add to
httpd.conf
orconf.d/mruby.conf
LoadModule mruby_module modules/mod_mruby.so <Location /mruby-test> mrubyHandlerMiddle /path/to/test.rb </Location>
or cache enabled
apache LoadModule mruby_module modules/mod_mruby.so <Location /mruby-test> mrubyHandlerMiddle /path/to/test.rb cache </Location>
-
test.rb copy
cp -p test/test.rb /path/to/test.rb
service httpd restart
curl http://127.0.0.1/mruby-test
-
mruby/mruby build
cd mod_mruby git submodule init git submodule update cd mruby rake cd ..
-
configure
./configure
-
using mruby/mruby
make make install
- Selecting vhost area like mod_vhost_alias(hook on translatename)
r = Apache::Request.new() s = Apache::Server.new() r.filename = s.document_root + "/" + r.hostname + "/" + r.uri Apache::return(Apache::OK)
- Proxy balancer like mod_proxy_balancer(hook on translatename)
backends = [ "http://192.168.0.101:8888/", "http://192.168.0.102:8888/", "http://192.168.0.103:8888/", "http://192.168.0.104:8888/", ] # write balancing algorithm here. r = Apache::Request.new() r.handler = "proxy-server" r.proxyreq = Apache::PROXYREQ_REVERSE r.filename = "proxy:" + backends[rand(backends.length)] + r.uri Apache::return(Apache::OK)
- We should implement ngx_mruby/mod_mruby extensions as mrbgems, as possible.
- We recommend the contribute to mruby by implementing mrbgems.