Skip to content

Commit

Permalink
feat(scw): add ansible playbook for berty relays
Browse files Browse the repository at this point in the history
  • Loading branch information
gfanton committed Jun 5, 2019
1 parent e0368a1 commit 6003466
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 13 deletions.
7 changes: 7 additions & 0 deletions experiment/scw/Makefile
@@ -0,0 +1,7 @@
RELAY_SCALE ?= 10

relays:
ansible-playbook ./run-relay.yaml --extra-vars "scale=$(RELAY_SCALE)"

daemon:
ansible-playbook ./run-daemon.yaml
2 changes: 1 addition & 1 deletion experiment/scw/add-service.yaml
@@ -1,4 +1,4 @@
- hosts: scw
- hosts: bootstrap
vars:
local_home: "{{ lookup('env','GOPATH') }}"
tasks:
Expand Down
3 changes: 1 addition & 2 deletions experiment/scw/gen-identity.yaml
@@ -1,4 +1,4 @@
- hosts: scw
- hosts: bootstrap
tasks:
- name: Gen identity
local_action:
Expand All @@ -10,4 +10,3 @@
copy:
content="{{ command_output.stdout }}"
dest="/root/pk"

21 changes: 14 additions & 7 deletions experiment/scw/hosts
@@ -1,13 +1,20 @@
[scw]
[bootstrap]
51.158.71.240
51.158.67.118
51.15.221.60

[node1]
51.158.71.240
[relay]
51.15.254.78
51.15.203.188

[node2]
51.158.67.118
[test]
test1 ansible_host=localhost ansible_connection=local ansible_python_interpreter=/usr/local/bin/python3

[node3]
51.15.221.60
# [node1]
# 51.158.71.240

# [node2]
# 51.158.67.118

# [node3]
# 51.15.221.60
7 changes: 4 additions & 3 deletions experiment/scw/run-daemon.yaml
@@ -1,13 +1,14 @@
- hosts: scw
- hosts: bootstrap
vars:
local_home: "{{ lookup('env','GOPATH') }}"
tasks:
- name: build berty
local_action:
module: shell
_raw_params: "cd $GOPATH/src/berty.tech && docker build -f Dockerfile.scw -t berty/berty . && docker run --rm --entrypoint /bin/sh berty/berty:latest -c \"cat /go/bin/berty\" > berty"
# register: command_output
# - debug: msg="{{ command_output.stdout }}"
run_once: true
register: command_output
- debug: msg="{{ command_output.stdout }}"
- name: copy binary
copy:
src: "{{ local_home }}/src/berty.tech/berty"
Expand Down
21 changes: 21 additions & 0 deletions experiment/scw/run-relay.yaml
@@ -0,0 +1,21 @@
- hosts: relay
vars:
scale: 1
local_home: "{{ lookup('env','GOPATH') }}"
tasks:
- name: run berty relays
docker_container:
name: berty_relay_{{item}}
image: bertychat/berty:latest
pull: true
recreate: yes
network_mode: host
command: >
daemon
--dht-server
--log-level=debug
--mdns=true
--hop
--bind-p2p /ip4/0.0.0.0/udp/0/quic,/ip4/0.0.0.0/tcp/0,/ip6/::/udp/0/quic,/ip6/::/tcp/0
with_sequence: count={{scale}}
register: command_output

0 comments on commit 6003466

Please sign in to comment.