$ docker network create n1$ docker run --rm -it --name t1 --net n1  -e TARANTOOL_REPLICATION=t1:3301,t2:3301 progaudi/tarantool:1.10.1-135-g193ef4150| version: '3.7' | |
| services: | |
| t1: | |
| image: tarantool/tarantool:1.10.2 | |
| ports: | |
| - '3301:3301' | |
| entrypoint: '' | |
| hostname: t1 | |
| command: | 
| local function noop(...) | |
| return ... | |
| end | |
| -- convert a nested table to a flat table | |
| local function flatten(t, sep, key_modifier, res) | |
| if type(t) ~= 'table' then | |
| return t | |
| end | 
| FROM progaudi/tarantool:1.10.2 | |
| ENV VSHARD_VERSION=fcb05f7609b5a050781fe79829439e9730cee3ae | |
| RUN apk add -U --no-cache git \ | |
| && cd /tmp \ | |
| && git clone https://github.com/tarantool/vshard.git \ | |
| && ( cd vshard && git checkout ${VSHARD_VERSION} ) \ | |
| && mv vshard/vshard /opt/tarantool/vshard \ | |
| && rm -rf vshard | 
| consul_kv_put_cas() { | |
| local key="$1" | |
| local value="$2" | |
| local cas="$3" | |
| test "$(curl -sq -X PUT -d "$value" "http://localhost:8500/v1/kv/${key}?cas=${cas}")" = "true" | |
| } | |
| consul_kv_put_if_not_exists() { | |
| local key="$1" | |
| local value="$2" | 
| #### Running consul... | |
| ------------ CONSUL KEYS BEFORE ------------- | |
| --------------------------------------------- | |
| #### Running 10 consul-template instances with different templates... | |
| #### Killing all consul-template instances with SIGTERM signal... | |
| Cleaning up... | |
| Cleaning up... | |
| Cleaning up... | |
| Cleaning up... | |
| Cleaning up... | 
| Python 3.7.0 (default, Jun 29 2018, 09:12:54) | |
| [GCC 4.9.2] on linux | |
| Type "help", "copyright", "credits" or "license" for more information. | |
| >>> import asyncio, asynctnt | |
| >>> asyncio.run(asynctnt.Connection(host='aa', port=1234).connect()) | |
| Traceback (most recent call last): | |
| File "<stdin>", line 1, in <module> | |
| File "/usr/local/lib/python3.7/asyncio/runners.py", line 43, in run | |
| return loop.run_until_complete(main) | |
| File "/usr/local/lib/python3.7/asyncio/base_events.py", line 568, in run_until_complete | 
| from collections import deque | |
| from functools import partial, wraps | |
| class Deferred: | |
| """ | |
| Deferred functions execution. | |
| Usage: | 
| import itertools | |
| import functools | |
| class It: | |
| """A handy iterator with method chaining. | |
| >>> It([1, 2, 3]).map(lambda x: x**2).filter(lambda x: x<5).chain_after('abc').apply(list) | |
| ['a', 'b', 'c', 1, 4] | |
| """ | 
| #!/usr/bin/env bash | |
| cat <<EE > app.lua | |
| box.cfg { | |
| listen = 3301, | |
| read_only = false, | |
| wal_mode = "write", | |
| replication = {"t1:3301", "t2:3301"}, | |
| } |