Setting Up a Local Development Stack with Minikube, NodeJS, and Nginx
You can find the code for this project on GitHub:
https://github.com/DaveLobos/node-nginx-app
Requirements
Before diving in, make sure you have the following tools installed:- Docker
- Minikube
- Skaffold
Getting started
Clone the project repository
git clone https://github.com/DaveLobos/node-nginx-app.git
Navigate to the project directory
cd node-nginx-app
Start Minikube
minikube start
Run Skaffold
skaffold dev
Understanding the Application Structure
It is important to understand the directory structure of our project:.
├── LICENSE
├── README.md
├── bash
│ ├── expose.sh
├── deployment.yaml
├── nginx
│ ├── Dockerfile
│ ├── default.conf
│ └── public
│ └── css
│ └── style.css
├── node
│ ├── Dockerfile
│ └── app
│ └── main.js
└── skaffold.yaml
├── LICENSE
├── README.md
├── bash
│ ├── expose.sh
├── deployment.yaml
├── nginx
│ ├── Dockerfile
│ ├── default.conf
│ └── public
│ └── css
│ └── style.css
├── node
│ ├── Dockerfile
│ └── app
│ └── main.js
└── skaffold.yaml
- **LICENSE** and **README.md**: Standard files for licensing and documentation.
- **bash**: Contains shell scripts like `expose.sh`.
- **deployment.yaml**: Kubernetes deployment configuration.
- **nginx**: Holds the Dockerfile, configuration file, and public assets for Nginx.
- **node**: Contains the Dockerfile and main application script for Node.js.
- **skaffold.yaml**: Configures Skaffold for automated deployments.
Kubernetes Deployment Configuration
The `deployment.yaml` file dictates how the application will run within the Kubernetes cluster. It specifies the two containers that make our deployment.Nginx Configuration
The `nginx/default.conf` configuration manages incoming web requests:- Listens on port 8080.
- Routes requests to static CSS files or to the Node.js server.