Creating a truly distributed microservice architecture with Celery and Docker Swarm — Part 1

Prerequisites:

  1. We’ll be using a microservice architecture. If you are new to the concept, please read about it before you proceed.
  2. If you are new to Celery, you can read about it here.
  3. The examples here would be in Python, but the concepts learnt here could be used in any language of your choice.
  4. This blog also assumes that you are familiar with Docker and Docker Swarm basics.

Let’s dive right in!

Basic project structure:

Implementation:

  • Open RabbitMQ port for external usage, such that a producer in some other stack can write messages to the same RabbitMQ inside the consumer stack.
  • You can have an API microservice inside the consumer stack which gets requests from the producer and puts messages into RabbitMQ (You might need to worry about the bottleneck created by this API microservice).
  • You can have an externally hosted RabbitMQ (Fully managed service or as a part of a different stack) and configure it in both consumer and producer stack.
➜  calculator git:(dev) ✗ docker-compose build  calculator git:(dev) ✗ docker pull rabbitmq:management  calculator git:(dev) ✗ docker pull mher/flower:0.9.5
 calculator git:(dev) ✗ docker stack deploy --compose-file=docker-compose.yml calculator
  calculator git:(dev) ✗ docker stack rm calculator

--

--

--

We are business accelerator working with startups / entrepreneurs in building the product & launching the companies.

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Making Arithmetic Parser with Kotlin

Marking Changed Text in Journal Revisions

Dependency Injection — Overview and Implementation

The Art of point estimation.

Basics Of CSS in Detail:

UML Hidden Gems

Spring Boot 2 running with Netty

Setup nginx modsecurity with owasp rules on centos7

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
LiftOff LLC

LiftOff LLC

We are business accelerator working with startups / entrepreneurs in building the product & launching the companies.

More from Medium

Running a local Kafka cluster using Docker Compose

Use docker-compose to run PostgreSQL

Specification first driven API development: consumer protection use-case

Kafka Use Cases for Web Developers