Skip to content

Commit

Permalink
[script] rename Docker container to ot-registrar:latest and some upda…
Browse files Browse the repository at this point in the history
…tes.
  • Loading branch information
EskoDijk committed Jun 27, 2024
1 parent c9f693f commit 62816a8
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 15 deletions.
11 changes: 6 additions & 5 deletions script/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
# POSSIBILITY OF SUCH DAMAGE.
#

FROM ubuntu:18.04
FROM ubuntu:22.04

RUN apt-get update

Expand All @@ -37,7 +37,7 @@ RUN apt-get install maven git sudo lsb-core net-tools -y

#RUN add-apt-repository ppa:openjdk-r/ppa
#RUN apt-get update
RUN apt-get install openjdk-8-jdk -y
RUN apt-get install openjdk-11-jdk -y
RUN java -version

WORKDIR /home/ot-registrar
Expand All @@ -46,10 +46,11 @@ COPY . .

# RUN mvn clean package

# CMD triggers a warning as per https://docs.docker.com/reference/build-checks/json-args-recommended/
# FIXME check if it should be CMD or SHELL; and if the 'bash' part should be split off.
CMD ./script/run-servers.sh && bash

# TODO: enable ports to let Registrar receive external traffic (5684).
#EXPOSE 5683:5683/udp

#EXPOSE 5684:5684/udp

EXPOSE 5684:5684/udp
#EXPOSE 5685:5685/udp
15 changes: 9 additions & 6 deletions script/build-docker-image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
set -e

readonly IMAGE_NAME=ot-registrar
readonly VERSION=latest

# Enable ipv6
if [ ! -f /etc/docker/daemon.json ]; then
Expand All @@ -38,12 +39,14 @@ if [ ! -f /etc/docker/daemon.json ]; then
sudo systemctl restart docker
fi

# Create docker image if not exist
# Create docker image if not existing yet
if ! $(sudo docker image ls | grep -q "${IMAGE_NAME}"); then
# Building package
echo "building OT Registrar package..."
mvn clean -Dmaven.test.skip=true package

echo "building docker image..."
sudo docker build --no-cache -f script/Dockerfile -t ubuntu:${IMAGE_NAME} .
sudo docker build --no-cache -f script/Dockerfile -t ${IMAGE_NAME}:${VERSION} .
else
echo "Docker image '${IMAGE_NAME}' is already present."
fi

# Building package
echo "building OT Registrar package..."
mvn clean -Dmaven.test.skip=true package
2 changes: 1 addition & 1 deletion script/run-servers.sh
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ rm -rf $LOGS
mkdir -p $LOGS

echo "starting Registrar server (CoAPS), log=${REGISTRAR_LOG}..."
./script/run -registrar -v -d $DOMAIN_NAME -f $CREDENTIAL \
./script/run -registrar -v -d $DOMAIN_NAME -f $CREDENTIAL -m localhost:9994 \
>> $REGISTRAR_LOG 2>&1 &

echo "starting MASA server (HTTPS), log=${MASA_LOG}..."
Expand Down
4 changes: 2 additions & 2 deletions script/start-service.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ echo "creating subnet ${NETWORK}=${SUBNET} ..."
sudo docker network rm $NETWORK
sudo docker network create --ipv6 --subnet=$SUBNET $NETWORK

echo "starting registrar(ip=${IP6_ADDR}) container..."
echo "starting ot-registrar(ip=${IP6_ADDR}) container..."
sudo docker run -dt --privileged \
--network $NETWORK --ip6 $IP6_ADDR \
--sysctl 'net.ipv6.conf.all.disable_ipv6=0 net.ipv4.conf.all.forwarding=1 net.ipv6.conf.all.forwarding=1' \
-v $ROOT_DIR:/home/ot-registrar \
ubuntu:ot-registrar
ot-registrar:latest
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@

package com.google.openthread.main;

import com.google.openthread.brski.ConstantsBrski;

public class OtRegistrarConfig {

public Role role;
Expand Down Expand Up @@ -65,7 +67,7 @@ static OtRegistrarConfig DefaultRegistrar() {
static OtRegistrarConfig DefaultMasa() {
OtRegistrarConfig config = new OtRegistrarConfig();
config.role = Role.Masa;
config.serverPort = 9443; // re-using corporate TLS/HTTPS port
config.serverPort = ConstantsBrski.DEFAULT_MASA_HTTPS_PORT; // re-using corporate TLS/HTTPS port
config.domainName = null;
config.keyStoreFile = "./credentials/default_masa.p12";
config.masaUri = null;
Expand Down

0 comments on commit 62816a8

Please sign in to comment.