diff --git a/Dockerfiles/forContainerNet/bootserver/Dockerfile b/Dockerfiles/forContainerNet/bootserver/Dockerfile index 74e7a2e..70df60a 100644 --- a/Dockerfiles/forContainerNet/bootserver/Dockerfile +++ b/Dockerfiles/forContainerNet/bootserver/Dockerfile @@ -5,6 +5,7 @@ FROM node:buster RUN apt-get update && \ apt-get install -y net-tools iputils-ping python-pip && \ pip install flask && \ + pip install requests && \ mkdir mydir && \ cd mydir diff --git a/Dockerfiles/forContainerNet/bootserver/bootstrap_client.py b/Dockerfiles/forContainerNet/bootserver/bootstrap_client.py index b8e9d5d..6e34c43 100755 --- a/Dockerfiles/forContainerNet/bootserver/bootstrap_client.py +++ b/Dockerfiles/forContainerNet/bootserver/bootstrap_client.py @@ -3,12 +3,16 @@ import os import subprocess import requests + +BOOTSTRAP_SERVER_ADDRESS = '10.10.10.10:5555' + def retrieve_config(): my_config = "None" my_ip = subprocess.check_output("sleep 5 && echo $MY_IP", shell=True).rstrip() - resp = requests.get("http://10.10.10.10:5555/getmyconfig/%s"%(my_ip)) + resp = requests.get("http://%s/getmyconfig/%s"%(BOOTSTRAP_SERVER_ADDRESS, my_ip)) my_config = resp.text if my_config != "None": subprocess.check_output("node /mydir/*.js %s"%(my_config), shell=True) #print("my_ip=%s and of type %s"%(my_ip,type(my_ip))) +retrieve_config() diff --git a/Dockerfiles/forContainerNet/device/Dockerfile b/Dockerfiles/forContainerNet/device/Dockerfile index e86ad2e..1342c09 100644 --- a/Dockerfiles/forContainerNet/device/Dockerfile +++ b/Dockerfiles/forContainerNet/device/Dockerfile @@ -1,17 +1,11 @@ # Choosing the image to use FROM node:buster -# Defining variables to allow flexibility (each variable can be set directly within our topology deployment script) -ENV local_ip=127.0.0.1 -ENV local_port=9001 -ENV local_name=dev1 -ENV remote_ip=127.0.0.1 -ENV remote_port=8282 -ENV remote_name=gwf1 - # Installing required libraries RUN apt-get update && \ - apt-get install -y net-tools iputils-ping && \ + apt-get install -y net-tools iputils-ping python-pip && \ + pip install flask && \ + pip install requests && \ mkdir mydir && \ cd mydir && \ npm install express && \ @@ -20,11 +14,14 @@ RUN apt-get update && \ npm install request && \ wget http://homepages.laas.fr/smedjiah/tmp/device.js -ENV LAUNCHER "node /mydir/device.js --local_ip '$local_ip' --local_port $local_port --local_name '$local_name' --remote_ip '$remote_ip' --remote_port $remote_port --remote_name '$remote_name' --send_period 3000" +COPY bootstrap_client.py /mydir -ENV VIM_EMU_CMD "nohup $LAUNCHER &" -#ENV VIM_EMU_CMD_STOP "TODO at shutdown" +SHELL ["/bin/bash", "-c"] + +RUN echo "nohup python /mydir/bootstrap_client.py &" > start.sh && \ + echo "/bin/bash" >> start.sh && \ + chmod 777 start.sh # Mandatory entrypoint in containernet -CMD /bin/bash +ENTRYPOINT ./start.sh diff --git a/Dockerfiles/forContainerNet/device/bootstrap_client.py b/Dockerfiles/forContainerNet/device/bootstrap_client.py new file mode 100755 index 0000000..6e34c43 --- /dev/null +++ b/Dockerfiles/forContainerNet/device/bootstrap_client.py @@ -0,0 +1,18 @@ +#!/usr/bin/python +import os +import subprocess +import requests + + +BOOTSTRAP_SERVER_ADDRESS = '10.10.10.10:5555' + +def retrieve_config(): + my_config = "None" + my_ip = subprocess.check_output("sleep 5 && echo $MY_IP", shell=True).rstrip() + resp = requests.get("http://%s/getmyconfig/%s"%(BOOTSTRAP_SERVER_ADDRESS, my_ip)) + my_config = resp.text + if my_config != "None": + subprocess.check_output("node /mydir/*.js %s"%(my_config), shell=True) + #print("my_ip=%s and of type %s"%(my_ip,type(my_ip))) + +retrieve_config() diff --git a/Dockerfiles/forContainerNet/gatewayf/Dockerfile b/Dockerfiles/forContainerNet/gatewayf/Dockerfile index 34fe8c4..658aea2 100644 --- a/Dockerfiles/forContainerNet/gatewayf/Dockerfile +++ b/Dockerfiles/forContainerNet/gatewayf/Dockerfile @@ -1,17 +1,11 @@ # Choosing the image to use FROM node:buster -# Defining variables to allow flexibility (each variable can be set directly within our topology deployment script) -ENV local_ip=127.0.0.1 -ENV local_port=8282 -ENV local_name=gwf1 -ENV remote_ip=127.0.0.1 -ENV remote_port=8181 -ENV remote_name=gwi - # Installing required libraries RUN apt-get update && \ - apt-get install -y net-tools iputils-ping && \ + apt-get install -y net-tools iputils-ping python-pip && \ + pip install flask && \ + pip install requests && \ mkdir mydir && \ cd mydir && \ npm install express && \ @@ -20,11 +14,14 @@ RUN apt-get update && \ npm install request && \ wget http://homepages.laas.fr/smedjiah/tmp/gateway.js -ENV LAUNCHER "node /mydir/gateway.js --local_ip '$local_ip' --local_port $local_port --local_name '$local_name' --remote_ip '$remote_ip' --remote_port $remote_port --remote_name '$remote_name'" +COPY bootstrap_client.py /mydir -ENV VIM_EMU_CMD "nohup $LAUNCHER &" -#ENV VIM_EMU_CMD_STOP "TODO at shutdown" +SHELL ["/bin/bash", "-c"] + +RUN echo "nohup python /mydir/bootstrap_client.py &" > start.sh && \ + echo "/bin/bash" >> start.sh && \ + chmod 777 start.sh # Mandatory entrypoint in containernet -CMD /bin/bash +ENTRYPOINT ./start.sh diff --git a/Dockerfiles/forContainerNet/gatewayf/bootstrap_client.py b/Dockerfiles/forContainerNet/gatewayf/bootstrap_client.py new file mode 100755 index 0000000..6e34c43 --- /dev/null +++ b/Dockerfiles/forContainerNet/gatewayf/bootstrap_client.py @@ -0,0 +1,18 @@ +#!/usr/bin/python +import os +import subprocess +import requests + + +BOOTSTRAP_SERVER_ADDRESS = '10.10.10.10:5555' + +def retrieve_config(): + my_config = "None" + my_ip = subprocess.check_output("sleep 5 && echo $MY_IP", shell=True).rstrip() + resp = requests.get("http://%s/getmyconfig/%s"%(BOOTSTRAP_SERVER_ADDRESS, my_ip)) + my_config = resp.text + if my_config != "None": + subprocess.check_output("node /mydir/*.js %s"%(my_config), shell=True) + #print("my_ip=%s and of type %s"%(my_ip,type(my_ip))) + +retrieve_config() diff --git a/Dockerfiles/forContainerNet/gatewayi/Dockerfile b/Dockerfiles/forContainerNet/gatewayi/Dockerfile index 477f777..658aea2 100644 --- a/Dockerfiles/forContainerNet/gatewayi/Dockerfile +++ b/Dockerfiles/forContainerNet/gatewayi/Dockerfile @@ -1,17 +1,11 @@ # Choosing the image to use FROM node:buster -# Defining variables to allow flexibility (each variable can be set directly within our topology deployment script) -ENV local_ip=127.0.0.1 -ENV local_port=8181 -ENV local_name=gwi -ENV remote_ip=127.0.0.1 -ENV remote_port=8080 -ENV remote_name=srv - # Installing required libraries RUN apt-get update && \ - apt-get install -y net-tools iputils-ping && \ + apt-get install -y net-tools iputils-ping python-pip && \ + pip install flask && \ + pip install requests && \ mkdir mydir && \ cd mydir && \ npm install express && \ @@ -20,11 +14,14 @@ RUN apt-get update && \ npm install request && \ wget http://homepages.laas.fr/smedjiah/tmp/gateway.js -ENV LAUNCHER "node /mydir/gateway.js --local_ip '$local_ip' --local_port $local_port --local_name '$local_name' --remote_ip '$remote_ip' --remote_port $remote_port --remote_name '$remote_name'" +COPY bootstrap_client.py /mydir -ENV VIM_EMU_CMD "nohup $LAUNCHER &" -#ENV VIM_EMU_CMD_STOP "TODO at shutdown" +SHELL ["/bin/bash", "-c"] + +RUN echo "nohup python /mydir/bootstrap_client.py &" > start.sh && \ + echo "/bin/bash" >> start.sh && \ + chmod 777 start.sh # Mandatory entrypoint in containernet -CMD /bin/bash +ENTRYPOINT ./start.sh diff --git a/Dockerfiles/forContainerNet/gatewayi/bootstrap_client.py b/Dockerfiles/forContainerNet/gatewayi/bootstrap_client.py new file mode 100755 index 0000000..6e34c43 --- /dev/null +++ b/Dockerfiles/forContainerNet/gatewayi/bootstrap_client.py @@ -0,0 +1,18 @@ +#!/usr/bin/python +import os +import subprocess +import requests + + +BOOTSTRAP_SERVER_ADDRESS = '10.10.10.10:5555' + +def retrieve_config(): + my_config = "None" + my_ip = subprocess.check_output("sleep 5 && echo $MY_IP", shell=True).rstrip() + resp = requests.get("http://%s/getmyconfig/%s"%(BOOTSTRAP_SERVER_ADDRESS, my_ip)) + my_config = resp.text + if my_config != "None": + subprocess.check_output("node /mydir/*.js %s"%(my_config), shell=True) + #print("my_ip=%s and of type %s"%(my_ip,type(my_ip))) + +retrieve_config() diff --git a/Dockerfiles/forContainerNet/server/Dockerfile b/Dockerfiles/forContainerNet/server/Dockerfile index 2ec6ee3..501a0f1 100644 --- a/Dockerfiles/forContainerNet/server/Dockerfile +++ b/Dockerfiles/forContainerNet/server/Dockerfile @@ -1,14 +1,11 @@ # Choosing the image to use FROM node:buster -# Defining variables to allow flexibility (each variable can be set directly within our topology deployment script) -ENV local_ip=127.0.0.1 -ENV local_port=8080 -ENV local_name=srv - # Installing required libraries RUN apt-get update && \ - apt-get install -y net-tools iputils-ping && \ + apt-get install -y net-tools iputils-ping python-pip && \ + pip install flask && \ + pip install requests && \ mkdir mydir && \ cd mydir && \ npm install express && \ @@ -17,11 +14,14 @@ RUN apt-get update && \ npm install request && \ wget http://homepages.laas.fr/smedjiah/tmp/server.js -ENV LAUNCHER "node /mydir/server.js --local_ip '$local_ip' --local_port '$local_port' --local_name '$local_name'" +COPY bootstrap_client.py /mydir -ENV VIM_EMU_CMD "nohup $LAUNCHER &" -#ENV VIM_EMU_CMD_STOP "TODO at shutdown" +SHELL ["/bin/bash", "-c"] + +RUN echo "nohup python /mydir/bootstrap_client.py &" > start.sh && \ + echo "/bin/bash" >> start.sh && \ + chmod 777 start.sh # Mandatory entrypoint in containernet -CMD /bin/bash +ENTRYPOINT ./start.sh diff --git a/Dockerfiles/forContainerNet/server/bootstrap_client.py b/Dockerfiles/forContainerNet/server/bootstrap_client.py new file mode 100755 index 0000000..6e34c43 --- /dev/null +++ b/Dockerfiles/forContainerNet/server/bootstrap_client.py @@ -0,0 +1,18 @@ +#!/usr/bin/python +import os +import subprocess +import requests + + +BOOTSTRAP_SERVER_ADDRESS = '10.10.10.10:5555' + +def retrieve_config(): + my_config = "None" + my_ip = subprocess.check_output("sleep 5 && echo $MY_IP", shell=True).rstrip() + resp = requests.get("http://%s/getmyconfig/%s"%(BOOTSTRAP_SERVER_ADDRESS, my_ip)) + my_config = resp.text + if my_config != "None": + subprocess.check_output("node /mydir/*.js %s"%(my_config), shell=True) + #print("my_ip=%s and of type %s"%(my_ip,type(my_ip))) + +retrieve_config()