Skip to content

This project involves building and deploying a three-tier application to a Minikube cluster, simulating a real-world multi-environment setup.

License

Notifications You must be signed in to change notification settings

Obs3rve/three-tier-local

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Getting Started

This project involves building and deploying a three-tier application(todo list application from Docker) to a Minikube cluster, simulating a real-world multi-environment setup.

Purpose of This README

The goal of this README is to explain the steps to replicate this project, particularly for those who might have little to no knowledge of the subject. I’ll provide tutorials and guides along the way.

Prerequisites

Before we jump into the project, make sure you have the following installed on your machine:

  1. Docker: You can get started here: Get Docker Desktop.
  2. Minikube: Install it from this guide: Minikube Start.
  3. Docker Hub Account: Sign up here: Docker Hub.

Project 1: Deploying to Minikube

For this step, we’ll use a three-tier app (frontend, backend, and database) provided by Docker. Check out the official Docker documentation for a quick start: Develop with Containers. The Dockerfile is already written to containerize the app.

What’s in Our Setup?

  • React Frontend: A Node container running the React development server, using Vite.
  • Node Backend: Provides an API to retrieve, create, and delete to-do items.
  • MySQL Database: Stores the list of items.
  • phpMyAdmin: A web-based interface to interact with the database, accessible at http://db.localhost.
  • Traefik Proxy: Routes requests appropriately, sending requests for localhost/api/* to the backend, requests for localhost/* to the frontend, and requests for db.localhost to phpMyAdmin, allowing access through port 80.

1. Cloning Our Repo

Use the following command to clone/download the files:

git clone https://github.com/docker/getting-started-todo-app

To ensure all services connect, run:

docker compose watch

(Psst! You need to be in the same folder to run docker-compose. If you are not, use this command before running Docker Compose: cd getting-started-todo-app).

Once you execute the above command, you should see the status: Screenshot 2024-09-25 at 1 33 56 am

2. Containerize the App

Now, we will build our image and push it to Docker Hub.

  1. Create a New Repository: First, go to your Docker Hub account and create a new repository. Screenshot 2024-09-25 at 1 54 09 am

  2. Build the Image: Use the following command:

    docker build -t <DOCKER_USERNAME>/todoapp .

    (Psst! The full stop is important.) Screenshot 2024-09-25 at 2 06 32 am

  3. Check Your Image: Run the following command to confirm everything went smoothly:

    docker image ls
  4. Push it to Docker Hub: Once confirmed, push it to Docker Hub using:

    docker push <DOCKER_USERNAME>/getting-started-todo-app

    Screenshot 2024-09-25 at 2 10 21 am

You have successfully built and pushed your image to Docker Hub.

3. Set Up Minikube

Now that we’re set with our image, it’s time to deploy our app to Kubernetes. For the local section of this guide, we’ll be using Minikube. If you haven’t installed Minikube yet, follow this guide: Minikube Start.


I’ll continue tomorrow.

Stay tuned for more details on the deployment process!


About

This project involves building and deploying a three-tier application to a Minikube cluster, simulating a real-world multi-environment setup.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published