Mahmoud Godamy 202101691
Lab 9
Cloud Terminal
Last login: Tue May 27 17:12:15 on ttys000
abdelhamidsayed@Abdelhamids-MacBook-Pro ~ % sudo apt update
sudo apt install python3 python3-pip
pip3 install flask requests
Password:
The operation couldn’t be completed. Unable to locate a Java Runtime.
Please visit http://www.java.com for information on installing Java.
The operation couldn’t be completed. Unable to locate a Java Runtime.
Please visit http://www.java.com for information on installing Java.
Collecting flask
Downloading flask-3.1.1-py3-none-any.whl (103 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 103.3/103.3 kB 1.3 MB/s
eta 0:00:00
Collecting requests
Downloading requests-2.32.3-py3-none-any.whl (64 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 64.9/64.9 kB 3.1 MB/s
eta 0:00:00
Collecting itsdangerous>=2.2.0
Mahmoud Godamy 202101691
Using cached itsdangerous-2.2.0-py3-none-any.whl (16 kB)
Collecting click>=8.1.3
Downloading click-8.2.1-py3-none-any.whl (102 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 102.2/102.2 kB 2.9 MB/s
eta 0:00:00
Collecting jinja2>=3.1.2
Using cached jinja2-3.1.6-py3-none-any.whl (134 kB)
Collecting werkzeug>=3.1.0
Using cached werkzeug-3.1.3-py3-none-any.whl (224 kB)
Collecting blinker>=1.9.0
Using cached blinker-1.9.0-py3-none-any.whl (8.5 kB)
Collecting markupsafe>=2.1.1
Downloading MarkupSafe-3.0.2-cp310-cp310-macosx_11_0_arm64.whl (12
kB)
Collecting charset-normalizer<4,>=2
Downloading charset_normalizer-3.4.2-cp310-cp310-
macosx_10_9_universal2.whl (201 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 201.8/201.8 kB 5.2 MB/s
eta 0:00:00
Collecting certifi>=2017.4.17
Downloading certifi-2025.4.26-py3-none-any.whl (159 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 159.6/159.6 kB 3.2 MB/s
eta 0:00:00
Collecting urllib3<3,>=1.21.1
Downloading urllib3-2.4.0-py3-none-any.whl (128 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 128.7/128.7 kB 3.3 MB/s
eta 0:00:00
Collecting idna<4,>=2.5
Downloading idna-3.10-py3-none-any.whl (70 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 70.4/70.4 kB 3.0 MB/s
eta 0:00:00
Installing collected packages: urllib3, markupsafe, itsdangerous,
idna, click, charset-normalizer, certifi, blinker, werkzeug, requests,
jinja2, flask
Successfully installed blinker-1.9.0 certifi-2025.4.26 charset-
normalizer-3.4.2 click-8.2.1 flask-3.1.1 idna-3.10 itsdangerous-2.2.0
jinja2-3.1.6 markupsafe-3.0.2 requests-2.32.3 urllib3-2.4.0 werkzeug-
3.1.3
[notice] A new release of pip is available: 23.0.1 -> 25.1.1
[notice] To update, run: pip install --upgrade pip
abdelhamidsayed@Abdelhamids-MacBook-Pro ~ % mkdir -p cloud_node && cd
cloud_node
abdelhamidsayed@Abdelhamids-MacBook-Pro cloud_node % nano cloud_app.py
abdelhamidsayed@Abdelhamids-MacBook-Pro cloud_node % python3
cloud_app.py
* Serving Flask app 'cloud_app'
* Debug mode: off
WARNING: This is a development server. Do not use it in a production
deployment. Use a production WSGI server instead.
Mahmoud Godamy 202101691
* Running on all addresses (0.0.0.0)
* Running on http://127.0.0.1:5001
* Running on http://192.168.1.33:5001
Press CTRL+C to quit
Stored data: {'average_temperature': 25}
127.0.0.1 - - [27/May/2025 18:12:44] "POST /store HTTP/1.1" 200 -
^A
Fog Terminal
Last login: Tue May 27 17:39:15 on ttys001
abdelhamidsayed@Abdelhamids-MacBook-Pro ~ % mkdir -p fog_node && cd
fog_node
abdelhamidsayed@Abdelhamids-MacBook-Pro fog_node % nano fog_app.py
abdelhamidsayed@Abdelhamids-MacBook-Pro fog_node % python3 fog_app.py
* Serving Flask app 'fog_app'
* Debug mode: off
Address already in use
Port 5000 is in use by another program. Either identify and stop that
program, or start the server with a different port.
On macOS, try disabling the 'AirPlay Receiver' service from System
Preferences -> General -> AirDrop & Handoff.
abdelhamidsayed@Abdelhamids-MacBook-Pro fog_node % nano aggregate.py
abdelhamidsayed@Abdelhamids-MacBook-Pro fog_node % python3
aggregate.py
{'average_temperature': 22.0}
{'average_temperature': 23.5}
{'average_temperature': 25.0}
abdelhamidsayed@Abdelhamids-MacBook-Pro fog_node % python3 fog_app.py
* Serving Flask app 'fog_app'
* Debug mode: off
Address already in use
Mahmoud Godamy 202101691
Port 5000 is in use by another program. Either identify and stop that
program, or start the server with a different port.
On macOS, try disabling the 'AirPlay Receiver' service from System
Preferences -> General -> AirDrop & Handoff.
abdelhamidsayed@Abdelhamids-MacBook-Pro fog_node % python3 forward.py
/Users/abdelhamidsayed/.pyenv/versions/3.10.13/bin/python3: can't open
file '/Users/abdelhamidsayed/fog_node/forward.py': [Errno 2] No such
file or directory
abdelhamidsayed@Abdelhamids-MacBook-Pro fog_node % nano forward.py
abdelhamidsayed@Abdelhamids-MacBook-Pro fog_node % python3 forward.py
Data forwarded with status: 200
abdelhamidsayed@Abdelhamids-MacBook-Pro fog_node %
Edge Terminal
Last login: Tue May 27 17:43:47 on ttys002
abdelhamidsayed@Abdelhamids-MacBook-Pro ~ % curl -X POST -H "Content-
Type: application/json" -d '{"temperature": 30}'
http://localhost:5000/preprocess
abdelhamidsayed@Abdelhamids-MacBook-Pro ~ % curl -X POST -H "Content-
Type: application/json" -d '{"temperature": 30}'
http://localhost:5000/preprocess
abdelhamidsayed@Abdelhamids-MacBook-Pro ~ % mkdir -p Edge_Node
abdelhamidsayed@Abdelhamids-MacBook-Pro ~ % mkdir -p Edge_Node && cd
Edge_Node
abdelhamidsayed@Abdelhamids-MacBook-Pro Edge_Node % curl -X POST -H
"Content-Type: application/json" -d '{"temperature": 30}'
http://localhost:5000/preprocess
abdelhamidsayed@Abdelhamids-MacBook-Pro Edge_Node % python3 forward.py
/Users/abdelhamidsayed/.pyenv/versions/3.10.13/bin/python3: can't open
file '/Users/abdelhamidsayed/Edge_Node/forward.py': [Errno 2] No such
file or directory
abdelhamidsayed@Abdelhamids-MacBook-Pro Edge_Node % curl -X POST -H
"Content-Type: application/json" -d '{"temperature": 30}'
http://localhost:5000/preprocess
abdelhamidsayed@Abdelhamids-MacBook-Pro Edge_Node % curl -X POST -H
"Content-Type: application/json" -d '{"temperature": 30}'
http://localhost:5000/preprocess
abdelhamidsayed@Abdelhamids-MacBook-Pro Edge_Node %
Mahmoud Godamy 202101691
Mahmoud Godamy 202101691
Mahmoud Godamy 202101691