@@ -97,6 +97,9 @@ external_network:
97
97
--driver=bridge \
98
98
--gateway=203.0.113.1 \
99
99
--subnet=203.0.113.0/24 \
100
+ --ipv6 \
101
+ --gateway=2001:db8:1::1 \
102
+ --subnet=2001:db8:1::/64 \
100
103
--opt "com.docker.network.driver.mtu=9000" \
101
104
--opt "com.docker.network.bridge.name=mini_lab_ext" \
102
105
--opt "com.docker.network.bridge.enable_ip_masquerade=true" && \
@@ -134,11 +137,11 @@ _public_ips: env
134
137
135
138
.PHONY : machine
136
139
machine : _privatenet _public_ips
137
- docker compose run $(DOCKER_COMPOSE_TTY_ARG ) metalctl machine create --description test --name test --hostname test --project 00000000-0000-0000-0000-000000000001 --partition mini-lab --image $(MACHINE_OS ) --size v1-small-x86 --userdata " @/tmp/ignition.json" --ips 203.0.113.130 -- networks internet-mini-lab, $(shell docker compose run $(DOCKER_COMPOSE_TTY_ARG ) metalctl network list --name user-private-network -o template --template '{{ .id }}')
140
+ docker compose run $(DOCKER_COMPOSE_TTY_ARG ) metalctl machine create --description test --name test --hostname test --project 00000000-0000-0000-0000-000000000001 --partition mini-lab --image $(MACHINE_OS ) --size v1-small-x86 --userdata " @/tmp/ignition.json" --networks $(shell docker compose run $(DOCKER_COMPOSE_TTY_ARG ) metalctl network list --name user-private-network -o template --template '{{ .id }}')
138
141
139
142
.PHONY : firewall
140
143
firewall : _privatenet _public_ips
141
- docker compose run $(DOCKER_COMPOSE_TTY_ARG ) metalctl firewall create --description fw --name fw --hostname fw --project 00000000-0000-0000-0000-000000000001 --partition mini-lab --image firewall-ubuntu-3.0 --size v1-small-x86 --userdata " @/tmp/ignition.json" --ips 203.0.113.129 -- firewall-rules-file=/tmp/rules.yaml --networks internet-mini-lab,$(shell docker compose run $(DOCKER_COMPOSE_TTY_ARG ) metalctl network list --name user-private-network -o template --template '{{ .id }}')
144
+ docker compose run $(DOCKER_COMPOSE_TTY_ARG ) metalctl firewall create --description fw --name fw --hostname fw --project 00000000-0000-0000-0000-000000000001 --partition mini-lab --image firewall-ubuntu-3.0 --size v1-small-x86 --userdata " @/tmp/ignition.json" --firewall-rules-file=/tmp/rules.yaml --networks internet-mini-lab,$(shell docker compose run $(DOCKER_COMPOSE_TTY_ARG ) metalctl network list --name user-private-network -o template --template '{{ .id }}')
142
145
143
146
# IPv6
144
147
.PHONY : _privatenet6
@@ -273,6 +276,47 @@ connect-to-www:
273
276
fi ; \
274
277
done
275
278
279
+ .PHONY : connect-to-www-ipv6
280
+ connect-to-www-ipv6 :
281
+ @echo " Attempting to connect to container www..."
282
+ @for i in $$(seq 1 $(MAX_RETRIES ) ) ; do \
283
+ if $( MAKE) ssh-machine COMMAND=" sudo curl --connect-timeout 1 --fail --silent http://[2001:db8:1::3]" > /dev/null 2>&1 ; then \
284
+ echo " Connected successfully" ; \
285
+ exit 0; \
286
+ else \
287
+ echo " Connection failed" ; \
288
+ if [ $$ i -lt $( MAX_RETRIES) ]; then \
289
+ echo " Retrying in 2 seconds..." ; \
290
+ sleep 2; \
291
+ else \
292
+ echo " Max retries reached" ; \
293
+ exit 1; \
294
+ fi ; \
295
+ fi ; \
296
+ done
297
+
298
+ FWIP := $(shell metalctl network ip list --name fw --network $(shell metalctl network list --name user-private-network -o template --template '{{ .id }}') -o template --template "{{ .ipaddress }}" --addressfamily IPv6 )
299
+
300
+ .PHONY : connect-to-node-exporter-on-firewall
301
+ connect-to-node-exporter-on-firewall :
302
+ @echo " Attempting to connect to node exporter on the firewall"
303
+ echo " Firewall IP: $( FWIP) "
304
+ @for i in $$(seq 1 $(MAX_RETRIES ) ) ; do \
305
+ if $( MAKE) ssh-machine COMMAND=" sudo curl --connect-timeout 1 --fail --silent http://[$( FWIP) ]:9100/metrics" > /dev/null 2>&1 ; then \
306
+ echo " Connected successfully" ; \
307
+ exit 0; \
308
+ else \
309
+ echo " Connection failed" ; \
310
+ if [ $$ i -lt $( MAX_RETRIES) ]; then \
311
+ echo " Retrying in 2 seconds..." ; \
312
+ sleep 2; \
313
+ else \
314
+ echo " Max retries reached" ; \
315
+ exit 1; \
316
+ fi ; \
317
+ fi ; \
318
+ done
319
+
276
320
# # DEV TARGETS ##
277
321
278
322
.PHONY : dev-env
0 commit comments