Install - syucream/ts_mruby GitHub Wiki
Installation Guide
I privide 3 cases of installation way.
Case1. build yourself
1. Clone trafficserver's repository
$ git clone https://github.com/apache/trafficserver.git
2. Build and install trafficserver with atscppapi
How to build trafficserver, see the documents in its repository.
$ cd trafficserver
$ autoreconf -if
# If you use trafficserver-7.0.0+, remove '--enable-cppapi' option.
$ ./configure --enable-cppapi
$ make
$ make install
3. Clone ts_mruby's repository
$ git clone https://github.com/syucream/ts_mruby.git
$ git submodule init
$ git submodule update
4. (Optional) If you want to use mruby extentions in mrbgems, write build_config.rb as you wish
# in the ts_mruby root directory
$ vim build_config.rb
5. Configure for ts_mruby
$ autoreconf -if
$ ./configure --with-ts-prefix-root=/path/to/trafficserver/
6. Build libmruby.a which is the static library of mruby
$ make build_mruby
7. Prepare ts_mruby.so
$ make
$ make install
8. Prepare mruby script
9. Configure plugin.config to load ts_mruby.so and your mruby script
$ vim /path/to/prefix/etc/trafficserver/plugin.config
# you should append below the line to the bottom of this file.
---
ts_mruby.so /path/to/script.rb
---
10. Run trafficserver and enjoy. :)
Case2. use pre-built docker image
- Example docker image has already published to Docker Hub. The image contains a test script(simply responds by ATS::echo), so you can test ts_mruby quickly:
$ docker pull syucream/ts_mruby
$ docker run docker run -it syucream/ts_mruby /bin/bash
root@ad7a82be8a65:/opt# trafficserver start
root@ad7a82be8a65:/opt# curl http://localhost:8080/
ts_mruby test
Case3. use Homebrew, if you're a Mac OS X user.
$ brew install https://raw.githubusercontent.com/syucream/ts_mruby/master/Formula/trafficserver-atscppapi.rb
$ brew install --HEAD https://raw.githubusercontent.com/syucream/ts_mruby/master/Formula/ts_mruby.rb