So we want a new app
Lets start with the code
it will be deployed to a repository.
THen that repository will be set up with cloudflair workers todo: make a api request script to do this
lib_cloudflair.funtions.sh
cf_deploy_pages {
local repo = $1
git clone repo;
npm install
npm run cloudflare
echo "note repositories must have /pages /functions and a package.json"
}
After this we must set up a domain.
this can be done with digital ocen dns.
inputs: base_domain
sub_domain
account
DO_API_KEY
so now we deploy the domain.
theoretical it can be bcked by a digital ocena droplet with a floating ip
so each domain gets an ip that can be reassigned.
in the end we have /pages
and /functions and /server
Clusters Rabitmq and apachezookeper
High-Level Overview:
Apache ZooKeeper and RabbitMQ are both distributed systems that play crucial roles in building scalable and reliable applications. However, they serve different purposes and have distinct features.
Apache ZooKeeper:
- ZooKeeper is a centralized service that provides a highly reliable coordination infrastructure for distributed systems.
- It ensures that distributed processes work in a synchronized and consistent manner by maintaining a hierarchical namespace, known as a znode tree, which resembles a file system.
- ZooKeeper is primarily used for tasks like distributed coordination, leader election, configuration management, and maintaining consistent metadata across distributed systems.
- It follows a client-server architecture, where clients connect to a ZooKeeper ensemble, which consists of a group of servers forming a replicated cluster.
- Clients can read, write, and observe the state of znodes, and ZooKeeper guarantees sequential consistency and strong durability for all operations.
- It provides simple and powerful APIs (Java, C, Python, etc.) for developers to interact with the system.
RabbitMQ:
- RabbitMQ is a message broker that implements the Advanced Message Queuing Protocol (AMQP) and is designed to handle messaging between applications and systems.
- It acts as a middleman, receiving messages from publishers and delivering them to consumers based on predefined routing rules.
- RabbitMQ supports various messaging patterns like publish/subscribe, request/reply, and point-to-point messaging.
- It provides features like message queuing, reliable message delivery, message routing, and flexible message acknowledgments.
- RabbitMQ supports multiple messaging protocols and integrates well with different programming languages and frameworks.
- It offers advanced features like message persistence, message acknowledgment modes, message priority, and dead-lettering.
- RabbitMQ can be deployed in a cluster mode for high availability and scalability, ensuring message processing even if some nodes fail.
Comparison and Contrast:
-
Purpose:
- ZooKeeper: Focuses on distributed coordination and maintaining consistent metadata.
- RabbitMQ: Specializes in message-oriented middleware, enabling reliable message exchange between applications.
-
Data Model:
- ZooKeeper: Uses a hierarchical tree-like structure (znodes) for storing metadata.
- RabbitMQ: Stores messages in queues and exchanges, based on routing rules and patterns.
-
Communication Protocol:
- ZooKeeper: Provides a custom binary protocol for client-server communication.
- RabbitMQ: Implements the AMQP protocol, which is a standard for messaging.
-
Messaging Patterns:
- ZooKeeper: Does not directly support messaging patterns; mainly used for coordination tasks.
- RabbitMQ: Offers various messaging patterns, including publish/subscribe and point-to-point.
-
Durability:
- ZooKeeper: Ensures strong durability and consistency for its metadata.
- RabbitMQ: Provides options for message persistence and reliable delivery.
-
Programming Languages:
- ZooKeeper: Provides APIs in several languages, including Java, C, Python, and more.
- RabbitMQ: Offers client libraries for multiple programming languages, facilitating integration.
-
Scalability and High Availability:
- ZooKeeper: Supports replication and can be deployed in a cluster for high availability.
- RabbitMQ: Can be deployed in a cluster to distribute workload and provide fault tolerance.
-
Use Cases:
- ZooKeeper: Ideal for distributed systems coordination, leader election, and configuration management.
- RabbitMQ: Well-suited for building scalable and fault-tolerant messaging systems.
In summary, while both Apache ZooKeeper and RabbitMQ are distributed systems, they differ in their primary purpose and focus. ZooKeeper provides coordination services for distributed systems, while RabbitMQ specializes in reliable messaging between applications. Understanding their specific capabilities and implementation details can help developers choose the appropriate tool for their use case.