Skip to content

Commit c0a2726

Browse files
author
David Linko
committed
updated to latest dtnma-tools
1 parent 169f322 commit c0a2726

File tree

5 files changed

+159
-140
lines changed

5 files changed

+159
-140
lines changed

.env

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,4 +49,4 @@ RENDERER_PORT=8081
4949
RENDERER_HOST_PORT=${DOCKER_CTR_PREFIX}grafana-image-renderer:${RENDERER_PORT}
5050
ION_MGR_PORT=8089
5151
HTTP_PORT:80
52-
52+
SOCKDIR=/var/tmp/nm

deps/dtnma-tools

Submodule dtnma-tools updated 474 files

deps/reftools.Dockerfile

Lines changed: 134 additions & 124 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
##
2-
## Copyright (c) 2023 The Johns Hopkins University Applied Physics
2+
## Copyright (c) 2011-2024 The Johns Hopkins University Applied Physics
33
## Laboratory LLC.
44
##
55
## This file is part of the Delay-Tolerant Networking Management
@@ -15,153 +15,163 @@
1515
## See the License for the specific language governing permissions and
1616
## limitations under the License.
1717
##
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 && \
3766
make -j$(nproc) && \
3867
make install && \
3968
make -j$(nproc) clean
4069

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 && \
4382
make -j$(nproc) && \
4483
make install && \
84+
ldconfig && \
4585
make -j$(nproc) clean
4686

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
8896

8997

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
92100

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 && \
99122
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 && \
104131
cmake --build build/default && \
105-
cmake --install build/default
132+
cmake --install build/default && \
133+
ldconfig
134+
# keep build artifacts for debuginfo
106135

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
110136

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
113138

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
114143

115-
# ION and app proxy
116-
FROM ion-base AS ion-manager
144+
EXPOSE 8089/tcp
117145

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
132146

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 && \
136154
mkdir -p /var/run/ion
137155

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
140158

141159

142-
# ION and direct agent
143-
FROM ion-base AS ion-agent
160+
EXPOSE 4556/udp
144161

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
159162

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 && \
164170
mkdir -p /var/run/ion
165171

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

docker-compose.yml

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ networks:
3737
volumes:
3838
grafana-data: {}
3939
postgres-data: {}
40+
sockdir:
41+
# shared sockets
4042
opensearch: {}
4143
ammos-tls:
4244
external: true
@@ -141,9 +143,10 @@ services:
141143

142144
postgres:
143145
hostname: postgres
144-
image: ${DOCKER_CTR_PREFIX}amp-sql:${DOCKER_IMAGE_TAG}
146+
image: ${DOCKER_CTR_PREFIX}refdb-sql:${DOCKER_IMAGE_TAG}
145147
build:
146-
context: amp-sql
148+
context: deps/dtnma-tools/refdb-sql
149+
dockerfile: Containerfile
147150
restart: unless-stopped
148151
security_opt:
149152
- "label=type:postgres.process"
@@ -329,17 +332,9 @@ services:
329332
context: deps
330333
dockerfile: reftools.Dockerfile
331334
target: amp-manager
332-
restart: unless-stopped
333-
security_opt:
334-
- "label=type:amp-manager.process"
335-
volumes:
336-
- "${ANMS_RUN_DIR:-/run/anms}:/var/tmp/anms"
337335
ports:
338-
- "${ION_MGR_PORT:-8089}:8089"
336+
- "8089:8089/tcp"
339337
depends_on:
340-
builder-init:
341-
# Not expected to run, but needed here to ensure build dependency
342-
condition: service_started
343338
postgres:
344339
condition: service_healthy
345340
privileged: true
@@ -348,12 +343,16 @@ services:
348343
- NET_ADMIN
349344
- NET_RAW
350345
- SYS_NICE
346+
volumes:
347+
- "${ANMS_RUN_DIR:-/run/anms}:${SOCKDIR}"
351348
environment:
352349
container: docker
353-
ION_APP_PROXY_SOCK: /var/tmp/anms/ion-proxy.socket
350+
DTNMA_LOGLEVEL: debug
351+
AMP_PROXY_SOCKET: "${SOCKDIR}/proxy.sock"
354352
DB_HOST: postgres
355353
DB_USER: ${DB_USER}
356354
DB_PASSWORD: ${DB_PASSWORD}
357355
DB_NAME: ${DB_NAME}
358-
356+
357+
359358

0 commit comments

Comments
 (0)