Three-tier app with Docker Compose
nginx in front, a Node.js API behind it and PostgreSQL for data: a real multi-service stack started with one command.
You'll end with: A working docker-compose.yml for a three-tier app in your GitHub, started and tested on every push.
Do it here, in your browser
Follow the steps on the left and type in the terminal on the right. Each step ticks itself off when your files are right. At the end, one button creates the repository in your GitHub with your work, and you get a ready LinkedIn post.
Or do it on your own computer
Prefer a real terminal? Make your copy from our GitHub template, work in Codespaces or on your machine, then submit the link below.
akopslabs/build-compose-stackSteps on your own computer
- 1
Make your copy
Press Use the GitHub template, keep the repository Public and create it.
- 2
Open a Codespace
Code → Codespaces → Create codespace. Docker and Docker Compose are already installed.
- 3
Write docker-compose.yml
Three services: db (postgres, password from .env, named volume, pg_isready health check), api (build ./api, DB_HOST=db, waits for a healthy db, no ports) and web (nginx on 8080 with web/nginx.conf).
- 4
Run it
Start the stack and call the API through nginx.
cp .env.example .env docker compose up -d docker compose ps curl localhost:8080/api/health
- 5
Push
Commit docker-compose.yml (not .env) and push. AkOps check starts the whole stack on GitHub.
git add docker-compose.yml git commit -m "Three-tier stack with Docker Compose" git push
- 6
Submit and share
Paste your repository link below and press Check my project.