Skip to content

Instantly share code, notes, and snippets.

@rnbguy
Last active April 30, 2019 15:12
Show Gist options
  • Save rnbguy/87e0af27ece2f4bf8840ad360ea0ab76 to your computer and use it in GitHub Desktop.
Save rnbguy/87e0af27ece2f4bf8840ad360ea0ab76 to your computer and use it in GitHub Desktop.
AntidoteDB docker-compose file

In one console,

docker-compose up

When the nodes are ready, in another console,

docker exec antidote1 ./connect.erl 3

P.S. above setup is adapted directly from AntidoteDB documentation.

#!/usr/bin/env escript
%%! -smp enable -sname erlshell -setcookie antidote
main([St]) ->
NumDC = list_to_integer(St),
io:format("AntidoteDB: setting up cluster for ~p datacenters!~n", [NumDC]),
DCs = lists:map(fun(Num) -> list_to_atom(lists:flatten(io_lib:format("antidote@antidote~w", [Num]))) end, lists:seq(1, NumDC)),
lists:foreach(fun(DC) -> rpc:call(DC, inter_dc_manager, start_bg_processes, [stable]) end, DCs),
Descriptors = lists:map(fun(DC) -> {ok, Desc} = rpc:call(DC, inter_dc_manager, get_descriptor, []), Desc end, DCs),
lists:foreach(fun(DC) -> rpc:call(DC, inter_dc_manager, observe_dcs_sync, [Descriptors]) end, DCs),
io:format("Done.~n").
version: "3.7"
services:
antidote1:
build: .
hostname: antidote1
container_name: antidote1
environment:
SHORT_NAME: "true"
NODE_NAME: antidote@antidote1
antidote2:
build: .
hostname: antidote2
container_name: antidote2
environment:
SHORT_NAME: "true"
NODE_NAME: antidote@antidote2
antidote3:
build: .
hostname: antidote3
container_name: antidote3
environment:
SHORT_NAME: "true"
NODE_NAME: antidote@antidote3
FROM antidotedb/antidote
ADD connect.erl connect.erl
RUN chmod u+x connect.erl
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment