-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile.testing
More file actions
168 lines (146 loc) · 5.63 KB
/
Copy pathDockerfile.testing
File metadata and controls
168 lines (146 loc) · 5.63 KB
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
# IonicTrace Linux Testing Environment
# Optimized for eBPF and io_uring development
FROM ubuntu:22.04
LABEL maintainer="Mohammad Tanzil Idrisi <idrisitanzil@gmail.com>"
LABEL description="IonicTrace Linux testing environment with eBPF and io_uring support"
# Prevent interactive prompts during package installation
ENV DEBIAN_FRONTEND=noninteractive
ENV TZ=UTC
# Set up environment variables for eBPF development
ENV BPF_CLANG=clang
ENV BPF_CFLAGS="-O2 -g -Wall -Werror"
ENV CARGO_TARGET_BPF_LINKER=bpf-linker
ENV RUST_LOG=info
ENV RUST_BACKTRACE=1
# Install system dependencies
RUN apt-get update && apt-get install -y \
# Build essentials
build-essential \
pkg-config \
curl \
wget \
git \
# eBPF development tools
clang \
llvm \
libbpf-dev \
linux-headers-generic \
linux-libc-dev \
# io_uring development
liburing-dev \
# Network utilities for testing
iproute2 \
iputils-ping \
tcpdump \
net-tools \
# Performance analysis tools
linux-tools-generic \
htop \
# Debugging tools
strace \
gdb \
valgrind \
# Other utilities
vim \
less \
tree \
&& rm -rf /var/lib/apt/lists/*
# Create symbolic link for asm headers
RUN mkdir -p /usr/include/asm && \
ln -sf /usr/include/x86_64-linux-gnu/asm/* /usr/include/asm/ 2>/dev/null || \
ln -sf /usr/include/x86_64-linux-gnu/asm/types.h /usr/include/asm/types.h 2>/dev/null || true
# Install Rust toolchain
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
ENV PATH="/root/.cargo/bin:${PATH}"
# Install BPF linker
RUN /root/.cargo/bin/cargo install bpf-linker
# Create working directory
WORKDIR /workspace
# Set up test network interfaces script
RUN echo '#!/bin/bash\n\
set -e\n\
echo "Setting up test network interfaces..."\n\
ip link add veth0 type veth peer name veth1\n\
ip link set veth0 up\n\
ip link set veth1 up\n\
ip addr add 192.168.100.1/24 dev veth0\n\
ip addr add 192.168.100.2/24 dev veth1\n\
echo "Test interfaces veth0/veth1 ready"' > /usr/local/bin/setup-test-interfaces.sh
RUN chmod +x /usr/local/bin/setup-test-interfaces.sh
# Performance optimization script
RUN echo '#!/bin/bash\n\
echo "Applying performance optimizations..."\n\
# Disable CPU frequency scaling if cpufreq is available\n\
if command -v cpupower >/dev/null 2>&1; then\n\
cpupower frequency-set --governor performance 2>/dev/null || true\n\
fi\n\
# Set memory map limits\n\
echo 262144 > /proc/sys/vm/max_map_count 2>/dev/null || true\n\
# Disable timer migration for consistent latencies\n\
echo 0 > /proc/sys/kernel/timer_migration 2>/dev/null || true\n\
echo "Performance optimizations applied"' > /usr/local/bin/optimize-performance.sh
RUN chmod +x /usr/local/bin/optimize-performance.sh
# System validation script
RUN echo '#!/bin/bash\n\
echo "🔍 Validating IonicTrace requirements..."\n\
echo "Kernel: $(uname -r)"\n\
echo "Architecture: $(uname -m)"\n\
echo "CPU cores: $(nproc)"\n\
echo "Memory: $(free -h | awk \"/^Mem:/{print \\$2}\")"\n\
echo ""\n\
echo "eBPF Support:"\n\
ls -la /sys/fs/bpf/ 2>/dev/null && echo " ✅ eBPF filesystem available" || echo " ❌ eBPF filesystem not available"\n\
grep -q bpf /proc/kallsyms && echo " ✅ BPF syscalls available" || echo " ❌ BPF syscalls not available"\n\
echo ""\n\
echo "io_uring Support:"\n\
[ -e /proc/sys/kernel/io_uring_disabled ] && echo " ✅ io_uring kernel support detected" || echo " ✅ io_uring support assumed (no disable flag)"\n\
echo ""\n\
echo "Development Tools:"\n\
clang --version | head -1 | sed "s/^/ ✅ /"\n\
llvm-config --version | sed "s/^/ ✅ LLVM version: /"\n\
cargo --version | sed "s/^/ ✅ /"\n\
rustc --version | sed "s/^/ ✅ /"\n\
bpf-linker --version 2>/dev/null | sed "s/^/ ✅ /" || echo " ❌ bpf-linker not available"\n\
echo ""\n\
echo "🚀 Environment ready for IonicTrace testing!"' > /usr/local/bin/validate-environment.sh
RUN chmod +x /usr/local/bin/validate-environment.sh
# Copy project files (when building)
COPY . /workspace/
# Set proper permissions
RUN chmod +x /workspace/linux_validation.sh 2>/dev/null || true
# Expose any ports that might be needed for testing
EXPOSE 8080-8090
# Set entrypoint
ENTRYPOINT ["/bin/bash"]
CMD ["-c", "validate-environment.sh && exec bash"]
# Add helpful aliases
RUN echo 'alias ll="ls -la"' >> /root/.bashrc && \
echo 'alias ionic="./target/release/ionic-trace"' >> /root/.bashrc && \
echo 'alias test-net="setup-test-interfaces.sh"' >> /root/.bashrc && \
echo 'alias perf-opt="optimize-performance.sh"' >> /root/.bashrc && \
echo 'export PS1="[IonicTrace] \\w # "' >> /root/.bashrc
# Information about the container
RUN echo '#!/bin/bash\n\
echo "🐳 IonicTrace Linux Testing Container"\n\
echo "====================================="\n\
echo ""\n\
echo "Quick Start:"\n\
echo " validate-environment.sh # Check system requirements"\n\
echo " setup-test-interfaces.sh # Set up veth interfaces"\n\
echo " ./linux_validation.sh # Run full validation suite"\n\
echo ""\n\
echo "Manual Testing:"\n\
echo " cargo build --release # Build with eBPF + io_uring"\n\
echo " ionic check # Check system capabilities"\n\
echo " ionic demo --duration 10 # Run demonstration"\n\
echo ""\n\
echo "Performance Testing:"\n\
echo " optimize-performance.sh # Apply performance optimizations"\n\
echo " ionic benchmark --duration 30 --target-ops 100000"\n\
echo ""\n\
echo "Debug Commands:"\n\
echo " sudo bpftool prog list # List loaded eBPF programs"\n\
echo " sudo perf trace -e io_uring* # Trace io_uring operations"\n\
echo " sudo tcpdump -i veth0 # Monitor network traffic"\n\
echo ""' > /usr/local/bin/help.sh
RUN chmod +x /usr/local/bin/help.sh