@celilo/e2e 0.1.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.
Files changed (71) hide show
  1. package/README.md +360 -0
  2. package/bin/cache-docker-images +46 -0
  3. package/bin/e2e-build +66 -0
  4. package/bin/e2e-down +67 -0
  5. package/bin/e2e-infra +92 -0
  6. package/bin/e2e-load +40 -0
  7. package/bin/e2e-run +354 -0
  8. package/bin/e2e-shell +27 -0
  9. package/bin/e2e-status +29 -0
  10. package/bin/e2e-up +160 -0
  11. package/config/dhcp/dnsmasq.conf +27 -0
  12. package/config/dns/com.zone +11 -0
  13. package/config/dns/iamtheinternet.org.zone +15 -0
  14. package/config/dns/knot-namecheap.conf +11 -0
  15. package/config/dns/knot-root.conf +7 -0
  16. package/config/dns/knot-tld.conf +11 -0
  17. package/config/dns/org.zone +14 -0
  18. package/config/dns/park-your-domain.com.zone +10 -0
  19. package/config/dns/root.zone +14 -0
  20. package/config/pebble/pebble-ca.crt +20 -0
  21. package/config/pebble/pebble-config.json +11 -0
  22. package/config/pebble/pebble-tls.crt +21 -0
  23. package/config/pebble/pebble-tls.key +28 -0
  24. package/config/proxy/generate-ca.sh +20 -0
  25. package/config/proxy/squid-ca.crt +22 -0
  26. package/config/proxy/squid-ca.pem +50 -0
  27. package/config/proxy/squid.conf +38 -0
  28. package/config/proxy/startup.sh +11 -0
  29. package/config/resolver/root.hints +2 -0
  30. package/config/resolver/unbound.conf +28 -0
  31. package/config/routing/apt-cache-routes.sh +21 -0
  32. package/config/routing/dhcp-client-setup.sh +17 -0
  33. package/config/routing/dns-routes.sh +12 -0
  34. package/config/routing/fw-ext-routes.sh +50 -0
  35. package/config/routing/fw-isp-routes.sh +37 -0
  36. package/config/routing/fw-main-routes.sh +31 -0
  37. package/config/routing/management-routes.sh +96 -0
  38. package/config/routing/namecheap-startup.sh +17 -0
  39. package/config/routing/pebble-startup.sh +9 -0
  40. package/config/routing/resolver-routes.sh +15 -0
  41. package/config/routing/target-routes.sh +23 -0
  42. package/config/routing/target-setup.service +13 -0
  43. package/config/routing/target-setup.sh +36 -0
  44. package/config/ssh/generate-keys.sh +17 -0
  45. package/docker/Dockerfile.apt-cache +16 -0
  46. package/docker/Dockerfile.authoritative-dns +15 -0
  47. package/docker/Dockerfile.dhcp-client +16 -0
  48. package/docker/Dockerfile.firewall +28 -0
  49. package/docker/Dockerfile.forward-proxy +28 -0
  50. package/docker/Dockerfile.greenwave-sim +29 -0
  51. package/docker/Dockerfile.management +30 -0
  52. package/docker/Dockerfile.namecheap-dns +25 -0
  53. package/docker/Dockerfile.pebble +18 -0
  54. package/docker/Dockerfile.resolver +20 -0
  55. package/docker/Dockerfile.router +33 -0
  56. package/docker/Dockerfile.target-machine +58 -0
  57. package/docker/Dockerfile.target-machine-docker +105 -0
  58. package/package.json +45 -0
  59. package/simulators/greenwave/server.ts +164 -0
  60. package/simulators/greenwave/state.ts +206 -0
  61. package/simulators/greenwave/types.ts +31 -0
  62. package/simulators/namecheap-ddns/server.ts +97 -0
  63. package/simulators/namecheap-ddns/types.ts +12 -0
  64. package/simulators/namecheap-ddns/zone-updater.ts +49 -0
  65. package/src/container-manager.ts +324 -0
  66. package/src/docker-compose-generator.ts +499 -0
  67. package/src/fixtures.ts +40 -0
  68. package/src/index.ts +59 -0
  69. package/src/network-builder.ts +91 -0
  70. package/src/shared-infra.ts +163 -0
  71. package/src/types.ts +74 -0
@@ -0,0 +1,36 @@
1
+ #!/bin/bash
2
+ # E2E target machine boot setup: routing, DNS, SSH keys.
3
+ # Runs as a systemd oneshot service at boot.
4
+ # GATEWAY is set via environment variable from docker-compose.
5
+ set -e
6
+
7
+ GATEWAY="${GATEWAY:?GATEWAY not set}"
8
+
9
+ # Wait for SSH keys (management container generates them)
10
+ echo "Waiting for SSH keys..."
11
+ for i in $(seq 1 30); do
12
+ if [ -f /ssh-keys/authorized_keys ]; then
13
+ break
14
+ fi
15
+ sleep 1
16
+ done
17
+
18
+ if [ ! -f /ssh-keys/authorized_keys ]; then
19
+ echo "ERROR: SSH keys not found after 30s"
20
+ exit 1
21
+ fi
22
+
23
+ # SSH keys
24
+ mkdir -p /root/.ssh
25
+ cp /ssh-keys/authorized_keys /root/.ssh/authorized_keys
26
+ chmod 700 /root/.ssh
27
+ chmod 600 /root/.ssh/authorized_keys
28
+
29
+ # Routing
30
+ ip route del default 2>/dev/null || true
31
+ ip route add default via "$GATEWAY"
32
+
33
+ # DNS
34
+ echo "nameserver 100.100.0.1" > /etc/resolv.conf
35
+
36
+ echo "Target machine ready: $(hostname)"
@@ -0,0 +1,17 @@
1
+ #!/bin/bash
2
+ # Generate SSH keypair for the test harness.
3
+ # Called during container startup if keys don't exist yet.
4
+ set -e
5
+
6
+ KEY_DIR="${1:-/ssh-keys}"
7
+ mkdir -p "$KEY_DIR"
8
+
9
+ if [ ! -f "$KEY_DIR/id_ed25519" ]; then
10
+ ssh-keygen -t ed25519 -f "$KEY_DIR/id_ed25519" -N "" -q
11
+ cat "$KEY_DIR/id_ed25519.pub" > "$KEY_DIR/authorized_keys"
12
+ chmod 600 "$KEY_DIR/id_ed25519"
13
+ chmod 644 "$KEY_DIR/id_ed25519.pub" "$KEY_DIR/authorized_keys"
14
+ echo "SSH keys generated in $KEY_DIR"
15
+ else
16
+ echo "SSH keys already exist in $KEY_DIR"
17
+ fi
@@ -0,0 +1,16 @@
1
+ FROM ubuntu:22.04
2
+
3
+ RUN apt-get update && apt-get install -y \
4
+ apt-cacher-ng \
5
+ iproute2 \
6
+ iputils-ping \
7
+ && rm -rf /var/lib/apt/lists/*
8
+
9
+ # apt-cacher-ng config: allow HTTPS passthrough
10
+ RUN echo "PassThroughPattern: .*" >> /etc/apt-cacher-ng/acng.conf
11
+
12
+ COPY config/routing/apt-cache-routes.sh /startup.sh
13
+ RUN chmod +x /startup.sh
14
+
15
+ EXPOSE 3142
16
+ CMD ["/startup.sh"]
@@ -0,0 +1,15 @@
1
+ FROM cznic/knot
2
+
3
+ RUN apt-get update && apt-get install -y \
4
+ iproute2 \
5
+ iputils-ping \
6
+ net-tools \
7
+ dnsutils \
8
+ procps \
9
+ && rm -rf /var/lib/apt/lists/*
10
+
11
+ COPY config/routing/dns-routes.sh /startup.sh
12
+ RUN chmod +x /startup.sh
13
+
14
+ # Zone files and knot config are volume-mounted per instance
15
+ CMD ["/startup.sh"]
@@ -0,0 +1,16 @@
1
+ FROM ubuntu:22.04
2
+
3
+ ENV DEBIAN_FRONTEND=noninteractive
4
+
5
+ RUN apt-get update && apt-get install -y \
6
+ isc-dhcp-client \
7
+ iproute2 \
8
+ iputils-ping \
9
+ dnsutils \
10
+ curl \
11
+ && rm -rf /var/lib/apt/lists/*
12
+
13
+ COPY config/routing/dhcp-client-setup.sh /startup.sh
14
+ RUN chmod +x /startup.sh
15
+
16
+ CMD ["/startup.sh"]
@@ -0,0 +1,28 @@
1
+ FROM ubuntu:22.04
2
+
3
+ RUN apt-get update && apt-get install -y \
4
+ openssh-server \
5
+ iptables \
6
+ iproute2 \
7
+ iputils-ping \
8
+ net-tools \
9
+ dnsutils \
10
+ procps \
11
+ python3 \
12
+ && rm -rf /var/lib/apt/lists/*
13
+
14
+ RUN mkdir -p /run/sshd && \
15
+ sed -i 's/#PermitRootLogin.*/PermitRootLogin yes/' /etc/ssh/sshd_config && \
16
+ sed -i 's/#PubkeyAuthentication.*/PubkeyAuthentication yes/' /etc/ssh/sshd_config
17
+
18
+ # Trust the E2E forward proxy CA (for transparent HTTPS interception)
19
+ COPY config/proxy/squid-ca.crt /usr/local/share/ca-certificates/e2e-proxy-ca.crt
20
+ RUN update-ca-certificates
21
+
22
+ # Point apt at the simulated apt cache proxy
23
+ RUN echo 'Acquire::http::Proxy "http://100.64.0.2:3142";' > /etc/apt/apt.conf.d/00proxy
24
+
25
+ COPY config/routing/fw-main-routes.sh /startup.sh
26
+ RUN chmod +x /startup.sh
27
+
28
+ CMD ["/startup.sh"]
@@ -0,0 +1,28 @@
1
+ FROM ubuntu:22.04
2
+
3
+ RUN apt-get update && apt-get install -y \
4
+ squid-openssl \
5
+ openssl \
6
+ iproute2 \
7
+ iputils-ping \
8
+ && rm -rf /var/lib/apt/lists/*
9
+
10
+ # Pre-generated CA certificate for SSL bumping
11
+ COPY config/proxy/squid-ca.pem /etc/squid/ssl/squid-ca.pem
12
+ RUN chmod 600 /etc/squid/ssl/squid-ca.pem
13
+
14
+ # Initialize SSL certificate database
15
+ RUN /usr/lib/squid/security_file_certgen -c -s /var/spool/squid/ssl_db -M 4MB
16
+
17
+ # Squid config
18
+ COPY config/proxy/squid.conf /etc/squid/squid.conf
19
+
20
+ # Create log and cache directories, initialize swap
21
+ RUN mkdir -p /var/log/squid && chown proxy:proxy /var/log/squid
22
+ RUN squid -z -f /etc/squid/squid.conf 2>/dev/null; sleep 1; kill "$(cat /run/squid.pid 2>/dev/null)" 2>/dev/null; rm -f /run/squid.pid; true
23
+
24
+ COPY config/proxy/startup.sh /startup.sh
25
+ RUN chmod +x /startup.sh
26
+
27
+ EXPOSE 3128 3129
28
+ CMD ["/startup.sh"]
@@ -0,0 +1,29 @@
1
+ FROM oven/bun:latest
2
+
3
+ RUN apt-get update && apt-get install -y \
4
+ openssh-server \
5
+ iptables \
6
+ iproute2 \
7
+ iputils-ping \
8
+ net-tools \
9
+ dnsutils \
10
+ procps \
11
+ curl \
12
+ python3 \
13
+ dnsmasq \
14
+ && rm -rf /var/lib/apt/lists/*
15
+
16
+ RUN mkdir -p /run/sshd && \
17
+ sed -i 's/#PermitRootLogin.*/PermitRootLogin yes/' /etc/ssh/sshd_config && \
18
+ sed -i 's/#PubkeyAuthentication.*/PubkeyAuthentication yes/' /etc/ssh/sshd_config
19
+
20
+ # Trust the E2E forward proxy CA (for transparent HTTPS interception)
21
+ COPY config/proxy/squid-ca.crt /usr/local/share/ca-certificates/e2e-proxy-ca.crt
22
+ RUN update-ca-certificates
23
+
24
+ COPY simulators/greenwave/ /simulator/
25
+ COPY config/dhcp/dnsmasq.conf /etc/dnsmasq.d/e2e.conf
26
+ COPY config/routing/fw-isp-routes.sh /startup.sh
27
+ RUN chmod +x /startup.sh
28
+
29
+ CMD ["/startup.sh"]
@@ -0,0 +1,30 @@
1
+ FROM oven/bun:latest
2
+
3
+ RUN apt-get update && apt-get install -y \
4
+ openssh-client \
5
+ ansible \
6
+ iproute2 \
7
+ iputils-ping \
8
+ net-tools \
9
+ dnsutils \
10
+ curl \
11
+ procps \
12
+ zsh \
13
+ && rm -rf /var/lib/apt/lists/*
14
+
15
+ # Set zsh as default shell
16
+ RUN chsh -s /bin/zsh root
17
+
18
+ # Trust the E2E forward proxy CA (for transparent HTTPS interception)
19
+ COPY config/proxy/squid-ca.crt /usr/local/share/ca-certificates/e2e-proxy-ca.crt
20
+ RUN update-ca-certificates
21
+
22
+ # Point apt at the simulated apt cache proxy (for runtime apt usage)
23
+ RUN echo 'Acquire::http::Proxy "http://100.64.0.2:3142";' > /etc/apt/apt.conf.d/00proxy
24
+
25
+ COPY config/ssh/generate-keys.sh /config/ssh/generate-keys.sh
26
+ COPY config/routing/management-routes.sh /startup.sh
27
+ RUN chmod +x /startup.sh /config/ssh/generate-keys.sh
28
+
29
+ WORKDIR /celilo/apps/celilo
30
+ CMD ["/startup.sh"]
@@ -0,0 +1,25 @@
1
+ FROM cznic/knot
2
+
3
+ RUN apt-get update && apt-get install -y \
4
+ iproute2 \
5
+ iputils-ping \
6
+ net-tools \
7
+ dnsutils \
8
+ procps \
9
+ curl \
10
+ unzip \
11
+ && rm -rf /var/lib/apt/lists/*
12
+
13
+ # Install bun for the DDNS API simulator
14
+ RUN curl -fsSL https://bun.sh/install | bash
15
+ ENV PATH="/root/.bun/bin:$PATH"
16
+
17
+ COPY simulators/namecheap-ddns/ /simulator/
18
+ COPY config/routing/dns-routes.sh /dns-routes.sh
19
+ RUN chmod +x /dns-routes.sh
20
+
21
+ # Custom startup: knot DNS + DDNS simulator
22
+ COPY config/routing/namecheap-startup.sh /startup.sh
23
+ RUN chmod +x /startup.sh
24
+
25
+ CMD ["/startup.sh"]
@@ -0,0 +1,18 @@
1
+ FROM ghcr.io/letsencrypt/pebble:latest AS pebble
2
+
3
+ FROM ubuntu:22.04
4
+
5
+ RUN apt-get update && apt-get install -y \
6
+ iproute2 \
7
+ iputils-ping \
8
+ ca-certificates \
9
+ && rm -rf /var/lib/apt/lists/*
10
+
11
+ # Copy Pebble binary and test certs from official image
12
+ COPY --from=pebble /app /usr/local/bin/pebble
13
+ COPY --from=pebble /test /test
14
+
15
+ COPY config/routing/pebble-startup.sh /startup.sh
16
+ RUN chmod +x /startup.sh
17
+
18
+ ENTRYPOINT ["/startup.sh"]
@@ -0,0 +1,20 @@
1
+ FROM ubuntu:22.04
2
+
3
+ RUN apt-get update && apt-get install -y \
4
+ unbound \
5
+ iproute2 \
6
+ iputils-ping \
7
+ net-tools \
8
+ dnsutils \
9
+ procps \
10
+ && rm -rf /var/lib/apt/lists/*
11
+
12
+ RUN chown -R root:unbound /etc/unbound
13
+
14
+ COPY config/resolver/unbound.conf /etc/unbound/unbound.conf
15
+ COPY config/resolver/root.hints /etc/unbound/root.hints
16
+ COPY config/routing/resolver-routes.sh /startup.sh
17
+ RUN chmod +x /startup.sh
18
+
19
+ EXPOSE 53/tcp 53/udp
20
+ CMD ["/startup.sh"]
@@ -0,0 +1,33 @@
1
+ FROM ubuntu:22.04
2
+
3
+ RUN apt-get update && apt-get install -y \
4
+ iproute2 \
5
+ iptables \
6
+ iputils-ping \
7
+ net-tools \
8
+ dnsutils \
9
+ procps \
10
+ curl \
11
+ ca-certificates \
12
+ squid-openssl \
13
+ openssl \
14
+ && rm -rf /var/lib/apt/lists/*
15
+
16
+ # Trust Pebble's test CA (so curl from fw-ext trusts Caddy's ACME cert)
17
+ COPY config/pebble/pebble-ca.crt /usr/local/share/ca-certificates/pebble-ca.crt
18
+ RUN update-ca-certificates
19
+
20
+ # Squid CA certificate for SSL bumping
21
+ COPY config/proxy/squid-ca.pem /etc/squid/ssl/squid-ca.pem
22
+ RUN chmod 600 /etc/squid/ssl/squid-ca.pem
23
+
24
+ # Initialize Squid SSL cert db and cache dirs
25
+ RUN /usr/lib/squid/security_file_certgen -c -s /var/spool/squid/ssl_db -M 4MB
26
+ COPY config/proxy/squid.conf /etc/squid/squid.conf
27
+ RUN mkdir -p /var/log/squid && chown proxy:proxy /var/log/squid
28
+ RUN squid -z -f /etc/squid/squid.conf 2>/dev/null; sleep 1; kill "$(cat /run/squid.pid 2>/dev/null)" 2>/dev/null; rm -f /run/squid.pid; true
29
+
30
+ COPY config/routing/fw-ext-routes.sh /startup.sh
31
+ RUN chmod +x /startup.sh
32
+
33
+ CMD ["/startup.sh"]
@@ -0,0 +1,58 @@
1
+ FROM ubuntu:22.04
2
+
3
+ ENV DEBIAN_FRONTEND=noninteractive
4
+
5
+ RUN apt-get update && apt-get install -y \
6
+ systemd \
7
+ systemd-sysv \
8
+ openssh-server \
9
+ iproute2 \
10
+ iputils-ping \
11
+ net-tools \
12
+ dnsutils \
13
+ procps \
14
+ python3 \
15
+ sudo \
16
+ curl \
17
+ ca-certificates \
18
+ && rm -rf /var/lib/apt/lists/*
19
+
20
+ # Trust the E2E forward proxy CA (for transparent HTTPS interception)
21
+ COPY config/proxy/squid-ca.crt /usr/local/share/ca-certificates/e2e-proxy-ca.crt
22
+ # Trust Pebble's test CA (so Caddy/ACME clients trust the simulated Let's Encrypt)
23
+ COPY config/pebble/pebble-ca.crt /usr/local/share/ca-certificates/pebble-ca.crt
24
+ RUN update-ca-certificates
25
+
26
+ RUN mkdir -p /run/sshd && \
27
+ sed -i 's/#PermitRootLogin.*/PermitRootLogin yes/' /etc/ssh/sshd_config && \
28
+ sed -i 's/#PubkeyAuthentication.*/PubkeyAuthentication yes/' /etc/ssh/sshd_config
29
+
30
+ # Enable SSH service
31
+ RUN systemctl enable ssh
32
+
33
+ # Point apt at the simulated apt cache proxy
34
+ RUN echo 'Acquire::http::Proxy "http://100.64.0.2:3142";' > /etc/apt/apt.conf.d/00proxy
35
+
36
+ # E2E network setup service (runs at boot to configure routing, DNS, SSH keys)
37
+ COPY config/routing/target-setup.sh /usr/local/bin/target-setup.sh
38
+ RUN chmod +x /usr/local/bin/target-setup.sh
39
+
40
+ COPY config/routing/target-setup.service /etc/systemd/system/target-setup.service
41
+ RUN systemctl enable target-setup
42
+
43
+ # Clean up unnecessary systemd services that slow down boot
44
+ RUN (cd /lib/systemd/system/sysinit.target.wants/ && \
45
+ ls | grep -v systemd-tmpfiles-setup | xargs rm -f 2>/dev/null); \
46
+ rm -f /lib/systemd/system/multi-user.target.wants/*; \
47
+ rm -f /etc/systemd/system/*.wants/*; \
48
+ rm -f /lib/systemd/system/local-fs.target.wants/*; \
49
+ rm -f /lib/systemd/system/sockets.target.wants/*udev*; \
50
+ rm -f /lib/systemd/system/sockets.target.wants/*initctl*; \
51
+ rm -f /lib/systemd/system/basic.target.wants/*; \
52
+ true
53
+
54
+ # Re-enable the services we actually need
55
+ RUN systemctl enable ssh target-setup
56
+
57
+ STOPSIGNAL SIGRTMIN+3
58
+ ENTRYPOINT ["/sbin/init"]
@@ -0,0 +1,105 @@
1
+ # Target machine with Docker pre-installed and authentik images pre-pulled.
2
+ # Used for app-zone machines that will run Docker Compose workloads.
3
+ # This avoids a 10+ minute Docker pull during e2e test deploy time.
4
+
5
+ FROM ubuntu:22.04
6
+
7
+ ENV DEBIAN_FRONTEND=noninteractive
8
+
9
+ RUN apt-get update && apt-get install -y \
10
+ systemd \
11
+ systemd-sysv \
12
+ openssh-server \
13
+ iproute2 \
14
+ iputils-ping \
15
+ net-tools \
16
+ dnsutils \
17
+ procps \
18
+ python3 \
19
+ sudo \
20
+ curl \
21
+ ca-certificates \
22
+ gnupg \
23
+ lsb-release \
24
+ && rm -rf /var/lib/apt/lists/*
25
+
26
+ # Trust the E2E forward proxy CA (for transparent HTTPS interception)
27
+ COPY config/proxy/squid-ca.crt /usr/local/share/ca-certificates/e2e-proxy-ca.crt
28
+ # Trust Pebble's test CA (so Caddy/ACME clients trust the simulated Let's Encrypt)
29
+ COPY config/pebble/pebble-ca.crt /usr/local/share/ca-certificates/pebble-ca.crt
30
+ RUN update-ca-certificates
31
+
32
+ RUN mkdir -p /run/sshd && \
33
+ sed -i 's/#PermitRootLogin.*/PermitRootLogin yes/' /etc/ssh/sshd_config && \
34
+ sed -i 's/#PubkeyAuthentication.*/PubkeyAuthentication yes/' /etc/ssh/sshd_config
35
+
36
+ # Enable SSH service
37
+ RUN systemctl enable ssh
38
+
39
+ # Point apt at the simulated apt cache proxy
40
+ RUN echo 'Acquire::http::Proxy "http://100.64.0.2:3142";' > /etc/apt/apt.conf.d/00proxy
41
+
42
+ # E2E network setup service
43
+ COPY config/routing/target-setup.sh /usr/local/bin/target-setup.sh
44
+ RUN chmod +x /usr/local/bin/target-setup.sh
45
+
46
+ COPY config/routing/target-setup.service /etc/systemd/system/target-setup.service
47
+ RUN systemctl enable target-setup
48
+
49
+ # Clean up unnecessary systemd services
50
+ RUN (cd /lib/systemd/system/sysinit.target.wants/ && \
51
+ ls | grep -v systemd-tmpfiles-setup | xargs rm -f 2>/dev/null); \
52
+ rm -f /lib/systemd/system/multi-user.target.wants/*; \
53
+ rm -f /etc/systemd/system/*.wants/*; \
54
+ rm -f /lib/systemd/system/local-fs.target.wants/*; \
55
+ rm -f /lib/systemd/system/sockets.target.wants/*udev*; \
56
+ rm -f /lib/systemd/system/sockets.target.wants/*initctl*; \
57
+ rm -f /lib/systemd/system/basic.target.wants/*; \
58
+ true
59
+
60
+ # Re-enable the services we actually need
61
+ RUN systemctl enable ssh target-setup
62
+
63
+ # --- Docker pre-installation ---
64
+ # Temporarily disable apt proxy (the e2e proxy isn't available during docker build)
65
+ RUN rm -f /etc/apt/apt.conf.d/00proxy
66
+
67
+ # Install Docker (same steps as the Ansible role, but at image build time)
68
+ RUN install -m 0755 -d /etc/apt/keyrings && \
69
+ curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc && \
70
+ chmod a+r /etc/apt/keyrings/docker.asc && \
71
+ echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" > /etc/apt/sources.list.d/docker.list && \
72
+ apt-get update && \
73
+ apt-get install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin && \
74
+ rm -rf /var/lib/apt/lists/*
75
+
76
+ # Re-enable apt proxy for runtime
77
+ RUN echo 'Acquire::http::Proxy "http://100.64.0.2:3142";' > /etc/apt/apt.conf.d/00proxy
78
+
79
+ # Configure Docker for nested operation (vfs storage driver)
80
+ # Must match Ansible's exact content to avoid a Docker restart that wipes cached images
81
+ # Ansible copy module writes: '{"storage-driver": "vfs"}\n'
82
+ RUN mkdir -p /etc/docker && \
83
+ echo '{"storage-driver": "vfs"}' > /etc/docker/daemon.json
84
+
85
+ RUN systemctl enable docker
86
+
87
+ # Pre-cached image loading service:
88
+ # At first boot, if /docker-image-cache/*.tar exists, load them into Docker.
89
+ # This avoids multi-minute pulls during e2e test deploy.
90
+ RUN echo '#!/bin/bash\n\
91
+ set -e\n\
92
+ if ls /docker-image-cache/*.tar 1>/dev/null 2>&1; then\n\
93
+ for img in /docker-image-cache/*.tar; do\n\
94
+ echo "Loading cached Docker image: $img"\n\
95
+ docker load < "$img"\n\
96
+ done\n\
97
+ fi\n' > /usr/local/bin/load-cached-images.sh && \
98
+ chmod +x /usr/local/bin/load-cached-images.sh
99
+
100
+ RUN printf '[Unit]\nDescription=Load pre-cached Docker images\nAfter=docker.service\nRequires=docker.service\n\n[Service]\nType=oneshot\nExecStart=/usr/local/bin/load-cached-images.sh\nRemainAfterExit=yes\n\n[Install]\nWantedBy=multi-user.target\n' \
101
+ > /etc/systemd/system/load-docker-cache.service && \
102
+ systemctl enable load-docker-cache
103
+
104
+ STOPSIGNAL SIGRTMIN+3
105
+ ENTRYPOINT ["/sbin/init"]
package/package.json ADDED
@@ -0,0 +1,45 @@
1
+ {
2
+ "name": "@celilo/e2e",
3
+ "version": "0.1.0",
4
+ "description": "E2E test infrastructure for Celilo-deployed applications. Provides a simulated internet with DNS hierarchy, ACME server, firewalls, and target machines in Docker.",
5
+ "type": "module",
6
+ "main": "./src/index.ts",
7
+ "exports": {
8
+ ".": "./src/index.ts",
9
+ "./types": "./src/types.ts",
10
+ "./fixtures": "./src/fixtures.ts"
11
+ },
12
+ "bin": {
13
+ "celilo-e2e-run": "./bin/e2e-run",
14
+ "celilo-e2e-build": "./bin/e2e-build",
15
+ "celilo-e2e-load": "./bin/e2e-load",
16
+ "celilo-e2e-infra": "./bin/e2e-infra"
17
+ },
18
+ "files": [
19
+ "src/",
20
+ "docker/",
21
+ "config/",
22
+ "simulators/",
23
+ "bin/",
24
+ "README.md"
25
+ ],
26
+ "dependencies": {
27
+ "yaml": "^2.8.0"
28
+ },
29
+ "devDependencies": {
30
+ "@types/bun": "latest"
31
+ },
32
+ "keywords": [
33
+ "celilo",
34
+ "e2e",
35
+ "testing",
36
+ "docker",
37
+ "infrastructure"
38
+ ],
39
+ "license": "MIT",
40
+ "repository": {
41
+ "type": "git",
42
+ "url": "https://github.com/psbanka/infra",
43
+ "directory": "packages/e2e"
44
+ }
45
+ }