https://github.com/syucream/ts_mruby
Enchant Apache Traffic Server with mruby power.
https://github.com/syucream/ts_mruby
mruby
Last synced: 8 months ago
JSON representation
Enchant Apache Traffic Server with mruby power.
- Host: GitHub
- URL: https://github.com/syucream/ts_mruby
- Owner: syucream
- License: apache-2.0
- Created: 2014-04-28T16:56:01.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2016-12-29T17:53:05.000Z (about 9 years ago)
- Last Synced: 2025-05-07T16:04:16.935Z (8 months ago)
- Topics: mruby
- Language: C++
- Size: 192 KB
- Stars: 10
- Watchers: 2
- Forks: 0
- Open Issues: 15
-
Metadata Files:
- Readme: README.md
- Changelog: ChangeLog
- License: LICENSE
Awesome Lists containing this project
README
ts_mruby
========
[](https://travis-ci.org/syucream/ts_mruby)
[](https://coveralls.io/github/syucream/ts_mruby?branch=master)
Enchant Apache Traffic Server with mruby power.
what's ts_mruby?
================
**ts_mruby is an Apache Traffic Server plugin that provides more flexible and extensible server configuration.** You can write the configuration by mruby, and use mrbgems modules. ... And maybe the plugin support common syntax as part of the mod_mruby and ngx_mruby.
See [Wiki](https://github.com/syucream/ts_mruby/wiki) for more documents.
Requirements
============
* C++11
* Apache Traffic Server >= 4.2.x with atscppapi
* To enable atscppapi, you should give the below option when you execute ./configure
```
./configure --enable-cppapi
```
* mruby
Examples
========
For example, you can write an ip filtering logic by using mruby like DSL:
```ruby
whitelist = [
"127.0.0.1"
]
# deny if client IP is listed in whitelist
conn = ATS::Connection.new
unless whitelist.include?(conn.remote_ip)
ATS::echo "Your access is not allowed ..."
ATS::return ATS::HTTP_FORBIDDEN
end
```
Quickstart
==========
using Docker
-------------
* 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 -it syucream/ts_mruby /bin/bash
root@ad7a82be8a65:/opt# trafficserver start
root@ad7a82be8a65:/opt# curl http://localhost:8080/
ts_mruby test
```
using Homebrew
---------------
* If you're a Mac OS X user, you can use Homebrew to install ts_mruby:
```
$ 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
```
Acknowledgement
===============
Some components for mruby in this repository and sample scripts refer to [mod_mruby](https://github.com/matsumoto-r/mod_mruby) and [ngx_mruby](https://github.com/matsumoto-r/ngx_mruby)'s one under the MIT License.