mise a jour
This commit is contained in:
parent
596a692e2b
commit
ffaef824cb
3 changed files with 21 additions and 2 deletions
|
@ -12,7 +12,9 @@ COPY bootstrap_server.py /mydir
|
||||||
|
|
||||||
SHELL ["/bin/bash", "-c"]
|
SHELL ["/bin/bash", "-c"]
|
||||||
|
|
||||||
RUN echo "nohup python /mydir/bootstrap_server.py &" > start.sh && echo "/bin/bash" >> start.sh && chmod 777 start.sh
|
RUN echo "nohup python /mydir/bootstrap_server.py &" > start.sh && \
|
||||||
|
echo "/bin/bash" >> start.sh && \
|
||||||
|
chmod 777 start.sh
|
||||||
|
|
||||||
# Mandatory entrypoint in containernet
|
# Mandatory entrypoint in containernet
|
||||||
ENTRYPOINT ./start.sh
|
ENTRYPOINT ./start.sh
|
||||||
|
|
14
Dockerfiles/forContainerNet/bootserver/bootstrap_client.py
Executable file
14
Dockerfiles/forContainerNet/bootserver/bootstrap_client.py
Executable file
|
@ -0,0 +1,14 @@
|
||||||
|
#!/usr/bin/python
|
||||||
|
import os
|
||||||
|
import subprocess
|
||||||
|
import requests
|
||||||
|
|
||||||
|
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))
|
||||||
|
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)))
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
|
'''In our topology, we assume the container running this script has ip address 10.10.10.10/24
|
||||||
|
(useful information according to our topology: useless otherwise)
|
||||||
|
'''
|
||||||
from flask import Flask
|
from flask import Flask
|
||||||
|
|
||||||
app = Flask(__name__)
|
app = Flask(__name__)
|
||||||
|
@ -13,3 +15,4 @@ def configurations_giver(my_ip):
|
||||||
|
|
||||||
if __name__=='__main__':
|
if __name__=='__main__':
|
||||||
app.run(debug=False, host='0.0.0.0', port=5555)
|
app.run(debug=False, host='0.0.0.0', port=5555)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue