-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding all essential files for running modem process in docker
- Loading branch information
Showing
7 changed files
with
240 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#!/bin/bash | ||
|
||
#Set up the repository-------------- | ||
sudo apt-get update | ||
sudo apt-get install \ | ||
ca-certificates \ | ||
curl \ | ||
gnupg \ | ||
lsb-release | ||
sudo mkdir -p /etc/apt/keyrings | ||
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg | ||
echo \ | ||
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \ | ||
$(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null | ||
|
||
|
||
#Install Docker Engine ----------------------- | ||
|
||
sudo apt-get update | ||
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-compose-plugin | ||
sudo docker run hello-world | ||
|
||
# Configuring docker to start on boot with systemd | ||
sudo systemctl enable docker.service | ||
sudo systemctl enable containerd.service |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
modem: { | ||
sdr: { | ||
center_frequency_hz = 640500000L; | ||
filter_bandwidth_hz = 5000000; | ||
search_sample_rate = 7680000; | ||
normalized_gain = 30.0; | ||
device_args = "driver=bladerf"; | ||
antenna = "RX"; | ||
rx_channels =1; | ||
|
||
ringbuffer_size_ms = 200; | ||
reader_thread_priority_rt = 50; | ||
} | ||
|
||
phy: { | ||
threads = 4; | ||
thread_priority_rt = 10; | ||
main_thread_priority_rt = 20; | ||
#allow_rrc_sn_across_periods = true; | ||
} | ||
|
||
restful_api: { | ||
uri: "http://172.17.0.2:3010/modem-api/"; | ||
cert: "/usr/share/5gmag-rt/cert.pem"; | ||
key: "/usr/share/5gmag-rt/key.pem"; | ||
api_key: | ||
{ | ||
enabled: false; | ||
key: "106cd60-76c8-4c37-944c-df21aa690c1e"; | ||
} | ||
} | ||
|
||
measurement_file: { | ||
enabled: false; | ||
file_path: "/tmp/modem_measurements.csv"; | ||
interval_secs: 10; | ||
gpsd: | ||
{ | ||
enabled: false; | ||
host: "172.17.0.2"; | ||
port: "2947"; | ||
} | ||
} | ||
} | ||
|
||
mw: { | ||
cache: { | ||
#max_segments_per_stream: 30; | ||
max_file_age: 30; | ||
#max_file_age: 120; /* seconds */ | ||
max_total_size: 512 | ||
#max_total_size: 128; /* megabyte */ | ||
} | ||
http_server: { | ||
uri: "http://172.17.0.3:3020/"; | ||
api_path: "mw-api"; | ||
cert: "/usr/share/5gmag-rt/cert.pem"; | ||
key: "/usr/share/5gmag-rt/key.pem"; | ||
api_key: | ||
{ | ||
enabled: false; | ||
key: "106cd60-76c8-4c37-944c-df21aa690c1e"; | ||
} | ||
} | ||
control_system: { | ||
enabled: false; | ||
interval: 20; //seconds | ||
endpoint: "https://5gbc.ors-aws.cloud/obeca-api"; | ||
} | ||
seamless_switching: { | ||
enabled: false; | ||
truncate_cdn_playlist_segments: 3 | ||
} | ||
bootstrap_format: "5gmag_legacy"; | ||
local_service: { | ||
enabled: false; | ||
bootstrap_file: ""; | ||
mcast_address: "238.1.1.95:40085"; | ||
lcid: 1; | ||
tmgi: "00000009f165"; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
FROM ubuntu:20.04 as BUILDER | ||
WORKDIR / | ||
########################################################### | ||
## DEPENDENCIES | ||
########################################################### | ||
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get -y install \ | ||
tzdata \ | ||
software-properties-common \ | ||
ssh g++ git \ | ||
libboost-atomic-dev libboost-thread-dev libboost-system-dev \ | ||
libboost-date-time-dev libboost-regex-dev libboost-filesystem-dev \ | ||
libboost-random-dev libboost-chrono-dev libboost-serialization-dev \ | ||
libwebsocketpp-dev openssl libssl-dev ninja-build libspdlog-dev \ | ||
libmbedtls-dev libboost-all-dev libconfig++-dev libsctp-dev libfftw3-dev \ | ||
vim \ | ||
libcpprest-dev libusb-1.0-0-dev \ | ||
python-psutil python3-pip clang-tidy \ | ||
gpsd gpsd-clients libgps-dev \ | ||
cmake \ | ||
uml-utilities | ||
|
||
|
||
RUN pip3 install cpplint | ||
RUN mkdir -p /opt/install | ||
|
||
########################################################### | ||
## LIME SUITE | ||
########################################################### | ||
ARG LIME_SUITE_COMMIT=28031bfcffe1e8fa393c7db88d4fe370fb4c67ea | ||
RUN mkdir -p /opt/build/limesuite | ||
WORKDIR /opt/build/limesuite | ||
RUN apt-get -y install libsoapysdr-dev soapysdr-tools | ||
RUN git clone https://github.com/myriadrf/LimeSuite.git . && \ | ||
git checkout ${LIME_SUITE_COMMIT} | ||
RUN mkdir buildir && cd buildir && \ | ||
cmake -DCMAKE_INSTALL_PREFIX=/opt/install -GNinja .. && \ | ||
ninja && ninja install && \ | ||
ldconfig | ||
|
||
########################################################### | ||
## RT-MBMS-MODEM | ||
########################################################### | ||
RUN mkdir -p /opt/build/modem | ||
WORKDIR /opt/build/modem | ||
RUN git clone --recurse-submodules https://github.com/kuehnhammer/rt-mbms-modem.git . && git checkout development && git submodule update | ||
RUN mkdir build && cd build && \ | ||
cmake -DCMAKE_INSTALL_PREFIX=/opt/install -GNinja .. && \ | ||
ninja && ninja install && \ | ||
ldconfig | ||
|
||
########################################################### | ||
## RELEASE | ||
########################################################### | ||
FROM ubuntu:20.04 as RELEASE | ||
|
||
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install \ | ||
iproute2 \ | ||
uml-utilities \ | ||
openssl \ | ||
libconfig++ \ | ||
libfftw3-bin \ | ||
libcpprest \ | ||
libgps26 \ | ||
libsoapysdr-dev \ | ||
soapysdr-tools \ | ||
libmbedtls12 \ | ||
libspdlog-dev \ | ||
net-tools smcroute \ | ||
soapysdr-module-bladerf \ | ||
-y | ||
COPY --from=BUILDER /opt/install/ /usr | ||
COPY 5gmag-rt.conf /etc/ | ||
RUN bladeRF-install-firmware | ||
RUN useradd 5gmag-rt | ||
|
||
WORKDIR /usr/share/5gmag-rg | ||
RUN openssl genrsa -des3 -passout pass:temporary -out key.pem 2048 && \ | ||
openssl req -new -batch -key key.pem -out cert.csr -passin pass:temporary && \ | ||
openssl rsa -in key.pem -passin pass:temporary -out key.pem && \ | ||
openssl x509 -req -days 3650 -in cert.csr -signkey key.pem -out cert.pem && \ | ||
chown 5gmag-rt:5gmag-rt *.pem | ||
|
||
|
||
# Automatically set up multicast packet routing from the tun interface to a network interface | ||
|
||
RUN ldd /usr/bin/modem | ||
COPY scripts/startup.sh /usr/bin/startup | ||
RUN chmod a+x /usr/bin/startup | ||
|
||
WORKDIR / | ||
EXPOSE 3010 5520 2947 | ||
ENTRYPOINT [ "/usr/bin/startup" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
#!/bin/bash | ||
docker build . -t modemimg |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/bin/bash | ||
|
||
docker exec -it modem bash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#!/bin/bash | ||
docker stop modemc && docker rm modemc | ||
docker run -d --rm \ | ||
--device /dev/net/tun:/dev/net/tun \ | ||
--device /var/run/smcroute.sock:/var/run/smcroute.sock \ | ||
--device /dev/bus/usb:/dev/bus/usb \ | ||
-v /var/run/dbus:/var/run/dbus \ | ||
-v /var/run/avahi-daemon/socket:/var/run/avahi-daemon/socket \ | ||
--volume /home/ors/Downloads:/var/data \ | ||
--privileged \ | ||
--name modemc \ | ||
modemimg | ||
docker logs -f modemc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#!/bin/bash | ||
|
||
# The tun interface to be created for the receive process | ||
MODEM_TUN_INTERFACE="mbms_modem_tun" | ||
MODEM_TUN_ADDRESS="192.168.180.10" | ||
|
||
# Automatically set up multicast packet routing from the tun interface to a network interface | ||
ENABLE_MCAST_ROUTING=true | ||
MCAST_ROUTE_TARGET="eth0" | ||
|
||
echo $MODEM_TUN_INTERFACE | ||
ip tuntap add mode tun $MODEM_TUN_INTERFACE | ||
ifconfig $MODEM_TUN_INTERFACE up $MODEM_TUN_ADDRESS | ||
sysctl -w net.ipv4.conf.$MODEM_TUN_INTERFACE.rp_filter=0 | ||
if [ "$ENABLE_MCAST_ROUTING" = true ] ; then | ||
smcrouted -P /var/run/smcroute.sock | ||
smcroutectl restart | ||
smcroutectl add $MODEM_TUN_INTERFACE 224.0.0.0/4 $MCAST_ROUTE_TARGET | ||
fi | ||
|
||
#------------------------Run the modem application ------------------------------- | ||
|
||
/usr/bin/modem -f /var/data/3MHz_MCS16_1kHz25_HLS_q6a.raw -b 3 |