This is an example of how to create a pair of containers with tarantool and nginx upstream module, using docker-compose.
Last active
September 26, 2016 12:54
-
-
Save knazarov/9104385e15a2949d990fcf9f2a1579d9 to your computer and use it in GitHub Desktop.
docker-compose + tarantool + nginx upstream module
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env tarantool | |
box.cfg{} | |
-- Tarantool procedure | |
function tnt_rest(req) | |
-- req.headers -- http headers | |
-- req.uri -- uri | |
return { 'ok' } | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: '2' | |
services: | |
tarantool: | |
image: tarantool/tarantool:1.7 | |
environment: | |
TARANTOOL_REPLICATION_SOURCE: "tarantool" | |
networks: | |
- mynet | |
ports: | |
- "3301:3301" | |
volumes: | |
- ./app.lua:/opt/tarantool/app.lua | |
command: ['tarantool', '/opt/tarantool/app.lua'] | |
nginx: | |
image: tarantool/tarantool-nginx | |
links: | |
- tarantool | |
networks: | |
- mynet | |
ports: | |
- "8080:8080" | |
volumes: | |
- ./tarantool.conf:/etc/nginx/conf.d/default.conf | |
networks: | |
mynet: | |
driver: bridge |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
upstream backend { | |
server tarantool:3301; | |
} | |
server { | |
listen 8080; | |
server_name localhost; | |
location /tnt_rest { | |
# REST mode on | |
tnt_http_rest_methods get post put delete; # or all | |
# Pass http headers and uri | |
tnt_pass_http_request on; | |
# Module on | |
tnt_pass backend; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment