Computer Networking ->
0. Intro to Networking -> done
1. Revision of RestAPI on Cloud : Nginx + Python -> done
2. Load Balancer vs Reverse Proxy -> done
3. Adding TLS cert (HTTP to HTTPs) -> done
4. Docker
Debugging the OCR App (from week 5)
Next App: Weather app
Future concepts :
Async vs Sync Operations :
Coroutines
Intro to Dependency Injection
1. Build MVP (Minimum viable product) Independent feature in app
2. Integrate in the big app after testing
Rs. 1000 bounty
Remember we have bounty program fix bug and get Rs. 1000 ($18)
https://www.cloudflare.com/learning/ddos/glossary/open-systems-interconnection-model-osi/
1. Pen drives, ethernett
2. Exchnage data via Internet
https://meghagarwal.medium.com/tcp-vs-udp-c3dedd91f66d#:~:text=TCP%20is%20a%20communication%20protocol,maintain%20the%20data%20packets'%20order.
TCP :: For secure transmission it make sure that data comes in sequence and without errors
TCP is a reliable and connection-oriented protocol
e.x
Online net-banking transaction
1. Create VM (Host on any Port e..g 5000)
2. Open the right ports on Azure or any cloud (80 / 443)
3. copy code python3 code of flask server
4. Make sure it never turns off -> docker / pm2
5. Ngnix / Apache2 for reverse proxy
python3 http.server -> 127.0.0.1 -> only work on your own computer
python3 http.server -> 0.0.0.0 -> you can share the link http://10.5.0.4:5000 and share data
cert installation steps:
https://certbot.eff.org/instructions?ws=nginx&os=ubuntufocal
1. Turns off sometimes on it's own
2. not easy to share -> you have to make each person install python3, flask etc.
3. Lot of steps to bring machine up
Creating Docker Container
example : https://github.com/ahmnouira/flask-hello-world
https://github.com/robpco/docker-nginx-uwsgi
runs consistently regardless of machine
-> Container
Image is list of necessary files, libraries, and configuration settings that are needed to run that application
Image -> once (pyton3.8 nginx 2.1)
Containers can be multiple
Self contained system allowing
1. Build
2. Run
3. Deploy
1. Docker Engine -> Software that creates images / start containers
2. CLI : Command Line Interface
3. Docker Hub (like GitHub)
not the hub you think
1. it's like new OS with less storage
2. consistent linux os on Windows or Mac
3. Maintain 2 instances easily: e.g. Python 3.7 vs Python 3.9
4. Encapsulation: one system in Docker doesn't know about other system
5. Easy and clear monitoring (one log file for all)
Container – a Virtual OS where we run software same as OS but with minimum storage
Image – everything you need to run a software including OS version (e.g. python server needs flask, openai libraries on Ubuntu 20)
1. Install docker: https://docs.docker.com/engine/install/ubuntu/
2. Create Docker File
3. build
4. run
your image -> like on OS python python3 ready with libraries
1. Base image -> pyton3.8 3.9 etc
2. Libraries -> like flask etc.
3. Copy files like you copy to the OS
4. Expose ports like 5000 we did
5. Run docker container
1. docker build -t <tag name> .
2. docker run <tag name>
e.g.
1. docker build -t python-server .
2. docker run -p -d 5001:5001 python-server (with port mapping)
-d -> run as independent unit
-p -> port mapping
# Use an appropriate base image -> with configuration of your Container / System
FROM python:3.8
# Set the working directory
WORKDIR /app
# Copy the server file into the container
COPY server.py /app/server.py
# Install any dependencies if needed
RUN pip install flask # Replace with your dependencies
# Expose the port your server will run on
EXPOSE 5000
# Define the command to run the server
CMD ["python", "server.py"]
docker login
2. docker tag python-server singhinusa/firstimage
2. docker push singhinusa/firstimage