Microservices
This tutorial explores how EMB handles complex projects with multiple interdependent components.
What’s New in This Tutorial
Section titled “What’s New in This Tutorial”- Four components - API, worker, gateway, and a shared base image
- Component dependencies - Building images in the right order
- Shared base images - DRY principle for Docker builds
The Example Project
Section titled “The Example Project”We’ll use examples/microservices:
microservices/├── .emb.yml # Project configuration├── .env # Environment variables├── docker-compose.yml # Service definitions├── base/ # Shared base image│ ├── Dockerfile│ ├── Embfile.yml│ └── utils.js├── api/ # REST API│ ├── Dockerfile│ ├── Embfile.yml│ ├── package.json│ └── server.js├── worker/ # Background worker│ ├── Dockerfile│ ├── Embfile.yml│ ├── package.json│ └── worker.js└── gateway/ # API Gateway ├── Dockerfile ├── Embfile.yml └── nginx.confThe Components
Section titled “The Components”emb components COMPONENT NAME ID CREATED STATUS-------------------------------------- worker gateway base apiFour components, each with a specific role:
- base - Shared Node.js base image with common utilities
- api - REST API service
- worker - Background job processor
- gateway - Nginx reverse proxy
Tutorial Pages
Section titled “Tutorial Pages”- Base Images - Creating shared base images
- Dependencies - Declaring component dependencies
- Build Ordering - How EMB resolves build order
Prerequisites
Section titled “Prerequisites”You should have completed the Fullstack App tutorial first.