Ravindra BagaleCourses & study guides मराठी

Ravi Sir's Cards › DevOps

DevOps

Chapter 57: Docker Projects Part 1: Websites, Databases, LAMP, LEMP, WordPress, 3-Tier and Every Language with MySQL and MongoDB: Cards

मराठी cards · Open the chapter

Revision cards

Project 1: website in an nginx container. Hand-installed web servers drift and nobody knows the config.
Revision card 1 of 16: Project 1: website in an nginx container · Download PNG · Open card page

Lesson: 57.1 Project 1: Launch a website with a container (nginx + pandoc build)

Project 2: todo app with Node.js and MySQL. Installing Node and MySQL on every laptop gives different results.
Revision card 2 of 16: Project 2: todo app with Node.js and MySQL · Download PNG · Open card page

Lesson: 57.2 Project 2: Todo app with Node.js and MySQL (Docker getting-started style)

Project 3: database containers with backups. Installing four database servers on a laptop takes a day.
Revision card 3 of 16: Project 3: database containers with backups · Download PNG · Open card page

Lesson: 57.3 Project 3: Database containers: MySQL, PostgreSQL, MongoDB and Redis with backups and admin UIs

Project 4: WordPress with nginx and free HTTPS. A manual WordPress install has many places to break, and SSL expires every 90 days.
Revision card 4 of 16: Project 4: WordPress with nginx and free HTTPS · Download PNG · Open card page

Lesson: 57.4 Project 4: WordPress with MySQL, nginx and free HTTPS from Let's Encrypt

Project 5: FastAPI with MySQL, MongoDB and Postgres. Different teams want different databases for the same API.
Revision card 5 of 16: Project 5: FastAPI with MySQL, MongoDB and Postgres · Download PNG · Open card page

Lesson: 57.5 Project 5: Python FastAPI with MySQL, MongoDB and PostgreSQL (with Alembic migrations as a one-off job)

Project 6: Node.js with MySQL, MongoDB and a Redis cache. The same query hits the database thousands of times.
Revision card 6 of 16: Project 6: Node.js with MySQL, MongoDB and a Redis cache · Download PNG · Open card page

Lesson: 57.6 Project 6: Node.js with MySQL and with MongoDB, plus a Redis cache

Project 7: Go API in a tiny distroless image. A full golang image is huge and has tools an attacker can use.
Revision card 7 of 16: Project 7: Go API in a tiny distroless image · Download PNG · Open card page

Lesson: 57.7 Project 7: Go with MySQL and MongoDB in a tiny distroless image

Project 8: Spring Boot with MySQL and MongoDB. Java builds fail on different JDKs and Java images are big.
Revision card 8 of 16: Project 8: Spring Boot with MySQL and MongoDB · Download PNG · Open card page

Lesson: 57.8 Project 8: Java Spring Boot (Gradle) with MySQL and MongoDB

Project 9: .NET 8 minimal API with MySQL and MongoDB. Apps built on Windows often fail on the Ubuntu test server.
Revision card 9 of 16: Project 9: .NET 8 minimal API with MySQL and MongoDB · Download PNG · Open card page

Lesson: 57.9 Project 9: .NET 8 minimal API with MySQL and MongoDB

Project 10: Node, MongoDB, mongo-express and a private registry. Company images should not go to a public registry.
Revision card 10 of 16: Project 10: Node, MongoDB, mongo-express and a private registry · Download PNG · Open card page

Lesson: 57.10 Project 10: Node + MongoDB + mongo-express, pushed to a private registry

Project 11: self-hosted team tools behind one nginx. Small teams pay for many SaaS tools they could run themselves.
Revision card 11 of 16: Project 11: self-hosted team tools behind one nginx · Download PNG · Open card page

Lesson: 57.11 Project 11: Self-hosted team tools: Portainer, Gitea, Nextcloud and Uptime Kuma

Project 12: Jupyter Lab and a FastAPI model server. Data scientists' laptops all have different Python libraries.
Revision card 12 of 16: Project 12: Jupyter Lab and a FastAPI model server · Download PNG · Open card page

Lesson: 57.12 Project 12: Jupyter Lab and a FastAPI model server (CPU, then GPU)

Project 13: LAMP stack with phpMyAdmin. Old PHP sites need Apache, PHP extensions and MySQL set up exactly right.
Revision card 13 of 16: Project 13: LAMP stack with phpMyAdmin · Download PNG · Open card page

Lesson: 57.13 Project 13: LAMP stack: Apache, PHP 8, MySQL and phpMyAdmin

Project 14: LEMP stack scaled to 3 copies. One PHP process is not enough when traffic grows.
Revision card 14 of 16: Project 14: LEMP stack scaled to 3 copies · Download PNG · Open card page

Lesson: 57.14 Project 14: LEMP stack: nginx, PHP-FPM and MySQL

Project 15: one PHP API on MySQL or MongoDB. Some teams need SQL, some need documents, for the same API.
Revision card 15 of 16: Project 15: one PHP API on MySQL or MongoDB · Download PNG · Open card page

Lesson: 57.15 Project 15: PHP with MySQL and with MongoDB (one API, two databases)

Project 16: 3-tier app with React, Node.js and PostgreSQL. Putting everything on one open network exposes the database.
Revision card 16 of 16: Project 16: 3-tier app with React, Node.js and PostgreSQL · Download PNG · Open card page

Lesson: 57.16 Project 16: 3-tier app: React frontend, Node.js API and PostgreSQL

Interview cards

How do you ship a static website with Docker? Use a multi-stage build: stage 1 makes the HTML, stage 2 copies it into nginx at /usr/share/nginx/html. Tag every version so rollback is one command.
Interview card 1 of 16: How do you ship a static website with Docker? · Download PNG · Open card page

Lesson: 57.1 Project 1: Launch a website with a container (nginx + pandoc build)

How does the app container find the MySQL container? Compose puts both on one network with DNS by service name, so the app connects to host db. depends_on: service_healthy waits until MySQL answers.
Interview card 2 of 16: How does the app container find the MySQL container? · Download PNG · Open card page

Lesson: 57.2 Project 2: Todo app with Node.js and MySQL (Docker getting-started style)

How do you back up a database running in a container? Run a logical backup tool inside it with docker exec, like mysqldump or pg_dump, save the file outside, and do a restore test into a fresh container.
Interview card 3 of 16: How do you back up a database running in a container? · Download PNG · Open card page

Lesson: 57.3 Project 3: Database containers: MySQL, PostgreSQL, MongoDB and Redis with backups and admin UIs

How do you add free HTTPS to a WordPress container? Run certbot with the webroot challenge: Let's Encrypt checks a file under /.well-known/ on your site, then gives a 90-day certificate that nginx loads. Renew it automatically.
Interview card 4 of 16: How do you add free HTTPS to a WordPress container? · Download PNG · Open card page

Lesson: 57.4 Project 4: WordPress with MySQL, nginx and free HTTPS from Let's Encrypt

How do you run database migrations with Docker? Run them as a one-off job: docker compose run --rm migrate. Alembic keeps each schema change as a small versioned file, so every environment ends up the same.
Interview card 5 of 16: How do you run database migrations with Docker? · Download PNG · Open card page

Lesson: 57.5 Project 5: Python FastAPI with MySQL, MongoDB and PostgreSQL (with Alembic migrations as a one-off job)

Explain cache-aside with Redis. App reads Redis first. On a miss it reads the database and stores the result with a TTL. On a write it deletes the key so the next read is fresh.
Interview card 6 of 16: Explain cache-aside with Redis. · Download PNG · Open card page

Lesson: 57.6 Project 6: Node.js with MySQL and with MongoDB, plus a Redis cache

Why use distroless for a Go service? Go makes one static binary, so the runtime needs nothing else. Distroless has no shell or package manager, so the image is tiny and has fewer CVEs.
Interview card 7 of 16: Why use distroless for a Go service? · Download PNG · Open card page

Lesson: 57.7 Project 7: Go with MySQL and MongoDB in a tiny distroless image

How do you size the JVM inside a container? Set -XX:MaxRAMPercentage=75 so the heap follows the container memory limit, not the host memory. Otherwise the JVM can be OOM-killed (exit 137).
Interview card 8 of 16: How do you size the JVM inside a container? · Download PNG · Open card page

Lesson: 57.8 Project 8: Java Spring Boot (Gradle) with MySQL and MongoDB

How do you make a small .NET container? Multi-stage: sdk image runs dotnet publish, the final stage uses aspnet or chiseled. Chiseled has no shell or package manager, so it is about 110 MB and safer.
Interview card 9 of 16: How do you make a small .NET container? · Download PNG · Open card page

Lesson: 57.9 Project 9: .NET 8 minimal API with MySQL and MongoDB

How do you push to a private registry? Tag the image with the registry address in front, then push: localhost:5000/notes:1.0. For other hosts, put the registry behind TLS and a password.
Interview card 10 of 16: How do you push to a private registry? · Download PNG · Open card page

Lesson: 57.10 Project 10: Node + MongoDB + mongo-express, pushed to a private registry

Why put many apps behind one reverse proxy? A reverse proxy receives all traffic and routes by host name, so only 80 and 443 are open, HTTPS is in one place, and apps stay on a private network.
Interview card 11 of 16: Why put many apps behind one reverse proxy? · Download PNG · Open card page

Lesson: 57.11 Project 11: Self-hosted team tools: Portainer, Gitea, Nextcloud and Uptime Kuma

How do you give a container a GPU? Install the NVIDIA driver and NVIDIA Container Toolkit on the host, then run with --gpus all (or gpus in Compose). Check with nvidia-smi inside.
Interview card 12 of 16: How do you give a container a GPU? · Download PNG · Open card page

Lesson: 57.12 Project 12: Jupyter Lab and a FastAPI model server (CPU, then GPU)

How do you add PHP extensions in a Docker image? Use the helper in the official image: docker-php-ext-install pdo_mysql in the Dockerfile. It compiles and enables the extension at build time.
Interview card 13 of 16: How do you add PHP extensions in a Docker image? · Download PNG · Open card page

Lesson: 57.13 Project 13: LAMP stack: Apache, PHP 8, MySQL and phpMyAdmin

How does nginx talk to PHP-FPM? nginx uses FastCGI: fastcgi_pass php:9000. With --scale php=3, the name php returns three IPs, so requests spread across the copies.
Interview card 14 of 16: How does nginx talk to PHP-FPM? · Download PNG · Open card page

Lesson: 57.14 Project 14: LEMP stack: nginx, PHP-FPM and MySQL

When would you pick MongoDB over MySQL? MongoDB stores flexible JSON-like documents, good when each record has different fields. MySQL fits fixed tables, joins and transactions.
Interview card 15 of 16: When would you pick MongoDB over MySQL? · Download PNG · Open card page

Lesson: 57.15 Project 15: PHP with MySQL and with MongoDB (one API, two databases)

How do you isolate the database in Compose? Put it only on an internal back network with the API, publish no port, and let nginx proxy /api. Only the web container is reachable from outside.
Interview card 16 of 16: How do you isolate the database in Compose? · Download PNG · Open card page

Lesson: 57.16 Project 16: 3-tier app: React frontend, Node.js API and PostgreSQL

Comparison cards

LAMP vs LEMP. LAMP: Apache runs PHP inside itself.LEMP: nginx sends PHP to a separate PHP-FPM.
Comparison card 1 of 3: LAMP vs LEMP · Download PNG · Open card page

Lesson: 57.13 Project 13: LAMP stack: Apache, PHP 8, MySQL and phpMyAdmin

MySQL vs MongoDB in containers. MySQL: tables with fixed columns.MongoDB: JSON-like documents with flexible fields.
Comparison card 2 of 3: MySQL vs MongoDB in containers · Download PNG · Open card page

Lesson: 57.15 Project 15: PHP with MySQL and with MongoDB (one API, two databases)

Distroless vs Alpine base image. Alpine: tiny Linux with a shell and apk.Distroless: only the app runtime, no shell, no package manager.
Comparison card 3 of 3: Distroless vs Alpine base image · Download PNG · Open card page

Lesson: 57.7 Project 7: Go with MySQL and MongoDB in a tiny distroless image