Play with docker task - #1
antonaleks wants to merge 6 commits into
Conversation
antonaleks
left a comment
There was a problem hiding this comment.
Some activities with bash scripts. Report is OK
You should kill all VM and try to run all your bash scripts - the result is well setting VMs (so from client VM you could curl server VM via gateway VM)
| .... | ||
| ...." | ||
| apk add tcpdump | ||
| tcpdump |
There was a problem hiding this comment.
if you run this script, in this raw you just open tcpdump and switch to tcpdump promt. bash script should be written as scrip run at once - so after run this script you should get VM with all apllied settings for task.
So, could you remove from this script all commands, that can broke your run - i think you need remove
- tcpdump
- ping command or you should declare how many times you try to ping other machine, otherwise you will ping other VM all the time (infinity loop)
| echo "check connect with the third server (192.168.4.100) | ||
| .... | ||
| ...." | ||
| ping 192.168.4.100 |
| pip install flask | ||
| mkdir myapp | ||
| cd myapp | ||
| echo "web-server configration with requests: GET, PUT, POST |
There was a problem hiding this comment.
echo command should be used with PIPE syntax. So you need echo some text and than try to move output of this command to file like this:
echo 'Hello world' > my_test_file.txtThere was a problem hiding this comment.
if you want to use multiple raws, check this syntax https://stackoverflow.com/a/51864828
| def hello_world(): | ||
| return "<p>Hello, World!</p>" | ||
|
|
||
| @app.route("/", methods=['PUT']) |
There was a problem hiding this comment.
could you try to change put and post requests to something better? for example, you can put and post some data and return it to html (hello world is just example) https://pythonbasics.org/flask-rest-api/
for example
@app.route('/', methods=['PUT'])
def create_record():
record = json.loads(request.data)
with open('/tmp/data.txt', 'r') as f:
data = f.read()
if not data:
records = [record]
else:
records = json.loads(data)
records.append(record)
with open('/tmp/data.txt', 'w') as f:
f.write(json.dumps(records, indent=2))
return jsonify(record)| echo "check connection with the third server | ||
| .... | ||
| ...." | ||
| ping 192.168.4.100 |
| echo "check connection with the first server | ||
| .... | ||
| ...." | ||
| ping 192.168.18.10 |
| .... | ||
| ...." | ||
| apk add tcpdump | ||
| tcpdump -i macvlan1 |
| echo "create tcp connection to listen to port 5000 | ||
| .... | ||
| ...." | ||
| tcpdump 'port 5000' No newline at end of file |
Pull request for review