Skip to content

๐Ÿณ Microservices Docker Compose Quickstart

A clean, scalable multi-repo microservices architecture powered by Docker Compose.

This repository acts as the orchestrator (Quickstart) โ€” it does not build service images locally. All images are pulled from the private registry.

๐Ÿ–ฅ๏ธ This setup is intended for localhost development and testing. It spins up the full stack on your local machine so you can develop and test against a real environment without deploying to any server.


โšก TL;DR

docker login registry.nexus.castis.io
git clone https://mashup.castis.io/playtelly/Quickstart.git
cd Quickstart
make dev

That's it. The full stack runs locally. No cloning of individual service repos required. Environment variables are pre-configured.


โš™๏ธ Prerequisites

1. Install Required Tools

Verify they're installed:

docker --version
docker compose version
make --version

2. Docker Must Be Running

docker ps

3. Login to the Private Registry

You must authenticate before pulling images:

docker login registry.nexus.castis.io

Enter your credentials when prompted. If you don't have credentials, contact your team admin.

โœ… You only need to do this once per machine (credentials are cached by Docker).


๐Ÿ“ฅ Setup

1. Clone the Quickstart Repository

git clone https://mashup.castis.io/playtelly/Quickstart.git
cd Quickstart

3. Verify Ports Are Free

Make sure these ports are not already in use on your machine:

Port Service
8080 API Gateway
5432 Postgres (dev only)
6379 Redis (dev only)
# Check if a port is in use (example for 8080)
lsof -i :8080

๐Ÿš€ Running the Stack

make dev       # Run all services in the foreground (logs visible)
make dev-d     # Run all services in the background (detached)

Option B โ€” Layered Startup (Manual Control)

If you want to bring services up in stages, you must start infrastructure first:

make up-infra      # Step 1: Start Postgres, Redis (always required first)
make up-services   # Step 2: Start business logic services
make up-access     # Step 3: Start API Gateway and Auth

โš ๏ธ Always run make up-infra before any other layer. Services depend on the database and cache being ready.

Stop

make down      # Stop all containers
make down-v    # Stop and remove volumes (โš ๏ธ deletes local data)

๐Ÿ› ๏ธ All Makefile Commands

Full Stack

Command Description
make dev Run all services (foreground)
make dev-d Run all services (background)
make down Stop all
make down-v Stop + remove volumes

Layered Control

Command Description
make up-infra Start infrastructure only (Postgres, Redis)
make up-services Start infrastructure + business services
make up-access Start full system including API Gateway

Utilities

Command Description
make logs View logs for all services
make ps Show container status
make restart Restart all services
make pull Pull latest images from registry

๐Ÿ“ Repository Structure

Quickstart/
โ”œโ”€โ”€ compose/
โ”‚   โ”œโ”€โ”€ access/                   # API Gateway, Auth Service
โ”‚   โ”œโ”€โ”€ infrastructure/           # Postgres, Redis, networks
โ”‚   โ””โ”€โ”€ services/                 # User, Order Services
โ”œโ”€โ”€ .env                          # Pre-configured (not committed)
โ”œโ”€โ”€ .gitignore
โ”œโ”€โ”€ docker-compose.yml            # Base configuration
โ”œโ”€โ”€ Makefile                      # Command shortcuts
โ””โ”€โ”€ README.md

Compose Folder Responsibilities

Folder Purpose Contains
compose/access/ Public-facing layer API Gateway, Auth Service
compose/services/ Business logic User, Order, and other services
compose/infrastructure/ Stateful services Postgres, Redis

๐Ÿง  What Happens Internally

  1. Docker Compose loads docker-compose.yml
  2. Images are pulled from registry.nexus.castis.io (not built locally)
  3. Services start in order: infrastructure โ†’ services โ†’ access

๐ŸŒ Networking

All services communicate over Docker's internal network โ€” no manual setup needed. Networks are defined in compose/infrastructure/networks-volumes.yml and created automatically.

Service-to-service DNS resolution:

http://auth-service:3001
http://user-service:3002

๐Ÿญ Image Lifecycle

Developer pushes code
       โ†“
CI/CD builds & tags image
       โ†“
Image pushed to registry.nexus.castis.io
       โ†“
You run `make dev` โ†’ Docker pulls image

To pull the latest images without restarting:

make pull

Then restart to apply:

make restart

๐Ÿš€ Startup Order

compose/infrastructure/   (Postgres, Redis)
         โ†“
compose/services/         (User, Order, ...)
         โ†“
compose/access/           (API Gateway, Auth)

๐Ÿ”ง Troubleshooting

Image pull fails

Error: unauthorized: access to the requested resource is not authorized

Re-authenticate:

docker login registry.nexus.castis.io

Port already in use

lsof -i :8080    # find what's using the port
kill -9 <PID>    # stop the process

Container keeps restarting

Check logs for the specific service:

docker compose logs <service-name>

Database connection errors on first start

Infrastructure (Postgres) may not be fully ready before services start. Use layered startup instead of make dev:

make up-infra     # wait for Postgres to be healthy first
make up-services
make up-access

๐Ÿง  Key Takeaways

  • Single repo โ€” only clone Quickstart
  • No local builds โ€” images come from registry.nexus.castis.io
  • Login required โ€” docker login registry.nexus.castis.io before first run
  • No .env setup needed โ€” environment is pre-configured
  • No manual network setup โ€” Docker Compose handles it
  • make up-infra first if running layers manually โ€” everything else depends on it

๐Ÿ’ก Suggested Next Steps

  • make doctor โ€” auto-check registry login, port conflicts, and .env completeness
  • setup.sh โ€” guided first-time setup script
  • Healthcheck + wait-for-db (avoid startup race conditions on fresh installs)