CI/CD Pipeline Explained in Simple Terms
Section 1 - SDLC with CI/CD
The software development life cycle (SDLC) consists of several key stages: development, testing, deployment, and maintenance. CI/CD automates and integrates these stages to enable faster, more reliable releases.
When code is pushed to a git repository, it triggers an automated build and test process. End-to-end (e2e) test cases are run to validate the code. If tests pass, the code can be automatically deployed to staging/production. If issues are found, the code is sent back to development for bug fixing. This automation provides fast feedback to developers and reduces risk of bugs in production.
Section 2 - Difference between CI and CD
Continuous Integration (CI) automates the build, test, and merge process. It runs tests whenever code is committed to detect integration issues early. This encourages frequent code commits and rapid feedback.
Continuous Delivery (CD) automates release processes like infrastructure changes and deployment. It ensures software can be released reliably at any time through automated workflows. CD may also automate the manual testing and approval steps required before production deployment.
Section 3 - CI/CD Pipeline
A typical CI/CD pipeline has several connected stages:
- Developer commits code changes to source control
- CI server detects changes and triggers build
- Code is compiled, tested (unit, integration tests)
- Test results reported to developer
- On success, artifacts are deployed to staging environments
- Further testing may be done on staging before release
- CD system deploys approved changes to production
--
Subscribe to our weekly newsletter to get a Free System Design PDF (158 pages): https://t.co/FIzCeaWsZV
UI/UX Designers and Developers, here are web breakpoint cheat sheets for all devices that can help with your website's layout for your next UI design project.
Bookmark it for later ๐
๐๐ฃ๐ ๐๐ฎ๐๐ฒ๐๐ฎ๐ ๐๐ ๐๐ผ๐ฎ๐ฑ ๐๐ฎ๐น๐ฎ๐ป๐ฐ๐ฒ๐ฟ ๐๐ ๐ฅ๐ฒ๐๐ฒ๐ฟ๐๐ฒ ๐ฃ๐ฟ๐ผ๐ ๐
Regarding a system design, we often need clarification about the roles of a Load Balancer and an API Gateway. Most of our resources are about their implementation rather than real-life use cases.
๐น ๐๐ฃ๐ ๐๐ฎ๐๐ฒ๐๐ฎ๐ sits between a client and a group of backend services. It performs the function of a reverse proxy by accepting all application programming interface (API) calls, aggregating the different services needed to fulfill them, and returning the right outcome. ๐จ๐๐ฒ๐ฟ ๐ฎ๐๐๐ต๐ฒ๐ป๐๐ถ๐ฐ๐ฎ๐๐ถ๐ผ๐ป, ๐ฟ๐ฎ๐๐ฒ ๐น๐ถ๐บ๐ถ๐๐, ๐ฎ๐ป๐ฑ ๐๐๐ฎ๐๐ถ๐๐๐ถ๐ฐ๐ are typical duties that API gateways take care of on behalf of a system of API services. Also, the API gateway can handle faults (circuit breaker) and log and monitor.
๐น ๐๐ผ๐ฎ๐ฑ ๐๐ฎ๐น๐ฎ๐ป๐ฐ๐ฒ๐ฟ is a service that distributes incoming traffic across many servers or resources. Usually, we have two or more web servers on the backend, and it ๐ฑ๐ถ๐๐๐ฟ๐ถ๐ฏ๐๐๐ฒ๐ ๐ป๐ฒ๐๐๐ผ๐ฟ๐ธ ๐๐ฟ๐ฎ๐ณ๐ณ๐ถ๐ฐ ๐ฏ๐ฒ๐๐๐ฒ๐ฒ๐ป ๐๐ต๐ฒ๐บ. Its primary purpose is to use resources optimally. A more equal task allocation and increased capacity can enhance the system's responsiveness and reliability. There are three high-level load balancers: hardware-based, cloud-based, and software-based.
๐น ๐ฅ๐ฒ๐๐ฒ๐ฟ๐๐ฒ ๐ฃ๐ฟ๐ผ๐ ๐ server resides in front of backend servers and transfers client requests to these servers. Reverse proxies are typically used to increase security, speed, and dependability. A reverse proxy receives a request from a client, forwards it to another server, and then returns it to the client, giving the impression that the first proxy server handled the request. These proxies ensure that users don't access the origin server directly, giving the web server anonymity. They are usually used for Load balancing, where we need to deal with incoming traffic flow so that we may distribute that traffic between multiple backend servers or use them for caching.
So, the main thing that differs these two is that an ๐๐ฃ๐ ๐๐ฎ๐๐ฒ๐๐ฎ๐ ๐ถ๐ ๐ณ๐ผ๐ฐ๐๐๐ฒ๐ฑ ๐ผ๐ป ๐ฟ๐ผ๐๐๐ถ๐ป๐ด ๐ฟ๐ฒ๐พ๐๐ฒ๐๐๐ to the appropriate service and it handles requests for APIs, while a ๐๐ผ๐ฎ๐ฑ ๐ฏ๐ฎ๐น๐ฎ๐ป๐ฐ๐ฒ๐ฟ ๐ถ๐ ๐ณ๐ผ๐ฐ๐๐๐ฒ๐ฑ ๐ผ๐ป ๐ฑ๐ถ๐๐๐ฟ๐ถ๐ฏ๐๐๐ถ๐ป๐ด ๐ฟ๐ฒ๐พ๐๐ฒ๐๐๐ ๐ฒ๐๐ฒ๐ป๐น๐ between a group of servers and handles requests that are sent to a single IP address, which works at protocol or socket level (TCP, HTTP).
Some ๐ฒ๐ ๐ฎ๐บ๐ฝ๐น๐ฒ๐ of API Gateways are Amazon API Gateway, Ocelot (.NET-based), Tyk, or Apache APISIX, while Load Balancers are Azure Load Balancer, HAProxy, or Seesaw.
An example of reverse proxy services is ๐๐ฝ๐ฎ๐ฐ๐ต๐ฒ ๐ฃ๐ฟ๐ผ๐ ๐, ๐ก๐ด๐ถ๐ป๐ ๐ผ๐ฟ ๐๐๐ฆ with additional modules (Url Rewrite).
#programming #api
How do we design effective and safe APIs?
APIs have increasingly become the backbone of modern software.
To understand some of the key principles and best practices of API design, Let's analyze a social media platform example:
๐น Resource naming
Clarity is key when creating APIs.
Adopting simple resource names, like /users for accessing user profiles and /posts for retrieving user posts, streamlines the development process and reduces mental strain.
๐น Use of plurals
It's important to maintain a standard of consistency in API design.
For consistency and readability, use plural resource names, such as GET /users/{userId}/friends vs. /friend), to avoid ambiguity in API requests.
๐น Cross-referencing resources
Interlinking resources, like taking comments on a post using GET /posts/{postId}/comments, simplifies the retrieval of related data.
It provides a more streamlined and well-organized user experience.
๐น Security
It goes without saying, security is a must-have.
To secure the API endpoints, employ authentication methods like X-AUTH-TOKEN and X-SIGNATURE, and use authorization headers for verifying user permissions.
Learn more about API security here: https://t.co/AEZgiZNmxt
๐น Versioning
Using versioning and communicating version updates is another important practice.
Endpoints like GET /v2/users/{userId}/posts allow API versioning to maintain functionality regardless of updates.
This approach ensures backward compatibility and a smooth transition for users and us.
Learn more about API versioning here: https://t.co/FQsJ3jcIsl
๐น Pagination
This technique is important for performance.
Paginate large datasets, like feeds or comment lists, with GET /posts?page=5&pageSize=20 to enhance data delivery and UX.
๐น Idempotency
Maintaining API reliability is necessary.
Idempotency ensures that operations like profile updates (PUT /users/{userId}/profile) achieve their intended result, regardless of how often they are executed.
These practices are very important, but thereโs still much more to API design.
Learn more about API design here: https://t.co/fiaya7akdA
Thorough documentation, robust monitoring and logging, and consistent error handling are just a few more of the many essential habits required for designing effective and safe APIs.
Adopting these principles and practices enables us to develop secure and performant APIs that deliver good user experiences.
Marriage is not scary if you found the right one. Marriage is hard but love and affection between you and your spouse conquer it all. There is no perfect marriage, we are all scattered. But by those things we experienced, we grow a life that we can not live without each other.๐ค
Nonton deadpool wolverine, suamik fokus nonton dari awal sampe akhir, gw sibuk ngunyah fish&chips, pop corn ama nyemilin keju ampe bersih. Pas makanan abis, gangguin suamik yg lg fokus nonton+gelendotan aja nyari kerjaan๐ untung suamik penyabarrr bgt orgnya๐๐ค @edwardtoruan
Object-Oriented Programming in Under 4 Minutes:
Object-oriented programming (OOP) is a programming paradigm in which programs are designed using classes and objects. This design allows related functions and data to be grouped together in self-contained and reusable units.
A class is a template or blueprint from which objects are made from. Classes define the properties and methods that an object can have, and objects are unique instances of a class.
For example, let's say you want to create a life simulation game where players can adopt and raise pets. You would have a "Pet" class that defines the properties of each pet (like "name" and "age"), as well as behaviors they can do (like "speak" and "eat").
You could then create objects, or instances, of this class for each specific pet. Each object could have its own values for each property. For example, you could have a 2-year-old pet named "Winston", & a 1-year-old pet named "Wesley"; both initialized from the "Pet" class.
Object-oriented programming has 4 main principles; encapsulation, inheritance, abstraction, and polymorphism.
Encapsulation hides internal details but exposes data & methods via a public interface, preventing unintentional changes. E.g. โ a player can view a pet's age but can't accidentally change it. But they can run methods avail on the public interface like changing a pet's name.
Inheritance allows classes to inherit properties and methods from other classes, making code reusable and organized. E.g. โ A "SuperPet" class that extends from "Pet "and would inherit "age", "name", "eat", and "speak"; while defining new behaviors like "fly"
Polymorphism is a principle that enables objects to change their form by extending or overriding existing methods. E.g. A "Dog" & "Cat" class that extended from the "Pet", shouldn't share the same "speak" method. You'd override it to have its own logic like "woof" or "meow"
Abstraction reduces complexity by only surfacing the information needed for a given context or use case. E.g. A โPlayerโ class doesnโt need to know how the โeatโ method works in the โPetโ class, it just needs to know how to interact with it โ i.e. its input and output.
OOP provides a way to design your program that makes it reusable, secure, stable, and easy to understand. But it isn't without disadvantages. A couple of arguments against it are that it can lead to over-engineering and complexity on a large scale.
~~
Thank you to our partner Kickresume who keeps our content free to the community.
Did you know you can turn your LinkedIn into a resume with one click?
Check it out: https://t.co/DIeENAT5gp
This week I will cover:
โ Strategies to prevent system misuse & overload
โ Types of API testing
โ How the TCP handshake works
โ Containerization explained
โ Principles of OOP
๐ฉ Enjoy my content? Subscribe to my weekly newsletter so you don't miss it: https://t.co/nLXHushrhP
@Little_secret9 Sakit jiwaaa!!!!!! Aslik klo berita2 ttg anak2 kaya gini ke trigger parah gw๐ญ๐ญ๐ญ๐ญ๐ญ rot in hell you freak pedo!!!!!!!! Rrrgghhhhh
This week we will cover:
โ Understanding the components of system design
โ GraphQL vs REST
โ How DDoS attacks work, and how to prevent them
โ SSL vs TLS
Donโt want to miss out? Subscribe to our free newsletter for a weekly deep dive & content roundup: https://t.co/o8ShggS5mk
Webhook vs Polling โ What's the difference?
Imagine we run a project management platform. As users make changes to tasks, the challenge lies in ensuring these changes are reflected on every user's interface in that team.
There are two ways to handle communications to achieve these synchronized updates across all user interfaces - Polling and Webhooks.
๐๐ฃ๐ ๐ฃ๐ผ๐น๐น๐ถ๐ป๐ด is a ๐ฝ๐๐น๐น-๐ฏ๐ฎ๐๐ฒ๐ฑ ๐ฎ๐ฝ๐ฝ๐ฟ๐ผ๐ฎ๐ฐ๐ต operating on a "check-in" system. The client regularly makes API calls to the server to check for any changes to any tasks. To address the challenge of updating all user interfaces, polling would have the system routinely execute these API requests for changes, ensuring that, even though updates may not be instantaneous, they are still consistently captured and communicated to all users in due course.
In contrast, using a ๐๐ฒ๐ฏ๐ต๐ผ๐ผ๐ธ would ๐๐ฒ๐ป๐ฑ ๐ฎ ๐ป๐ผ๐๐ถ๐ณ๐ถ๐ฐ๐ฎ๐๐ถ๐ผ๐ป to the system ๐ผ๐ป๐น๐ ๐๐ต๐ฒ๐ป there is ๐ป๐ฒ๐ ๐ฑ๐ฎ๐๐ฎ ๐ฎ๐๐ฎ๐ถ๐น๐ฎ๐ฏ๐น๐ฒ. Webhooks adopt a ๐ฝ๐๐๐ต-๐ฏ๐ฎ๐๐ฒ๐ฑ ๐บ๐ฒ๐๐ต๐ผ๐ฑ๐ผ๐น๐ผ๐ด๐. This setup entails the server taking the initiative to send notifications. When a task undergoes any modification, it triggers an immediate alert from the server, which dispatches information directly to the project management platform's ๐ฝ๐ฟ๐ฒ๐ฑ๐ฒ๐ณ๐ถ๐ป๐ฒ๐ฑ ๐๐ฒ๐ฏ๐ต๐ผ๐ผ๐ธ ๐จ๐ฅ๐. This payload contains the details of the updated task. Once the platform has received the data, it reflects the changes across all user interfaces.
In our scenario, using polling would mean our application would waste resources continuously querying the server, & communicating tasks updates would be delayed. Using a webhook, on the other hand, ensures that as soon as a task is updated, everyone receives the update, as well as no resource wastage.
Deciding between polling and webhook depends on your needs.
Choose Polling for:
๐ธ Scenarios where simplicity and ease of implementation are more important than immediate data delivery
๐ธ Preference for controlled, periodic update checks
๐ธ Integrating with older systems that do not support webhook capabilities
Opt for Webhooks when:
๐ธ Your application needs to be notified as soon as new data is available.
๐ธ You need to minimize the frequency of your API calls.
๐ธ Youโre looking to decouple systems for better scalability
๐ธ Your system needs to receive updates from a data source that is frequently updated.
Webhooks provide a more efficient and real-time solution, enabling immediate data synchronization as opposed to the delayed response of polling. However, they do come with the trade-off of increased complexity in setup and maintenance.
~~~
A big thank you to our partner Postman who keeps our content free to the community.
Postman have made it possible to test your API without leaving your code editor thanks to Postmanโs VS Code extension.
Check it out: https://t.co/kDllh8s6yr
๐ฉ If you found this helpful, consider subscribing to our newsletter where we help you level up your engineering and system design skills: https://t.co/076cpzUaQo
Chat WA sekarang full dengan bahasan sepatu lari dan event lari @edwardtoruan tenang tiga bulan lagi jd athlet lari dah siap bgt ikut marathon 42km๐๐ป