forked from fonoster/routr
-
Notifications
You must be signed in to change notification settings - Fork 0
/
nattests.yml
142 lines (141 loc) · 3.68 KB
/
nattests.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
version: '3.7'
services:
redis:
image: redis:4.0.5-alpine
command: ["redis-server", "--appendonly", "yes"]
expose: [6379]
networks:
public_net:
ipv4_address: $REDIS_PUBLIC_IP
private_net:
ipv4_address: $REDIS_PRIVATE_IP
proxy_a:
links:
- "phone_s1:sip.provider.net"
- "phone_s2:sip.provider.net"
build:
context: .
image: fonoster/routr:latest
entrypoint: sh -c 'while ! nc -z redis 6379; do sleep 0.1; done && ./routr'
environment:
ROUTR_EXTERN_ADDR: $PROXY_A_PUBLIC_IP
ROUTR_DS_PROVIDER: redis_data_provider
ROUTR_DS_PARAMETERS: host=redis,port=6379
expose: [4567, 5060]
networks:
public_net:
ipv4_address: $PROXY_A_PUBLIC_IP
private_net:
ipv4_address: $PROXY_A_PRIVATE_IP
proxy_b:
links:
- "phone_s1:sip.provider.net"
- "phone_s2:sip.provider.net"
build:
context: .
image: fonoster/routr:latest
entrypoint: sh -c 'while ! nc -z redis 6379; do sleep 0.1; done && ./routr'
environment:
ROUTR_EXTERN_ADDR: $PROXY_B_PUBLIC_IP
ROUTR_DS_PROVIDER: redis_data_provider
ROUTR_DS_PARAMETERS: host=redis,port=6379
expose: [4567, 5060]
networks:
public_net:
ipv4_address: $PROXY_B_PUBLIC_IP
phone_e1:
env_file: .env
image: fonoster/routr-eet:latest
expose: [5060, 9330]
networks:
private_net:
ipv4_address: $PHONE_E1_IP
entrypoint: |
sh -c '
while ! nc -z $PROXY_A_PRIVATE_IP 4567; do sleep 0.1; done
node eet/ua_srv.js
'
phone_e2:
env_file: .env
image: fonoster/routr-eet:latest
expose: [5060, 9330]
networks:
private_net:
ipv4_address: $PHONE_E2_IP
entrypoint: |
sh -c '
while ! nc -z $PROXY_A_PRIVATE_IP 4567; do sleep 0.1; done
node eet/ua_srv.js
'
phone_e3:
env_file: .env
image: fonoster/routr-eet:latest
expose: [5060]
networks:
public_net:
ipv4_address: $PHONE_E3_IP
phone_e4:
env_file: .env
image: fonoster/routr-eet:latest
expose: [5060, 9330]
networks:
public_net:
ipv4_address: $PHONE_E4_IP
phone_s1:
env_file: .env
image: fonoster/routr-eet:latest
expose: [5060, 9330]
networks:
public_net:
ipv4_address: $PHONE_S1_IP
phone_s2:
env_file: .env
image: fonoster/routr-eet:latest
expose: [5060, 9330]
networks:
public_net:
ipv4_address: $PHONE_S2_IP
provisioner:
build:
context: .rctl
entrypoint: |
sh -c '
while ! nc -z routr 4567; do sleep 0.1; done
proxies=( proxy_a proxy_b)
for p in "${proxies[@]}"
do:
rctl login https://$p:4567/api/v1beta1 -u admin -p changeit
rctl create -f /opt/routr/config/gateways.yml
rctl create -f /opt/routr/config/numbers.yml
rctl create -f /opt/routr/config/domains.yml
rctl create -f /opt/routr/config/agents.yml
done
while sleep 3600; do :; done
'
volumes:
- ./config:/opt/routr/config:ro
controller:
env_file: .env
image: fonoster/routr-eet:latest
networks:
public_net:
ipv4_address: $CONTROLLER_PUBLIC_IP
private_net:
ipv4_address: $CONTROLLER_PRIVATE_IP
entrypoint: |
sh -c '
while ! nc -z $PHONE_E1_IP $UA_SRV_DEFAULT_PORT; do sleep 0.1; done
while ! nc -z $PHONE_E2_IP $UA_SRV_DEFAULT_PORT; do sleep 0.1; done
node eet/ua_ctl.js
'
networks:
public_net:
driver: "bridge"
ipam:
config:
- subnet: $PUBLIC_NET_SUBNET
private_net:
driver: "bridge"
ipam:
config:
- subnet: $PRIVATE_NET_SUBNET