|
1 | 1 | ## |
2 | | -## Copyright (c) 2023 The Johns Hopkins University Applied Physics |
| 2 | +## Copyright (c) 2011-2024 The Johns Hopkins University Applied Physics |
3 | 3 | ## Laboratory LLC. |
4 | 4 | ## |
5 | 5 | ## This file is part of the Delay-Tolerant Networking Management |
|
15 | 15 | ## See the License for the specific language governing permissions and |
16 | 16 | ## limitations under the License. |
17 | 17 | ## |
18 | | - |
19 | | -FROM localhost/anms-init AS deps-base |
20 | | -RUN --mount=type=cache,target=/var/cache/yum \ |
21 | | - dnf install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm |
22 | | -RUN --mount=type=cache,target=/var/cache/yum \ |
23 | | - dnf install -y \ |
24 | | - patch \ |
25 | | - cmake ninja-build \ |
26 | | - ruby rsync git \ |
27 | | - systemd systemd-sysv \ |
28 | | - make gcc gcc-c++ \ |
29 | | - libpq-devel civetweb-devel cjson-devel\ |
30 | | - gdb less |
31 | | - |
32 | | -COPY dtnma-tools/deps/QCBOR /usr/local/src/dtnma-tools/deps/QCBOR |
33 | | -COPY dtnma-tools/deps/qcbor*.patch /usr/local/src/dtnma-tools/deps/ |
34 | | -RUN cd /usr/local/src/dtnma-tools/deps/QCBOR && \ |
35 | | - patch -p1 <../qcbor-install.patch && \ |
36 | | - patch -p2 <../qcbor-expose-private.patch && \ |
| 18 | +FROM ubuntu:24.04 AS systemd-base |
| 19 | +ENV DEBIAN_FRONTEND="noninteractive" |
| 20 | + |
| 21 | +# APL network configuration from |
| 22 | +# https://aplprod.servicenowservices.com/sp?id=kb_article&sys_id=c0de6fe91b83d85071b143bae54bcb34 |
| 23 | +RUN apt-get update && apt-get install -y ca-certificates curl && \ |
| 24 | + (curl -sL http://apllinuxdepot.jhuapl.edu/linux/APL-root-cert/JHUAPL-MS-Root-CA-05-21-2038-B64-text.cer -o /usr/local/share/ca-certificates/JHUAPL-MS-Root-CA-05-21-2038-B64-text.crt || true) && \ |
| 25 | + update-ca-certificates |
| 26 | +ENV PIP_CERT=/etc/ssl/certs/ca-certificates.crt |
| 27 | +ENV PIP_DEFAULT_TIMEOUT=300 |
| 28 | + |
| 29 | +# Distro upgrade for security patches |
| 30 | +RUN apt-get update && apt-get upgrade -y |
| 31 | + |
| 32 | +# Use systemd as top-level process |
| 33 | +RUN apt-get update && apt-get install -y systemd systemd-sysv |
| 34 | +RUN systemctl mask systemd-logind && \ |
| 35 | + systemctl mask console-getty && \ |
| 36 | + systemctl disable getty@tty1 && \ |
| 37 | + systemctl disable apt-daily.timer apt-daily-upgrade.timer && \ |
| 38 | + systemctl disable systemd-timesyncd && \ |
| 39 | + systemctl disable systemd-networkd && \ |
| 40 | + echo "MulticastDNS=no" >>/etc/systemd/resolved.conf |
| 41 | +CMD [ "/sbin/init" ] |
| 42 | + |
| 43 | +# Testing utilities |
| 44 | +RUN apt-get update && apt-get install -y \ |
| 45 | + net-tools iproute2 iputils-ping \ |
| 46 | + lsof iftop gdb valgrind xxd socat jq ruby && \ |
| 47 | + gem install cbor-diag |
| 48 | + |
| 49 | + |
| 50 | +FROM ubuntu:24.04 AS deps-local |
| 51 | + |
| 52 | +RUN apt-get update && apt-get install -y \ |
| 53 | + build-essential \ |
| 54 | + cmake autoconf libtool && \ |
| 55 | + echo "/usr/local/lib" >/etc/ld.so.conf.d/local.conf |
| 56 | + |
| 57 | +COPY dtnma-tools/deps/ion /usr/local/src/nm/deps/ion |
| 58 | +COPY dtnma-tools/deps/ion*.patch /usr/local/src/nm/deps/ |
| 59 | +RUN cd /usr/local/src/nm/deps/ion && \ |
| 60 | + patch -p1 <../ion-4.1.2-remove-nm.patch && \ |
| 61 | + patch -p1 <../ion-4.1.2-local-deliver.patch && \ |
| 62 | + patch -p1 <../ion-4.1.2-private-headers.patch && \ |
| 63 | + autoreconf -vif && \ |
| 64 | + export CFLAGS="-std=gnu99" && \ |
| 65 | + ./configure && \ |
37 | 66 | make -j$(nproc) && \ |
38 | 67 | make install && \ |
39 | 68 | make -j$(nproc) clean |
40 | 69 |
|
41 | | -COPY dtnma-tools/deps/mlib /usr/local/src/dtnma-tools/deps/mlib |
42 | | -RUN cd /usr/local/src/dtnma-tools/deps/mlib && \ |
| 70 | +COPY dtnma-tools/deps/QCBOR /usr/local/src/nm/deps/QCBOR |
| 71 | +RUN cd /usr/local/src/nm/deps/QCBOR && \ |
| 72 | + cmake -S . -B build \ |
| 73 | + -DCMAKE_BUILD_TYPE=Debug \ |
| 74 | + -DBUILD_SHARED_LIBS=YES && \ |
| 75 | + cmake --build build && \ |
| 76 | + cmake --install build && \ |
| 77 | + ldconfig && \ |
| 78 | + rm -rf build |
| 79 | + |
| 80 | +COPY dtnma-tools/deps/mlib /usr/local/src/nm/deps/mlib |
| 81 | +RUN cd /usr/local/src/nm/deps/mlib && \ |
43 | 82 | make -j$(nproc) && \ |
44 | 83 | make install && \ |
| 84 | + ldconfig && \ |
45 | 85 | make -j$(nproc) clean |
46 | 86 |
|
47 | | -# Helper utilities |
48 | | -RUN --mount=type=cache,target=/var/cache/yum \ |
49 | | - dnf install -y \ |
50 | | - python3 python3-pip \ |
51 | | - gcc python3-devel systemd-devel |
52 | | -RUN --mount=type=cache,target=/root/.cache/pip \ |
53 | | - pip3 install systemd-python |
54 | | -COPY --chmod=755 dtnma-tools/testenv/ion_nm_wrap.py /usr/local/bin/ion_nm_wrap |
55 | | -COPY --chmod=755 dtnma-tools/testenv/service_is_running.sh /usr/local/bin/service_is_running |
56 | | -COPY --chmod=755 dtnma-tools/testenv/ion_restart_ducts.sh /usr/local/bin/ion_restart_ducts |
57 | | -COPY --chmod=755 dtnma-tools/testenv/ion_ping_peers.sh /usr/local/bin/ion_ping_peers |
58 | | - |
59 | | - |
60 | | -# Additional ION library install |
61 | | -FROM deps-base AS ion-base |
62 | | -RUN --mount=type=cache,target=/var/cache/yum \ |
63 | | - dnf install -y \ |
64 | | - autoconf libtool \ |
65 | | - patch autoconf libtool \ |
66 | | - perl-CPAN && \ |
67 | | - PERL_MM_USE_DEFAULT=1 cpan -T JSON REST::Client Expect File::Slurp |
68 | | - |
69 | | -COPY dtnma-tools/deps/ion /usr/local/src/dtnma-tools/deps/ion |
70 | | -COPY dtnma-tools/deps/ion*.patch /usr/local/src/dtnma-tools/deps |
71 | | -RUN cd /usr/local/src/dtnma-tools/deps/ion && \ |
72 | | - patch -p1 <../ion-4.1.2-remove-nm.patch && \ |
73 | | - patch -p1 <../ion-4.1.2-local-deliver.patch && \ |
74 | | - patch -p1 <../ion-4.1.2-private-headers.patch && \ |
75 | | - autoreconf -vif && \ |
76 | | - ./configure \ |
77 | | - --prefix=/usr/local --libdir=/usr/local/lib64 && \ |
78 | | - make -j$(nproc) && \ |
79 | | - make install && \ |
80 | | - echo /usr/local/lib64 > /etc/ld.so.conf.d/local.conf && \ |
81 | | - ldconfig |
82 | | - |
83 | | -# Systemd services |
84 | | -COPY dtnma-tools/systemd/tmpfiles.conf /etc/tmpfiles.d/ion.conf |
85 | | -COPY --chmod=644 dtnma-tools/systemd/ion.service dtnma-tools/systemd/ion-stats.service dtnma-tools/systemd/bpecho@.service /usr/local/lib/systemd/system/ |
86 | | -COPY --chmod=644 dtnma-tools/systemd/ion-stats.timer /usr/local/lib/systemd/system/ |
87 | | -RUN systemctl enable ion bpecho@4 |
| 87 | +COPY dtnma-tools/deps/timespec /usr/local/src/nm/deps/timespec |
| 88 | +COPY dtnma-tools/deps/timespec-CMakeLists.txt /usr/local/src/nm/deps/timespec/CMakeLists.txt |
| 89 | +RUN cd /usr/local/src/nm/deps/timespec && \ |
| 90 | + cmake -S . -B build \ |
| 91 | + -DCMAKE_BUILD_TYPE=Debug && \ |
| 92 | + cmake --build build && \ |
| 93 | + cmake --install build && \ |
| 94 | + ldconfig && \ |
| 95 | + rm -rf build |
88 | 96 |
|
89 | 97 |
|
90 | | -# Proxy-isolated manager, no ION |
91 | | -FROM deps-base AS amp-manager |
| 98 | +FROM systemd-base AS testenv |
| 99 | +COPY --from=deps-local /usr/local /usr/local |
92 | 100 |
|
93 | | -COPY dtnma-tools/deps /usr/local/src/dtnma-tools/deps |
94 | | -COPY dtnma-tools/cmake /usr/local/src/dtnma-tools/cmake |
95 | | -COPY dtnma-tools/src /usr/local/src/dtnma-tools/src |
96 | | -COPY dtnma-tools/test /usr/local/src/dtnma-tools/test |
97 | | -COPY dtnma-tools/CMakeLists.txt /usr/local/src/dtnma-tools/ |
98 | | -RUN cd /usr/local/src/dtnma-tools && \ |
| 101 | +# Helper utilities |
| 102 | +RUN apt-get update && apt-get install -y \ |
| 103 | + python3 python3-pip |
| 104 | +COPY --chmod=755 dtnma-tools/systemd/service_is_running.sh /usr/local/bin/service_is_running |
| 105 | + |
| 106 | +# Test tools |
| 107 | +RUN apt-get update && apt-get install -y \ |
| 108 | + curl git tshark postgresql-client |
| 109 | +RUN pip3 install --break-system-packages git+https://github.com/JHUAPL-DTNMA/dtnma-ace.git@apl-fy24 |
| 110 | +RUN git clone --branch apl-fy24 https://github.com/JHUAPL-DTNMA/dtnma-adms.git /usr/local/share/ace/adms |
| 111 | + |
| 112 | +# REFDA and REFDM to test |
| 113 | +RUN apt-get update && apt-get install -y \ |
| 114 | + cmake ninja-build ruby pkg-config \ |
| 115 | + flex libfl-dev bison libpcre2-dev libpq-dev civetweb libcivetweb-dev libssl-dev libcjson-dev libsystemd-dev |
| 116 | +COPY dtnma-tools/deps /usr/local/src/nm/deps |
| 117 | +COPY dtnma-tools/cmake /usr/local/src/nm/cmake |
| 118 | +COPY dtnma-tools/src /usr/local/src/nm/src |
| 119 | +COPY dtnma-tools/CMakeLists.txt /usr/local/src/nm/ |
| 120 | +RUN ls -lt /usr/local/src/nm/ |
| 121 | +RUN cd /usr/local/src/nm && \ |
99 | 122 | cmake -S . -B build/default \ |
100 | | - -DCMAKE_BUILD_TYPE=Debug \ |
101 | | - -DBUILD_AGENT=OFF -DBUILD_MANAGER=ON -DBUILD_PROXY=OFF -DTRANSPORT_PROXY_SOCKET=ON -DTRANSPORT_ION_BP=OFF \ |
102 | | - -DBUILD_TESTING=OFF \ |
103 | | - -G Ninja && \ |
| 123 | + -DCMAKE_BUILD_TYPE=Debug \ |
| 124 | + -DBUILD_ION_PROXY=ON \ |
| 125 | + -DTRANSPORT_UNIX_SOCKET=OFF \ |
| 126 | + -DTRANSPORT_PROXY_SOCKET=ON \ |
| 127 | + -DTRANSPORT_ION_BP=ON \ |
| 128 | + -DBUILD_TESTING=OFF \ |
| 129 | + -DBUILD_DOCS_API=OFF -DBUILD_DOCS_MAN=OFF \ |
| 130 | + -G Ninja && \ |
104 | 131 | cmake --build build/default && \ |
105 | | - cmake --install build/default |
| 132 | + cmake --install build/default && \ |
| 133 | + ldconfig |
| 134 | +# keep build artifacts for debuginfo |
106 | 135 |
|
107 | | -COPY --chmod=644 dtnma-tools/systemd/nm-mgr-proxy.service /usr/local/lib/systemd/system/ |
108 | | -RUN systemctl enable nm-mgr-proxy && \ |
109 | | - mkdir -p /var/run/ion |
110 | 136 |
|
111 | | -HEALTHCHECK --start-period=10s --interval=30s --timeout=5s --retries=5 \ |
112 | | - CMD ["service_is_running", "nm-mgr-proxy"] |
| 137 | +FROM testenv AS amp-manager |
113 | 138 |
|
| 139 | +# Systemd services |
| 140 | +COPY --chmod=644 dtnma-tools/systemd/refdm-proxy.service \ |
| 141 | + /usr/local/lib/systemd/system/ |
| 142 | +RUN systemctl enable refdm-proxy |
114 | 143 |
|
115 | | -# ION and app proxy |
116 | | -FROM ion-base AS ion-manager |
| 144 | +EXPOSE 8089/tcp |
117 | 145 |
|
118 | | -# Agent to test |
119 | | -COPY dtnma-tools/deps /usr/local/src/dtnma-tools/deps |
120 | | -COPY dtnma-tools/cmake /usr/local/src/dtnma-tools/cmake |
121 | | -COPY dtnma-tools/src /usr/local/src/dtnma-tools/src |
122 | | -COPY dtnma-tools/test /usr/local/src/dtnma-tools/test |
123 | | -COPY dtnma-tools/CMakeLists.txt /usr/local/src/dtnma-tools/ |
124 | | -RUN cd /usr/local/src/dtnma-tools && \ |
125 | | - cmake -S . -B build/default \ |
126 | | - -DCMAKE_BUILD_TYPE=Debug \ |
127 | | - -DBUILD_AGENT=ON -DBUILD_MANAGER=OFF -DBUILD_PROXY=ON -DTRANSPORT_PROXY_SOCKET=OFF -DTRANSPORT_ION_BP=ON \ |
128 | | - -DBUILD_TESTING=OFF \ |
129 | | - -G Ninja && \ |
130 | | - cmake --build build/default && \ |
131 | | - cmake --install build/default |
132 | 146 |
|
133 | | -COPY test-ion-configs/mgr.rc /etc/ion/node-1.rc |
134 | | -COPY --chmod=644 dtnma-tools/systemd/ion-app-proxy.service dtnma-tools/systemd/ion-nm-agent.service /usr/local/lib/systemd/system/ |
135 | | -RUN systemctl enable ion-app-proxy ion-nm-agent && \ |
| 147 | +FROM testenv AS ion-manager |
| 148 | + |
| 149 | +# Systemd services |
| 150 | +COPY integration-test-ion/tmpfiles.conf /etc/tmpfiles.d/ion.conf |
| 151 | +COPY --chmod=644 dtnma-tools/systemd/ion.service dtnma-tools/systemd/ion-app-proxy.service dtnma-tools/systemd/bpecho@.service dtnma-tools/systemd/dumpcap.service \ |
| 152 | + /usr/local/lib/systemd/system/ |
| 153 | +RUN systemctl enable ion bpecho@4 ion-app-proxy dumpcap && \ |
136 | 154 | mkdir -p /var/run/ion |
137 | 155 |
|
138 | | -HEALTHCHECK --start-period=10s --interval=30s --timeout=5s --retries=5 \ |
139 | | - CMD ["service_is_running", "ion", "ion-app-proxy"] |
| 156 | +# Runtime config for this container |
| 157 | +COPY test-ion-configs/mgr.rc /etc/ion/node-1.rc |
140 | 158 |
|
141 | 159 |
|
142 | | -# ION and direct agent |
143 | | -FROM ion-base AS ion-agent |
| 160 | +EXPOSE 4556/udp |
144 | 161 |
|
145 | | -# Agent to test |
146 | | -COPY dtnma-tools/deps /usr/local/src/dtnma-tools/deps |
147 | | -COPY dtnma-tools/cmake /usr/local/src/dtnma-tools/cmake |
148 | | -COPY dtnma-tools/src /usr/local/src/dtnma-tools/src |
149 | | -COPY dtnma-tools/test /usr/local/src/dtnma-tools/test |
150 | | -COPY dtnma-tools/CMakeLists.txt /usr/local/src/dtnma-tools/ |
151 | | -RUN cd /usr/local/src/dtnma-tools && \ |
152 | | - cmake -S . -B build/default \ |
153 | | - -DCMAKE_BUILD_TYPE=Debug \ |
154 | | - -DBUILD_AGENT=ON -DBUILD_MANAGER=OFF -DBUILD_PROXY=OFF -DTRANSPORT_PROXY_SOCKET=OFF -DTRANSPORT_ION_BP=ON \ |
155 | | - -DBUILD_TESTING=OFF \ |
156 | | - -G Ninja && \ |
157 | | - cmake --build build/default && \ |
158 | | - cmake --install build/default |
159 | 162 |
|
160 | | - COPY test-ion-configs/agent-2.rc /etc/ion/node-2.rc |
161 | | - COPY test-ion-configs/agent-3.rc /etc/ion/node-3.rc |
162 | | -COPY --chmod=644 dtnma-tools/systemd/ion-nm-agent.service /usr/local/lib/systemd/system/ |
163 | | -RUN systemctl enable ion-nm-agent && \ |
| 163 | +FROM testenv AS agent |
| 164 | + |
| 165 | +# Systemd services |
| 166 | +COPY dtnma-tools/integration-test-ion/tmpfiles.conf /etc/tmpfiles.d/ion.conf |
| 167 | +COPY --chmod=644 dtnma-tools/systemd/ion.service dtnma-tools/systemd/refda-ion.service dtnma-tools/systemd/bpecho@.service dtnma-tools/systemd/dumpcap.service \ |
| 168 | + /usr/local/lib/systemd/system/ |
| 169 | +RUN systemctl enable ion bpecho@4 refda-ion dumpcap && \ |
164 | 170 | mkdir -p /var/run/ion |
165 | 171 |
|
166 | | -HEALTHCHECK --start-period=10s --interval=30s --timeout=5s --retries=5 \ |
167 | | - CMD ["service_is_running", "ion", "ion-nm-agent"] |
| 172 | +# Runtime config for this container |
| 173 | +COPY test-ion-configs/agent-2.rc /etc/ion/node-2.rc |
| 174 | +COPY test-ion-configs/agent-3.rc /etc/ion/node-3.rc |
| 175 | + |
| 176 | + |
| 177 | +EXPOSE 4556/udp |
0 commit comments