mise a jour

This commit is contained in:
Abdel Kader Chabi Sika Boni 2020-12-31 21:15:51 +01:00
parent ffaef824cb
commit 593ad67773
10 changed files with 118 additions and 50 deletions

View file

@ -5,6 +5,7 @@ FROM node:buster
RUN apt-get update && \ RUN apt-get update && \
apt-get install -y net-tools iputils-ping python-pip && \ apt-get install -y net-tools iputils-ping python-pip && \
pip install flask && \ pip install flask && \
pip install requests && \
mkdir mydir && \ mkdir mydir && \
cd mydir cd mydir

View file

@ -3,12 +3,16 @@ import os
import subprocess import subprocess
import requests import requests
BOOTSTRAP_SERVER_ADDRESS = '10.10.10.10:5555'
def retrieve_config(): def retrieve_config():
my_config = "None" my_config = "None"
my_ip = subprocess.check_output("sleep 5 && echo $MY_IP", shell=True).rstrip() 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 my_config = resp.text
if my_config != "None": if my_config != "None":
subprocess.check_output("node /mydir/*.js %s"%(my_config), shell=True) subprocess.check_output("node /mydir/*.js %s"%(my_config), shell=True)
#print("my_ip=%s and of type %s"%(my_ip,type(my_ip))) #print("my_ip=%s and of type %s"%(my_ip,type(my_ip)))
retrieve_config()

View file

@ -1,17 +1,11 @@
# Choosing the image to use # Choosing the image to use
FROM node:buster 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 # Installing required libraries
RUN apt-get update && \ 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 && \ mkdir mydir && \
cd mydir && \ cd mydir && \
npm install express && \ npm install express && \
@ -20,11 +14,14 @@ RUN apt-get update && \
npm install request && \ npm install request && \
wget http://homepages.laas.fr/smedjiah/tmp/device.js 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 &" SHELL ["/bin/bash", "-c"]
#ENV VIM_EMU_CMD_STOP "TODO at shutdown"
RUN echo "nohup python /mydir/bootstrap_client.py &" > start.sh && \
echo "/bin/bash" >> start.sh && \
chmod 777 start.sh
# Mandatory entrypoint in containernet # Mandatory entrypoint in containernet
CMD /bin/bash ENTRYPOINT ./start.sh

View file

@ -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()

View file

@ -1,17 +1,11 @@
# Choosing the image to use # Choosing the image to use
FROM node:buster 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 # Installing required libraries
RUN apt-get update && \ 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 && \ mkdir mydir && \
cd mydir && \ cd mydir && \
npm install express && \ npm install express && \
@ -20,11 +14,14 @@ RUN apt-get update && \
npm install request && \ npm install request && \
wget http://homepages.laas.fr/smedjiah/tmp/gateway.js 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 &" SHELL ["/bin/bash", "-c"]
#ENV VIM_EMU_CMD_STOP "TODO at shutdown"
RUN echo "nohup python /mydir/bootstrap_client.py &" > start.sh && \
echo "/bin/bash" >> start.sh && \
chmod 777 start.sh
# Mandatory entrypoint in containernet # Mandatory entrypoint in containernet
CMD /bin/bash ENTRYPOINT ./start.sh

View file

@ -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()

View file

@ -1,17 +1,11 @@
# Choosing the image to use # Choosing the image to use
FROM node:buster 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 # Installing required libraries
RUN apt-get update && \ 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 && \ mkdir mydir && \
cd mydir && \ cd mydir && \
npm install express && \ npm install express && \
@ -20,11 +14,14 @@ RUN apt-get update && \
npm install request && \ npm install request && \
wget http://homepages.laas.fr/smedjiah/tmp/gateway.js 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 &" SHELL ["/bin/bash", "-c"]
#ENV VIM_EMU_CMD_STOP "TODO at shutdown"
RUN echo "nohup python /mydir/bootstrap_client.py &" > start.sh && \
echo "/bin/bash" >> start.sh && \
chmod 777 start.sh
# Mandatory entrypoint in containernet # Mandatory entrypoint in containernet
CMD /bin/bash ENTRYPOINT ./start.sh

View file

@ -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()

View file

@ -1,14 +1,11 @@
# Choosing the image to use # Choosing the image to use
FROM node:buster 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 # Installing required libraries
RUN apt-get update && \ 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 && \ mkdir mydir && \
cd mydir && \ cd mydir && \
npm install express && \ npm install express && \
@ -17,11 +14,14 @@ RUN apt-get update && \
npm install request && \ npm install request && \
wget http://homepages.laas.fr/smedjiah/tmp/server.js 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 &" SHELL ["/bin/bash", "-c"]
#ENV VIM_EMU_CMD_STOP "TODO at shutdown"
RUN echo "nohup python /mydir/bootstrap_client.py &" > start.sh && \
echo "/bin/bash" >> start.sh && \
chmod 777 start.sh
# Mandatory entrypoint in containernet # Mandatory entrypoint in containernet
CMD /bin/bash ENTRYPOINT ./start.sh

View file

@ -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()