infinispan 0.14.0 → 0.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.githooks/commit-msg +9 -0
- package/.githooks/configure-hooks +7 -0
- package/.githooks/configure-hooks.bat +15 -0
- package/.gitmessage +7 -0
- package/AI-CODE.md +86 -0
- package/README.md +53 -75
- package/SECURITY.md +27 -0
- package/lib/codec.js +50 -1
- package/lib/functional.js +25 -0
- package/lib/infinispan.js +299 -18
- package/lib/io.js +3 -1
- package/lib/listeners.js +116 -2
- package/lib/protocols.js +168 -20
- package/lib/transaction.js +123 -0
- package/lib/uri.js +206 -0
- package/package.json +8 -3
- package/server/.keep +0 -0
- package/types/index.d.ts +44 -0
- package/Dockerfile.server +0 -8
- package/docker-compose.yml +0 -272
- package/gen-asciidoc.sh +0 -46
- package/run-docker-testsuite.sh +0 -72
package/types/index.d.ts
CHANGED
|
@@ -1,3 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Connect to an Infinispan Server using a Hot Rod URI.
|
|
3
|
+
*
|
|
4
|
+
* URI format: hotrod://[user:pass@]host1[:port1][,host2[:port2]][?params]
|
|
5
|
+
* Use hotrods:// to enable TLS.
|
|
6
|
+
*
|
|
7
|
+
* Supported query parameters:
|
|
8
|
+
* sasl_mechanism, trust_store_file_name (alias trust_ca),
|
|
9
|
+
* key_store_file_name (alias client_cert), key_store_password (alias client_key),
|
|
10
|
+
* sni_host_name (alias sni_host), max_retries, cache_name.
|
|
11
|
+
*
|
|
12
|
+
* @param uri Hot Rod URI string.
|
|
13
|
+
* @param options Optional overrides (take precedence over URI values).
|
|
14
|
+
*/
|
|
15
|
+
export function client(uri: string, options?: Record<string, any>): Promise<any>;
|
|
16
|
+
|
|
1
17
|
export function client(args: {
|
|
2
18
|
/**
|
|
3
19
|
* - Server host name.
|
|
@@ -668,6 +684,34 @@ export function client(args: {
|
|
|
668
684
|
* @since 0.3
|
|
669
685
|
*/
|
|
670
686
|
removeListener: (listenerId: string) => Promise<any>;
|
|
687
|
+
/**
|
|
688
|
+
* Register a continuous query that watches for cache changes
|
|
689
|
+
* matching the given Ickle query.
|
|
690
|
+
*
|
|
691
|
+
* @param queryString Ickle query string.
|
|
692
|
+
* @param opts Optional CQ options.
|
|
693
|
+
* @returns A promise completed with a ContinuousQuery handle.
|
|
694
|
+
* @memberof Client#
|
|
695
|
+
* @since 0.16
|
|
696
|
+
*/
|
|
697
|
+
addContinuousQuery: (queryString: string, opts?: {
|
|
698
|
+
/** Named parameter bindings for the Ickle query. */
|
|
699
|
+
params?: { [name: string]: string | number | boolean };
|
|
700
|
+
}) => Promise<{
|
|
701
|
+
/** Register a callback for continuous query events. */
|
|
702
|
+
on(event: 'joining' | 'leaving' | 'updated', callback: (key: Buffer, value: Buffer, projection?: any[]) => void): any;
|
|
703
|
+
/** Get the listener ID for this continuous query. */
|
|
704
|
+
getListenerId(): string;
|
|
705
|
+
}>;
|
|
706
|
+
/**
|
|
707
|
+
* Remove a continuous query.
|
|
708
|
+
*
|
|
709
|
+
* @param cq ContinuousQuery handle returned by addContinuousQuery.
|
|
710
|
+
* @returns A promise completed when the continuous query has been removed.
|
|
711
|
+
* @memberof Client#
|
|
712
|
+
* @since 0.16
|
|
713
|
+
*/
|
|
714
|
+
removeContinuousQuery: (cq: { getListenerId(): string }) => Promise<any>;
|
|
671
715
|
/**
|
|
672
716
|
* Create a distributed counter.
|
|
673
717
|
*
|
package/Dockerfile.server
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
FROM quay.io/infinispan/server:16.1.3
|
|
2
|
-
|
|
3
|
-
# Install Nashorn script engine for server-side JavaScript execution
|
|
4
|
-
RUN /opt/infinispan/bin/cli.sh install org.openjdk.nashorn:nashorn-core:15.4 && \
|
|
5
|
-
/opt/infinispan/bin/cli.sh install org.ow2.asm:asm:9.4 && \
|
|
6
|
-
/opt/infinispan/bin/cli.sh install org.ow2.asm:asm-commons:9.4 && \
|
|
7
|
-
/opt/infinispan/bin/cli.sh install org.ow2.asm:asm-tree:9.4 && \
|
|
8
|
-
/opt/infinispan/bin/cli.sh install org.ow2.asm:asm-util:9.4
|
package/docker-compose.yml
DELETED
|
@@ -1,272 +0,0 @@
|
|
|
1
|
-
services:
|
|
2
|
-
# Standalone server for local tests
|
|
3
|
-
server-local:
|
|
4
|
-
build:
|
|
5
|
-
context: .
|
|
6
|
-
dockerfile: Dockerfile.server
|
|
7
|
-
container_name: ispn-local
|
|
8
|
-
hostname: server-local
|
|
9
|
-
volumes:
|
|
10
|
-
- ./spec/configs/infinispan.xml:/opt/infinispan/server/conf/infinispan.xml:ro
|
|
11
|
-
environment:
|
|
12
|
-
USER: admin
|
|
13
|
-
PASS: pass
|
|
14
|
-
JAVA_OPTIONS: >-
|
|
15
|
-
-Dinfinispan.bind.address=0.0.0.0
|
|
16
|
-
healthcheck:
|
|
17
|
-
test: ["CMD-SHELL", "curl -sf -u admin:pass http://localhost:11222/rest/v2/cache-managers/default/health/status || exit 1"]
|
|
18
|
-
start_period: 30s
|
|
19
|
-
interval: 5s
|
|
20
|
-
timeout: 5s
|
|
21
|
-
retries: 30
|
|
22
|
-
networks:
|
|
23
|
-
ispn:
|
|
24
|
-
|
|
25
|
-
# Cluster nodes (3-node)
|
|
26
|
-
server-one:
|
|
27
|
-
build:
|
|
28
|
-
context: .
|
|
29
|
-
dockerfile: Dockerfile.server
|
|
30
|
-
container_name: ispn-cluster-1
|
|
31
|
-
hostname: server-one
|
|
32
|
-
volumes:
|
|
33
|
-
- ./spec/configs/docker/infinispan-clustered.xml:/opt/infinispan/server/conf/infinispan.xml:ro
|
|
34
|
-
environment:
|
|
35
|
-
USER: admin
|
|
36
|
-
PASS: pass
|
|
37
|
-
JAVA_OPTIONS: >-
|
|
38
|
-
-Dinfinispan.bind.address=0.0.0.0
|
|
39
|
-
-Dinfinispan.node.name=server-one
|
|
40
|
-
-Djgroups.dns.query=cluster-dns-ping
|
|
41
|
-
healthcheck:
|
|
42
|
-
test: ["CMD-SHELL", "curl -sf -u admin:pass http://localhost:11222/rest/v2/cache-managers/clustered/health/status || exit 1"]
|
|
43
|
-
start_period: 30s
|
|
44
|
-
interval: 5s
|
|
45
|
-
timeout: 5s
|
|
46
|
-
retries: 30
|
|
47
|
-
networks:
|
|
48
|
-
ispn:
|
|
49
|
-
aliases:
|
|
50
|
-
- cluster-dns-ping
|
|
51
|
-
|
|
52
|
-
server-two:
|
|
53
|
-
build:
|
|
54
|
-
context: .
|
|
55
|
-
dockerfile: Dockerfile.server
|
|
56
|
-
container_name: ispn-cluster-2
|
|
57
|
-
hostname: server-two
|
|
58
|
-
volumes:
|
|
59
|
-
- ./spec/configs/docker/infinispan-clustered.xml:/opt/infinispan/server/conf/infinispan.xml:ro
|
|
60
|
-
environment:
|
|
61
|
-
USER: admin
|
|
62
|
-
PASS: pass
|
|
63
|
-
JAVA_OPTIONS: >-
|
|
64
|
-
-Dinfinispan.bind.address=0.0.0.0
|
|
65
|
-
-Dinfinispan.node.name=server-two
|
|
66
|
-
-Djgroups.dns.query=cluster-dns-ping
|
|
67
|
-
healthcheck:
|
|
68
|
-
test: ["CMD-SHELL", "curl -sf -u admin:pass http://localhost:11222/rest/v2/cache-managers/clustered/health/status || exit 1"]
|
|
69
|
-
start_period: 30s
|
|
70
|
-
interval: 5s
|
|
71
|
-
timeout: 5s
|
|
72
|
-
retries: 30
|
|
73
|
-
networks:
|
|
74
|
-
ispn:
|
|
75
|
-
aliases:
|
|
76
|
-
- cluster-dns-ping
|
|
77
|
-
|
|
78
|
-
server-three:
|
|
79
|
-
build:
|
|
80
|
-
context: .
|
|
81
|
-
dockerfile: Dockerfile.server
|
|
82
|
-
container_name: ispn-cluster-3
|
|
83
|
-
hostname: server-three
|
|
84
|
-
volumes:
|
|
85
|
-
- ./spec/configs/docker/infinispan-clustered.xml:/opt/infinispan/server/conf/infinispan.xml:ro
|
|
86
|
-
environment:
|
|
87
|
-
USER: admin
|
|
88
|
-
PASS: pass
|
|
89
|
-
JAVA_OPTIONS: >-
|
|
90
|
-
-Dinfinispan.bind.address=0.0.0.0
|
|
91
|
-
-Dinfinispan.node.name=server-three
|
|
92
|
-
-Djgroups.dns.query=cluster-dns-ping
|
|
93
|
-
healthcheck:
|
|
94
|
-
test: ["CMD-SHELL", "curl -sf -u admin:pass http://localhost:11222/rest/v2/cache-managers/clustered/health/status || exit 1"]
|
|
95
|
-
start_period: 30s
|
|
96
|
-
interval: 5s
|
|
97
|
-
timeout: 5s
|
|
98
|
-
retries: 30
|
|
99
|
-
networks:
|
|
100
|
-
ispn:
|
|
101
|
-
aliases:
|
|
102
|
-
- cluster-dns-ping
|
|
103
|
-
|
|
104
|
-
# SSL server
|
|
105
|
-
server-ssl:
|
|
106
|
-
build:
|
|
107
|
-
context: .
|
|
108
|
-
dockerfile: Dockerfile.server
|
|
109
|
-
container_name: ispn-ssl
|
|
110
|
-
hostname: server-ssl
|
|
111
|
-
volumes:
|
|
112
|
-
- ./spec/configs/infinispan-ssl.xml:/opt/infinispan/server/conf/infinispan.xml:ro
|
|
113
|
-
- ./out/ssl/server/server.p12:/opt/infinispan/server/conf/server.p12:ro
|
|
114
|
-
- ./out/ssl/client/client.p12:/opt/infinispan/server/conf/client.p12:ro
|
|
115
|
-
- ./out/ssl/sni-trust1/trust1.p12:/opt/infinispan/server/conf/trust1.p12:ro
|
|
116
|
-
- ./out/ssl/sni-trust2/trust2.p12:/opt/infinispan/server/conf/trust2.p12:ro
|
|
117
|
-
- ./out/ssl/sni-untrust/untrust.p12:/opt/infinispan/server/conf/untrust.p12:ro
|
|
118
|
-
environment:
|
|
119
|
-
USER: admin
|
|
120
|
-
PASS: pass
|
|
121
|
-
JAVA_OPTIONS: >-
|
|
122
|
-
-Dinfinispan.bind.address=0.0.0.0
|
|
123
|
-
-Dorg.infinispan.openssl=false
|
|
124
|
-
healthcheck:
|
|
125
|
-
test: ["CMD-SHELL", "curl -sf -k -u admin:pass https://localhost:11622/rest/v2/cache-managers/local/health/status || exit 1"]
|
|
126
|
-
start_period: 30s
|
|
127
|
-
interval: 5s
|
|
128
|
-
timeout: 5s
|
|
129
|
-
retries: 30
|
|
130
|
-
networks:
|
|
131
|
-
ispn:
|
|
132
|
-
|
|
133
|
-
# Failover cluster nodes (started on demand by tests)
|
|
134
|
-
server-failover-one:
|
|
135
|
-
build:
|
|
136
|
-
context: .
|
|
137
|
-
dockerfile: Dockerfile.server
|
|
138
|
-
container_name: ispn-failover-1
|
|
139
|
-
hostname: server-failover-one
|
|
140
|
-
profiles: ["failover"]
|
|
141
|
-
volumes:
|
|
142
|
-
- ./spec/configs/docker/infinispan-clustered.xml:/opt/infinispan/server/conf/infinispan.xml:ro
|
|
143
|
-
environment:
|
|
144
|
-
USER: admin
|
|
145
|
-
PASS: pass
|
|
146
|
-
JAVA_OPTIONS: >-
|
|
147
|
-
-Dinfinispan.bind.address=0.0.0.0
|
|
148
|
-
-Dinfinispan.node.name=server-failover-one
|
|
149
|
-
-Djgroups.dns.query=failover-dns-ping
|
|
150
|
-
healthcheck:
|
|
151
|
-
test: ["CMD-SHELL", "curl -sf -u admin:pass http://localhost:11222/rest/v2/cache-managers/clustered/health/status || exit 1"]
|
|
152
|
-
start_period: 30s
|
|
153
|
-
interval: 5s
|
|
154
|
-
timeout: 5s
|
|
155
|
-
retries: 30
|
|
156
|
-
networks:
|
|
157
|
-
ispn:
|
|
158
|
-
aliases:
|
|
159
|
-
- failover-dns-ping
|
|
160
|
-
|
|
161
|
-
server-failover-two:
|
|
162
|
-
build:
|
|
163
|
-
context: .
|
|
164
|
-
dockerfile: Dockerfile.server
|
|
165
|
-
container_name: ispn-failover-2
|
|
166
|
-
hostname: server-failover-two
|
|
167
|
-
profiles: ["failover"]
|
|
168
|
-
volumes:
|
|
169
|
-
- ./spec/configs/docker/infinispan-clustered.xml:/opt/infinispan/server/conf/infinispan.xml:ro
|
|
170
|
-
environment:
|
|
171
|
-
USER: admin
|
|
172
|
-
PASS: pass
|
|
173
|
-
JAVA_OPTIONS: >-
|
|
174
|
-
-Dinfinispan.bind.address=0.0.0.0
|
|
175
|
-
-Dinfinispan.node.name=server-failover-two
|
|
176
|
-
-Djgroups.dns.query=failover-dns-ping
|
|
177
|
-
healthcheck:
|
|
178
|
-
test: ["CMD-SHELL", "curl -sf -u admin:pass http://localhost:11222/rest/v2/cache-managers/clustered/health/status || exit 1"]
|
|
179
|
-
start_period: 30s
|
|
180
|
-
interval: 5s
|
|
181
|
-
timeout: 5s
|
|
182
|
-
retries: 30
|
|
183
|
-
networks:
|
|
184
|
-
ispn:
|
|
185
|
-
aliases:
|
|
186
|
-
- failover-dns-ping
|
|
187
|
-
|
|
188
|
-
server-failover-three:
|
|
189
|
-
build:
|
|
190
|
-
context: .
|
|
191
|
-
dockerfile: Dockerfile.server
|
|
192
|
-
container_name: ispn-failover-3
|
|
193
|
-
hostname: server-failover-three
|
|
194
|
-
profiles: ["failover"]
|
|
195
|
-
volumes:
|
|
196
|
-
- ./spec/configs/docker/infinispan-clustered.xml:/opt/infinispan/server/conf/infinispan.xml:ro
|
|
197
|
-
environment:
|
|
198
|
-
USER: admin
|
|
199
|
-
PASS: pass
|
|
200
|
-
JAVA_OPTIONS: >-
|
|
201
|
-
-Dinfinispan.bind.address=0.0.0.0
|
|
202
|
-
-Dinfinispan.node.name=server-failover-three
|
|
203
|
-
-Djgroups.dns.query=failover-dns-ping
|
|
204
|
-
healthcheck:
|
|
205
|
-
test: ["CMD-SHELL", "curl -sf -u admin:pass http://localhost:11222/rest/v2/cache-managers/clustered/health/status || exit 1"]
|
|
206
|
-
start_period: 30s
|
|
207
|
-
interval: 5s
|
|
208
|
-
timeout: 5s
|
|
209
|
-
retries: 30
|
|
210
|
-
networks:
|
|
211
|
-
ispn:
|
|
212
|
-
aliases:
|
|
213
|
-
- failover-dns-ping
|
|
214
|
-
|
|
215
|
-
# Cross-site replication servers
|
|
216
|
-
server-earth:
|
|
217
|
-
build:
|
|
218
|
-
context: .
|
|
219
|
-
dockerfile: Dockerfile.server
|
|
220
|
-
container_name: ispn-earth
|
|
221
|
-
hostname: server-earth
|
|
222
|
-
volumes:
|
|
223
|
-
- ./spec/configs/docker/infinispan-xsite-EARTH.xml:/opt/infinispan/server/conf/infinispan.xml:ro
|
|
224
|
-
environment:
|
|
225
|
-
USER: admin
|
|
226
|
-
PASS: pass
|
|
227
|
-
JAVA_OPTIONS: >-
|
|
228
|
-
-Dinfinispan.bind.address=0.0.0.0
|
|
229
|
-
-Dinfinispan.node.name=server-earth
|
|
230
|
-
-Djgroups.dns.query=earth-dns-ping
|
|
231
|
-
-Djgroups.bridge.hosts=server-earth[7800],server-moon[7800]
|
|
232
|
-
healthcheck:
|
|
233
|
-
test: ["CMD-SHELL", "curl -sf -u admin:pass http://localhost:11222/rest/v2/cache-managers/clustered/health/status || exit 1"]
|
|
234
|
-
start_period: 30s
|
|
235
|
-
interval: 5s
|
|
236
|
-
timeout: 5s
|
|
237
|
-
retries: 30
|
|
238
|
-
networks:
|
|
239
|
-
ispn:
|
|
240
|
-
aliases:
|
|
241
|
-
- earth-dns-ping
|
|
242
|
-
|
|
243
|
-
server-moon:
|
|
244
|
-
build:
|
|
245
|
-
context: .
|
|
246
|
-
dockerfile: Dockerfile.server
|
|
247
|
-
container_name: ispn-moon
|
|
248
|
-
hostname: server-moon
|
|
249
|
-
volumes:
|
|
250
|
-
- ./spec/configs/docker/infinispan-xsite-MOON.xml:/opt/infinispan/server/conf/infinispan.xml:ro
|
|
251
|
-
environment:
|
|
252
|
-
USER: admin
|
|
253
|
-
PASS: pass
|
|
254
|
-
JAVA_OPTIONS: >-
|
|
255
|
-
-Dinfinispan.bind.address=0.0.0.0
|
|
256
|
-
-Dinfinispan.node.name=server-moon
|
|
257
|
-
-Djgroups.dns.query=moon-dns-ping
|
|
258
|
-
-Djgroups.bridge.hosts=server-earth[7800],server-moon[7800]
|
|
259
|
-
healthcheck:
|
|
260
|
-
test: ["CMD-SHELL", "curl -sf -u admin:pass http://localhost:11222/rest/v2/cache-managers/clustered/health/status || exit 1"]
|
|
261
|
-
start_period: 30s
|
|
262
|
-
interval: 5s
|
|
263
|
-
timeout: 5s
|
|
264
|
-
retries: 30
|
|
265
|
-
networks:
|
|
266
|
-
ispn:
|
|
267
|
-
aliases:
|
|
268
|
-
- moon-dns-ping
|
|
269
|
-
|
|
270
|
-
networks:
|
|
271
|
-
ispn:
|
|
272
|
-
driver: bridge
|
package/gen-asciidoc.sh
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
|
|
3
|
-
# Generates HTML documentation from AsciiDoc sources.
|
|
4
|
-
# Mirrors the asciidoctor-maven-plugin configuration used by
|
|
5
|
-
# the main Infinispan documentation build (documentation/pom.xml).
|
|
6
|
-
|
|
7
|
-
set -e
|
|
8
|
-
|
|
9
|
-
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
10
|
-
SRC_DIR="${SCRIPT_DIR}/documentation/asciidoc"
|
|
11
|
-
OUT_DIR="${SCRIPT_DIR}/out/docs"
|
|
12
|
-
|
|
13
|
-
mkdir -p "${OUT_DIR}"
|
|
14
|
-
|
|
15
|
-
asciidoctor \
|
|
16
|
-
--doctype book \
|
|
17
|
-
--backend html5 \
|
|
18
|
-
--safe-mode unsafe \
|
|
19
|
-
-a idprefix="" \
|
|
20
|
-
-a idseparator="-" \
|
|
21
|
-
-a sectanchors \
|
|
22
|
-
-a toc=left \
|
|
23
|
-
-a toclevels=3 \
|
|
24
|
-
-a numbered \
|
|
25
|
-
-a icons=font \
|
|
26
|
-
-a experimental \
|
|
27
|
-
-a source-highlighter=highlight.js \
|
|
28
|
-
-a highlightjs-theme=github \
|
|
29
|
-
-a imagesdir=../../topics/images \
|
|
30
|
-
-a stories=../stories \
|
|
31
|
-
-a topics=../topics \
|
|
32
|
-
-a community \
|
|
33
|
-
-a brandname=Infinispan \
|
|
34
|
-
-a fullbrandname=Infinispan \
|
|
35
|
-
-a brandshortname=infinispan \
|
|
36
|
-
-a hr_js="Hot Rod JS" \
|
|
37
|
-
-a doc_home=https://infinispan.org/documentation/ \
|
|
38
|
-
-a download_url=https://infinispan.org/download/ \
|
|
39
|
-
-a node_docs=https://docs.jboss.org/infinispan/hotrod-clients/javascript/1.0/apidocs/ \
|
|
40
|
-
-a server_docs=https://infinispan.org/docs/stable/titles/server/server.html \
|
|
41
|
-
-a code_tutorials=https://github.com/infinispan/infinispan-simple-tutorials/ \
|
|
42
|
-
-a query_docs=https://infinispan.org/docs/stable/titles/query/query.html \
|
|
43
|
-
-o "${OUT_DIR}/index.html" \
|
|
44
|
-
"${SRC_DIR}/titles/js_client.asciidoc"
|
|
45
|
-
|
|
46
|
-
echo "Documentation generated: ${OUT_DIR}/index.html"
|
package/run-docker-testsuite.sh
DELETED
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
|
|
3
|
-
set -e
|
|
4
|
-
|
|
5
|
-
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
6
|
-
cd "$SCRIPT_DIR"
|
|
7
|
-
|
|
8
|
-
COMPOSE_PROJECT="ispn-test"
|
|
9
|
-
|
|
10
|
-
# Always tear down on exit
|
|
11
|
-
cleanup() {
|
|
12
|
-
echo "Tearing down Docker containers..."
|
|
13
|
-
docker compose -p "$COMPOSE_PROJECT" --profile failover down --remove-orphans 2>/dev/null || true
|
|
14
|
-
}
|
|
15
|
-
trap cleanup EXIT
|
|
16
|
-
|
|
17
|
-
# ── Step 1: Generate SSL certificates if needed ─────────────────────────
|
|
18
|
-
if [ ! -f "out/ssl/server/server.p12" ]; then
|
|
19
|
-
echo "Generating SSL certificates..."
|
|
20
|
-
./make-ssl.sh
|
|
21
|
-
fi
|
|
22
|
-
|
|
23
|
-
# ── Step 2: Start containers ────────────────────────────────────────────
|
|
24
|
-
echo "Starting Infinispan containers..."
|
|
25
|
-
docker compose -p "$COMPOSE_PROJECT" up -d --wait
|
|
26
|
-
docker compose -p "$COMPOSE_PROJECT" --profile failover create server-failover-one server-failover-two server-failover-three
|
|
27
|
-
|
|
28
|
-
# ── Step 3: Detect container IPs ────────────────────────────────────────
|
|
29
|
-
get_container_ip() {
|
|
30
|
-
docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' "$1"
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export ISPN_LOCAL_HOST=$(get_container_ip ispn-local)
|
|
34
|
-
export ISPN_CLUSTER1_HOST=$(get_container_ip ispn-cluster-1)
|
|
35
|
-
export ISPN_CLUSTER2_HOST=$(get_container_ip ispn-cluster-2)
|
|
36
|
-
export ISPN_CLUSTER3_HOST=$(get_container_ip ispn-cluster-3)
|
|
37
|
-
export ISPN_SSL_HOST=$(get_container_ip ispn-ssl)
|
|
38
|
-
export ISPN_EARTH_HOST=$(get_container_ip ispn-earth)
|
|
39
|
-
export ISPN_MOON_HOST=$(get_container_ip ispn-moon)
|
|
40
|
-
export ISPN_FAILOVER1_HOST=$(get_container_ip ispn-failover-1)
|
|
41
|
-
export ISPN_FAILOVER2_HOST=$(get_container_ip ispn-failover-2)
|
|
42
|
-
export ISPN_FAILOVER3_HOST=$(get_container_ip ispn-failover-3)
|
|
43
|
-
export ISPN_DOCKER=true
|
|
44
|
-
|
|
45
|
-
echo "Container IPs:"
|
|
46
|
-
echo " local: $ISPN_LOCAL_HOST"
|
|
47
|
-
echo " cluster: $ISPN_CLUSTER1_HOST, $ISPN_CLUSTER2_HOST, $ISPN_CLUSTER3_HOST"
|
|
48
|
-
echo " ssl: $ISPN_SSL_HOST"
|
|
49
|
-
echo " failover: $ISPN_FAILOVER1_HOST, $ISPN_FAILOVER2_HOST, $ISPN_FAILOVER3_HOST"
|
|
50
|
-
echo " earth: $ISPN_EARTH_HOST"
|
|
51
|
-
echo " moon: $ISPN_MOON_HOST"
|
|
52
|
-
|
|
53
|
-
# ── Step 4: Wait for cluster to form ────────────────────────────────────
|
|
54
|
-
echo "Waiting for cluster to form..."
|
|
55
|
-
MAX_RETRIES=30
|
|
56
|
-
for i in $(seq 1 $MAX_RETRIES); do
|
|
57
|
-
CLUSTER_SIZE=$(curl -sf --digest -u admin:pass "http://$ISPN_CLUSTER1_HOST:11222/rest/v2/container" 2>/dev/null | python3 -c "import sys,json; print(json.load(sys.stdin).get('cluster_size',0))" 2>/dev/null || echo "0")
|
|
58
|
-
if [ "$CLUSTER_SIZE" = "3" ]; then
|
|
59
|
-
echo "Cluster formed with 3 nodes."
|
|
60
|
-
break
|
|
61
|
-
fi
|
|
62
|
-
if [ "$i" = "$MAX_RETRIES" ]; then
|
|
63
|
-
echo "ERROR: Cluster did not form within timeout (size=$CLUSTER_SIZE)"
|
|
64
|
-
exit 1
|
|
65
|
-
fi
|
|
66
|
-
echo " Cluster size: $CLUSTER_SIZE (attempt $i/$MAX_RETRIES)"
|
|
67
|
-
sleep 5
|
|
68
|
-
done
|
|
69
|
-
|
|
70
|
-
# ── Step 5: Run tests ──────────────────────────────────────────────────
|
|
71
|
-
echo "Running tests..."
|
|
72
|
-
npx jasmine "$@"
|