Basics of DevOps
Intranet - Within campus network (mild hosting)
Stun protocol - punching holes through network
If multiple laptops are on same WiFi router, we can access one machine from another through private IP address. {Mild hosting}
"Port scanning of a network" refers to the process of systematically checking each port on a computer or server within a network to identify which ports are open and actively listening for connections.
/etc/hosts file :
127.0.0.1 → facebook.com {Changed original facebook.com ip to localhost so now when ping command on facebook.com is entered then it returns 127.0.0.1 instead of original server IP}
The /etc/hosts file is a plain text file that maps IP addresses to domain names or host names.
What it does?
The /etc/hosts file acts as a local DNS service for your computer.
It can be used to manually link a domain name to an IP address.
It can be used to test a new version of a website on a public server.
It can be used to associate a new server IP address with a domain name.
99% when you host an application it will be on Virtual Machine instead of Bare Metal or House Rack or Data Center.
How AWS gives a different machines on demand for a user?
AWS have a single big hardware rich machine which is divided into multiple smaller machines through physical hypervisor so that a VM can be spin up utilizing the underlying resources of the hardware when the user demand a instance/machine of a specific size.
Virtual Machine :
VMs run on a physical server (called the host) but are abstracted through a layer of virtualization software called a hypervisor (e.g., VMware, KVM). This hypervisor divides the host machine’s resources (CPU, memory, storage) into separate virtual machines.
Each VM acts like a completely independent machine, even though they share the underlying hardware. You can run different operating systems and applications in different VMs on the same physical server.
VMs are highly flexible and easy to scale. You can quickly spin up, modify, or delete VMs, and you can consolidate multiple workloads on a single server.
The virtualization layer introduces a slight overhead in terms of performance because the hypervisor needs to manage resources and ensure each VM operates independently. However, with modern hypervisors and powerful hardware, this overhead is minimal.
Bare metal servers
In a bare-metal setup, an operating system (OS) runs directly on the physical hardware without a hypervisor in between. There’s no virtualization layer.
Since there's no hypervisor, bare-metal systems tend to offer better performance, as the OS can directly access all the server’s resources without sharing them with other instances. This is especially important for high-performance applications like large databases, gaming servers, or mining crypto
With bare-metal, you’re typically limited to the resources (CPU, memory, storage) of the actual physical server. You can't dynamically allocate resources like you can in a VM.
Bare Metal server can be used for bitcoin mining.
**
Significance of passphrase while generating ssh-key?**
A passphrase when generating an SSH key acts as an extra layer of security by encrypting your private key, meaning even if someone gains access to your computer and finds the key file, they cannot use it without knowing the passphrase, preventing unauthorized access to your systems.
Forward Proxy → A VPN
Using Nginx as Reverse Proxy with multiple domains :
http {
server {
listen 80; server_name abc.xyz.com
location /{ proxy_pass http://localhost:8080; }
}
server {
listen 80; server_name def.xyz.com
location /{ proxy_pass http://localhost:8081; }
}
}
Storage and Distribution -
Object Stores
Object storage is a data storage system that stores unstructured data in units called objects.
Whenever we create a content serving application which serves mp4, mp3, jpg, etc files these files should not be directly stored in the databases. Instead the metadata of these objects should be stored in the db, and the actual content/object should be stored in something called Object store.
AWS has a object store named S3 in which we can store all these actual objects/content.
We can save the files but directly cannot access the files through URL generated by S3.
So we come across a term named CDN (Content Delivery Network) for Distribution.
Content Delivery Network
A content delivery network (CDN) is a network of servers that deliver web content to users based on their location. CDNs improve the speed and performance of websites by storing content on servers closer to users.
In AWS, CloudFront is the CDN. (React Frontend can be served created by npm run build as it contains static files only)
If your data resides in only one part of the world then it will be very difficult to get that data all over the world. So CDN technically creates POPs (Point of Presence) which servers the object/content/data cached in them to the users close to them.
If these content can be cached then why not the backend data coming from server?
Backend data varies from user to user so cannot be distributed as same cached and served. While serving mp4 files to 100 users same mp4 file is served but in case of 100 user data different data needs to be served every time.
Edge Networks can be a good option to serve backend data (having multiple servers in different regions of the world). No data is cached.
Can’t we do same with S3 , can’t we just have multiple S3 in different part of the world?
It is costly to retrieve data from S3 as it does not charge on the storage of data but it is very expensive to retrieve data from S3 so CDN provides a better option as it costs minimal charge for retrieval of data.
Cookies
A cookie can typically store around 4 kilobytes (KB) of data. This means that you can only store a limited amount of information within a single cookie due to browser restrictions.
Cookies have a four-kilobyte limit which means you can only add a limited amount of data associated with the domain, and only those domains that create those cookies can read them as long as the site uses HTTPS protocol instead of HTTP.