forked from GENIVI/rvi_core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbackend.config
270 lines (256 loc) · 8.17 KB
/
backend.config
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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
%% -*- erlang -*-
%% Copyright (C) 2014, Jaguar Land Rover
%%
%% This program is licensed under the terms and conditions of the
%% Mozilla Public License, version 2.0. The full text of the
%% Mozilla Public License is at https://www.mozilla.org/MPL/2.0/
%%
%% Configuration file for the (in-vehicle) IVI used by the hvac_demo
%%
%% See ../hvac_demo/README.md for details on the demo.
%%
%% See ../CONFIGURE.md for a details on the configuration process
%% itself.
%%
[
%% All erlang apps needed to fire up a node. Do not touch.
{apps,
[kernel,
stdlib,
sasl,
{setup, load},
syntax_tools,
lager,
crypto,
public_key,
exo,
compiler,
ssl,
asn1,
wse,
%% RVI-specific apps.
%% Do not touch unless you are replacing apps with your own
%% version. If you are replacing an app with a non-Erlang version,
%% it still has to be loaded in order to resolve.
%% If, for example, you want to deploy your own scheduler
%% outside Erlang, replace
%%
%% schedule,
%% with
%% { schedule, load },
%%
rvi,
rvi_common,
service_edge,
service_discovery,
authorize,
schedule,
data_link_bert_rpc,
protocol ]},
%%
%% Custom environment settings
%% for all apps running on the node.
%%
{env,
[
%% Lager is the main logging mechanism.
%% See https://github.com/basho/lager for details.
%%
{lager,
[ { handlers,
%% Change this to debug, info, notice, warning, or error in
%% order to lower the console chatter.
[ {lager_console_backend, notice} ]
}
]
},
%% All RVI configuration is done here.
%% Please note that the rvi_node.sh launch script
%% can still override the port range and static nodes
%% through its command line parameters.
%%
{rvi,
[
%% Specify the node address that data_link uses to listen to
%% incoming traffic from other rvi nodes.
%%
%% This is the address that is announced to
%% other rvi nodes during service discovery and should be
%% forwarded through firewalls and port forwarding to to the port
%% specified by the configuration entry rvi -> components ->
%% data_link -> bert_rpc_server (see below).
%%
%% If this node is sitting behind a firewall and cannot
%% receive incomign connections on any address, its
%% node_address should be set to "0.0.0.0:0" to inform
%% the remote node that it should not attempt to
%% connect back to self.
{ node_address, "127.0.0.1:8807" },
%% Specify the prefix of all services that this rvi node is hosting.
%%
%% All local services regsitering with service edge will be prefixed with
%% the string below when they are announced to remote rvi nodes
%% that connect to this node (using the address specified
%% by node_address above).
%%
%% If a locally connected service registers itself as
%% "hvac/fan_speed", and the node_service_prefix is
%% "jlr.com/vin/1234/", this node will announce the service
%% "jlr.com/vin/1234/hvac/fan_speed" as being available
%% to remotely connected rvi nodes.
%%
%% Two rvi nodes should never have the same node_service_prefix
%% value unless all services add a system-wide unique name
%% to it.
%%
{ node_service_prefix, "jlr.com/backend"},
%% Specify static service prefixes with well known addresses
%%
%% Static nodes allows a local RVI node to route services with
%% matching prefixes to a well known address of a remote node. A
%% static node is often a backend/cloud server that is assumed to
%% be found at a given address as soon as network connectivity
%% has been established.
%%
%% When a locally connected service issues a message or rpc to a
%% service, and the network address of the service cannot be
%% found in the tables maintained by the peer-to-peer service
%% discovery process, the static nodes table below is scanned as
%% to prefix match the service and locate a suitable network
%% address.
%%
{ static_nodes,
[
%% No static nodes here.
]
},
{ routing_rules,
[
%% Service name prefix that rules are specified for
{ "jlr.com/backend/",
%% Which protocol and data link pair to use when transmitting the message
%% to the targeted service. If a pair reports a failure, the next pair is tried.
[
{ bert_rpc, wifi },
{ bert_rpc, device_3g },
{ bert_rpc, device_sms },
{ joynr, wifi },
{ joynr, device_sms }
]
},
%% Used to communicate with vehicles
{ "jlr.com/vin/",
{ bert_rpc, wifi },
%% server_3g is augmented with hinting, provided to
{ bert_rpc, { server_3g, [ initiate_outbound ]} },
%% Protocols can have hinting as well.
%% In this case bert_rpc should only be used if the
%% resulting message size can fit in an SMS (140 bytes).
{ { bert_rpc, [ { max_msg_size, 140 } ] } , server_sms }
}
]
},
{ components,
[
%% A note about JSON-RPC calls vs gen_server calls:
%%
%% All locally connected services communicate with Service Edge
%% through JSON-RPC, as specified below.
%%
%% Communication between the RVi components, however, can be
%% either JSON-RPC or gen_server calls.
%%
%% JSON-RPC calls provide compatability with replacement components
%% written in languages other than Erlang.
%%
%% Gen_server calls provide native erlang inter-process calls that
%% are about 4x faster than JSON-RPC when transmitting large data volumes.
%%
%% If one or more of the components below are replaced with external
%% components, use JSON-RPC by specifying url and exo_http_opts
%% for all components.
%%
%% If you are running an all-native erlang system, use gen_server calls
%% by configuring gen_server.
%%
%% If you specify both gen_server and url/exo_http_opts, the gen_server
%% communicaiton path will be used for inter component communication.
%%
%% Please note that communication between two RVI nodes are
%% not affected by this since data_link_bert_rpc will use
%% BERT-RPC to communicate ( using the address/port specified
%% by bert_rpc_server).
%%
{ service_edge,
%% This is the URL that local services use to connect to
%% the RVI system. It is also used by
%% the other components below to send inter-compoonent
%% JSON-RPC calls to the service edge.
%%
%% For this component url and exo_http_opts should always be specified
%% so that local services have a HTTP port to connect to.
%%
%% gen_server can also be specified to enable faster, native erlang
%% inter compojnent communication.
%%
%% The host and address given in URL should route to the port given
%% in exo_http_opts below.
%%
%% The web socket integrates with the rvi.js javascript code
%% that connects Tizen IVI to the RVI system.
[
{ gen_server, service_edge_rpc },
{ url, "http://127.0.0.1:8801" },
{ exo_http_opts, [ { port, 8801 } ] },
{ websocket, [ { port, 8808}]}
]
},
{ service_discovery,
[
%% In this sample file, we turn on both JSON-RPC and
%% gen_server calls. Normally, one of the two are
%% commented out.
{ gen_server, service_discovery_rpc },
{ url, "http://127.0.0.1:8802" },
{ exo_http_opts, [ { port, 8802 } ] }
]
},
{ schedule,
[
%% For obscure reasons, the gen_server component
%% here is just called schedule, not schedule_rpc
{ gen_server, schedule },
{ url, "http://127.0.0.1:8803" },
{ exo_http_opts, [ { port, 8803 } ] }
]
},
{ authorize,
[
{ gen_server, authorize_rpc },
{ url, "http://127.0.0.1:8804" },
{ exo_http_opts, [ { port, 8804 } ] }
]
},
{ protocol,
[
{ gen_server, protocol_rpc },
{ url, "http://127.0.0.1:8805" },
{ exo_http_opts, [ { port, 8805 } ] }
]
},
{ data_link,
[
{ gen_server, data_link_bert_rpc_rpc },
{ url, "http://127.0.0.1:8806" },
{ exo_http_opts, [ { port, 8806 } ] },
%% The bert_rpc_server port will be used to listen to incoming
%% traffic from remote nodes.
%% Must match the port given in node_address
{ bert_rpc_server, [ {port, 8807 }]}
]
}
]
}
]}
]}
].