Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

73 switching ion to dtnma tools #79

Merged
merged 12 commits into from
May 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
url = ../anms-camp.git
[submodule "ion/src"]
path = ion/src
url = https://git.code.sf.net/p/ion-dtn/code
branch = stable
url = https://github.com/JHUAPL/dtnma-tools.git


87 changes: 61 additions & 26 deletions ion/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
## Copyright (c) 2023 The Johns Hopkins University Applied Physics
## Laboratory LLC.
##
## This file is part of the Asynchronous Network Management System (ANMS).
## This file is part of the Delay-Tolerant Networking Management
## Architecture (DTNMA) Tools package.
##
## Licensed under the Apache License, Version 2.0 (the "License");
## you may not use this file except in compliance with the License.
Expand All @@ -14,36 +15,68 @@
## See the License for the specific language governing permissions and
## limitations under the License.
##
## This work was performed for the Jet Propulsion Laboratory, California
## Institute of Technology, sponsored by the United States Government under
## the prime contract 80NM0018D0004 between the Caltech and NASA under
## subcontract 1658085.
##

FROM anms-init AS ion-base

# Dependencies for NM Mgr tests/dotest
RUN dnf -y install \
patch autoconf libtool make gcc gcc-c++ libpq-devel \
perl-CPAN \
gdb less && \
RUN dnf install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm
RUN dnf install -y \
autoconf libtool \
cmake ninja-build \
ruby rsync git \
systemd systemd-sysv \
patch autoconf libtool \
make gcc gcc-c++ libpq-devel \
civetweb-devel cjson-devel\
perl-CPAN \
gdb less && \
dnf clean all && rm -rf /var/cache/yum && \
PERL_MM_USE_DEFAULT=1 cpan -T JSON REST::Client Expect File::Slurp

# Build from added source
COPY src *.patch /usr/src/ion-ios/
RUN cd /usr/src/ion-ios && \
patch -p1 <ion-4.1.1-anms-db.patch && \
patch -p1 <ion-4.1.2-local-deliver.patch && \
patch -p1 <ion-4.1.1-amp-filestructure.patch && \
patch -p1 <dtnma-tools-nm_rest.patch && \
COPY src/deps/ion /usr/src/nm/deps/ion
COPY src/deps/ion*.patch /usr/src/nm/deps/
RUN cd /usr/src/nm/deps/ion && \
patch -p1 <../ion-4.1.2-remove-nm.patch && \
patch -p1 <../ion-4.1.2-local-deliver.patch && \
patch -p1 <../ion-4.1.2-private-headers.patch && \
autoreconf -vif && \
./configure --with-postgresql --enable-nmrest && \
./configure \
--prefix=/usr/local --libdir=/usr/local/lib64 && \
make -j$(nproc) && \
make install && \
echo /usr/local/lib64 > /etc/ld.so.conf.d/local.conf && \
ldconfig

COPY src/deps/QCBOR /usr/src/nm/deps/QCBOR
COPY src/deps/qcbor*.patch /usr/src/nm/deps/
RUN cd /usr/src/nm/deps/QCBOR && \
patch -p1 <../qcbor-install.patch && \
patch -p2 <../qcbor-expose-private.patch && \
make -j$(nproc) && \
make install && \
ldconfig && \
rm -rf /usr/src/ion-ios
make -j$(nproc) clean

COPY src/deps/mlib /usr/src/nm/deps/mlib
RUN cd /usr/src/nm/deps/mlib && \
make -j$(nproc) && \
make install && \
make -j$(nproc) clean



# Agent to test
COPY src/deps /usr/src/nm/deps
COPY src/cmake /usr/src/nm/cmake
COPY src/src /usr/src/nm/src
COPY src/test /usr/src/nm/test
COPY src/CMakeLists.txt /usr/src/nm/
RUN ls -lt /usr/src/nm/
RUN cd /usr/src/nm && \
cmake -S . -B build/default \
-DCMAKE_BUILD_TYPE=Debug \
-G Ninja && \
cmake --build build/default && \
cmake --install build/default

# Helper utilities
RUN dnf -y install \
python3 python3-pip \
gcc python3-devel systemd-devel && \
Expand All @@ -54,7 +87,7 @@ COPY --chmod=755 utils/service_is_running.sh /usr/local/bin/service_is_running
COPY --chmod=755 utils/ion_restart_ducts.sh /usr/local/bin/ion_restart_ducts
COPY --chmod=755 utils/ion_ping_peers.sh /usr/local/bin/ion_ping_peers

# Service configuration
# Systemd services
COPY tmpfiles.conf /etc/tmpfiles.d/ion.conf
COPY --chmod=644 systemd/ion.service systemd/ion-stats.service systemd/[email protected] /usr/local/lib/systemd/system/
COPY --chmod=644 systemd/ion-stats.timer /usr/local/lib/systemd/system/
Expand All @@ -64,7 +97,8 @@ FROM ion-base AS ion-manager
COPY configs/simple-2-node/mgr.rc /etc/ion.rc

COPY --chmod=644 systemd/ion-nm-mgr.service systemd/ion-nm-agent.service /usr/local/lib/systemd/system/
RUN systemctl enable ion-nm-mgr ion-nm-agent
RUN systemctl enable ion-nm-mgr ion-nm-agent && \
mkdir -p /var/run/ion

HEALTHCHECK --start-period=10s --interval=30s --timeout=5s --retries=5 \
CMD ["service_is_running", "ion", "ion-nm-mgr"]
Expand All @@ -74,7 +108,8 @@ FROM ion-base AS ion-agent
COPY configs/simple-2-node/agent.rc.in /etc/ion.rc

COPY --chmod=644 systemd/ion-nm-agent.service /usr/local/lib/systemd/system/
RUN systemctl enable ion-nm-agent
RUN systemctl enable ion-nm-agent && \
mkdir -p /var/run/ion

HEALTHCHECK --start-period=10s --interval=30s --timeout=5s --retries=5 \
CMD ["service_is_running", "ion", "ion-nm-agent"]
CMD ["service_is_running", "ion", "ion-nm-agent"]
2 changes: 1 addition & 1 deletion ion/src
Submodule src updated from be66a1 to 416130
1 change: 1 addition & 0 deletions ion/systemd/[email protected]
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ Requires=ion.service
[Service]
Type=simple
PassEnvironment=ION_NODE_NUM
EnvironmentFile=-/etc/ion/environment
ExecStart=bpecho ipn:${ION_NODE_NUM}.%i

[Install]
Expand Down
7 changes: 5 additions & 2 deletions ion/systemd/ion-nm-agent.service
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
[Unit]
Description=ION NM Agent
After=network-online.target ion.service ion-nm-mgr.service
Wants=network-online.target
Wants=network-online.target ion-nm-mgr.service
Requires=ion.service

[Service]
Type=notify
PassEnvironment=ION_NODE_NUM MGR_NODE_NUM
EnvironmentFile=-/etc/ion/environment
ExecStart=ion_nm_wrap --listen /var/run/nm_agent.socket -- \
nm_agent ipn:${ION_NODE_NUM}.6 ipn:${MGR_NODE_NUM}.7
ion_nm_agent ipn:${ION_NODE_NUM}.6 ipn:${MGR_NODE_NUM}.7
# workaround for OSAL blocking SIGTERM
KillSignal=SIGINT

[Install]
WantedBy=multi-user.target
5 changes: 4 additions & 1 deletion ion/systemd/ion-nm-mgr.service
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,15 @@ Requires=ion.service
[Service]
Type=notify
PassEnvironment=ION_NODE_NUM DB_HOST DB_NAME DB_USER DB_PASSWORD
EnvironmentFile=-/etc/ion/environment
ExecStart=ion_nm_wrap --listen /var/run/nm_mgr.socket -- \
nm_mgr -A ipn:${ION_NODE_NUM}.7 \
ion_nm_mgr -A ipn:${ION_NODE_NUM}.7 \
--sql-host ${DB_HOST} \
--sql-db ${DB_NAME} \
--sql-user ${DB_USER} \
--sql-pass ${DB_PASSWORD}
# workaround for OSAL blocking SIGTERM
KillSignal=SIGINT

[Install]
WantedBy=multi-user.target
Expand Down
Loading