Update z2/README.md
This commit is contained in:
parent
94332d8469
commit
77b0f385b6
206
z2/README.md
206
z2/README.md
@ -1,104 +1,104 @@
|
||||
# Interactive Floor Plan Application with Kubernetes
|
||||
|
||||
## Application Description
|
||||
|
||||
This application is an interactive floor plan visualization tool that displays sensor data on different floors of a building. Users can navigate between floors using the buttons at the bottom of the page and click on sensors to view their current data.
|
||||
|
||||
## Container List
|
||||
|
||||
1. **floorplan-webapp**
|
||||
- Web application container based on Python and Flask
|
||||
- Serves the frontend HTML, CSS, and JavaScript files
|
||||
- Provides an API endpoint for sensor data
|
||||
|
||||
2. **mysql-db**
|
||||
- MySQL database container
|
||||
- Stores sensor information including position, floor, location, and values
|
||||
|
||||
## Kubernetes Objects
|
||||
|
||||
1. **Namespace**
|
||||
- `sensor-app`: Isolated environment for all application resources
|
||||
|
||||
2. **Deployment**
|
||||
- `floorplan-webapp`: Manages the web application with 2 replicas for high availability
|
||||
|
||||
3. **StatefulSet**
|
||||
- `mysql`: Manages the MySQL database instance with persistent storage
|
||||
|
||||
4. **Services**
|
||||
- `floorplan-service`: NodePort service exposing the web application on port 30080
|
||||
- `mysql-service`: Headless service for MySQL database access
|
||||
|
||||
5. **PersistentVolume**
|
||||
- `mysql-pv`: 1GB volume for MySQL data storage
|
||||
|
||||
6. **PersistentVolumeClaim**
|
||||
- `mysql-pvc`: Claims storage from the persistent volume for MySQL
|
||||
|
||||
## Network and Storage Configuration
|
||||
|
||||
### Networks
|
||||
- The application uses Kubernetes' built-in networking
|
||||
- Web application connects to MySQL using the `mysql-service` DNS name
|
||||
- External access is provided through a NodePort service on port 30080
|
||||
|
||||
### Storage
|
||||
- The MySQL database uses a persistent volume mounted at `/var/lib/mysql`
|
||||
- The persistent volume is backed by a hostPath at `/mnt/data` on the host machine
|
||||
|
||||
## Container Configuration
|
||||
|
||||
### Web Application Container
|
||||
- Based on Python 3.9 slim image
|
||||
- Installed packages: Flask, mysql-connector-python
|
||||
- Configured to connect to MySQL database using environment variables
|
||||
- Exposes port 5000
|
||||
|
||||
### MySQL Container
|
||||
- Based on MySQL 8.0 image
|
||||
- Configured with empty root password for development purposes
|
||||
- Initializes with the sensors_db database and sample data
|
||||
- Exposes port 3306
|
||||
|
||||
## Application Management
|
||||
|
||||
### Preparation
|
||||
1. Make all scripts executable:
|
||||
```
|
||||
chmod +x prepare-app.sh start-app.sh stop-app.sh
|
||||
```
|
||||
2. Run the preparation script:
|
||||
```
|
||||
./prepare-app.sh
|
||||
```
|
||||
This will:
|
||||
- Create the required namespace
|
||||
- Prepare the persistent volume directory
|
||||
- Build the Docker images
|
||||
|
||||
### Starting the Application
|
||||
1. Run the start script:
|
||||
```
|
||||
./start-app.sh
|
||||
```
|
||||
This will:
|
||||
- Apply all Kubernetes configurations
|
||||
- Wait for all components to be ready
|
||||
- Display the URL to access the application
|
||||
|
||||
### Stopping the Application
|
||||
1. Run the stop script:
|
||||
```
|
||||
./stop-app.sh
|
||||
```
|
||||
This will:
|
||||
- Remove all Kubernetes objects created for the application
|
||||
- The persistent volume data will remain intact
|
||||
|
||||
### Viewing the Application
|
||||
1. Open your web browser
|
||||
2. Navigate to the URL displayed after running the start script (typically http://[NODE-IP]:30080)
|
||||
3. You should see the interactive floor plan with sensors
|
||||
4. Use the buttons at the bottom to switch between floors
|
||||
# Interactive Floor Plan Application with Kubernetes
|
||||
|
||||
## Application Description
|
||||
|
||||
This application is an interactive floor plan visualization tool that displays sensor data on different floors of a building. Users can navigate between floors using the buttons at the bottom of the page and click on sensors to view their current data.
|
||||
|
||||
## Container List
|
||||
|
||||
1. **floorplan-webapp**
|
||||
- Web application container based on Python and Flask
|
||||
- Serves the frontend HTML, CSS, and JavaScript files
|
||||
- Provides an API endpoint for sensor data
|
||||
|
||||
2. **mysql-db**
|
||||
- MySQL database container
|
||||
- Stores sensor information including position, floor, location, and values
|
||||
|
||||
## Kubernetes Objects
|
||||
|
||||
1. **Namespace**
|
||||
- `sensor-app`: Isolated environment for all application resources
|
||||
|
||||
2. **Deployment**
|
||||
- `floorplan-webapp`: Manages the web application with 2 replicas for high availability
|
||||
|
||||
3. **StatefulSet**
|
||||
- `mysql`: Manages the MySQL database instance with persistent storage
|
||||
|
||||
4. **Services**
|
||||
- `floorplan-service`: NodePort service exposing the web application on port 30080
|
||||
- `mysql-service`: Headless service for MySQL database access
|
||||
|
||||
5. **PersistentVolume**
|
||||
- `mysql-pv`: 1GB volume for MySQL data storage
|
||||
|
||||
6. **PersistentVolumeClaim**
|
||||
- `mysql-pvc`: Claims storage from the persistent volume for MySQL
|
||||
|
||||
## Network and Storage Configuration
|
||||
|
||||
### Networks
|
||||
- The application uses Kubernetes' built-in networking
|
||||
- Web application connects to MySQL using the `mysql-service` DNS name
|
||||
- External access is provided through a NodePort service on port 8080
|
||||
|
||||
### Storage
|
||||
- The MySQL database uses a persistent volume mounted at `/var/lib/mysql`
|
||||
- The persistent volume is backed by a hostPath at `/mnt/data` on the host machine
|
||||
|
||||
## Container Configuration
|
||||
|
||||
### Web Application Container
|
||||
- Based on Python 3.9 slim image
|
||||
- Installed packages: Flask, mysql-connector-python
|
||||
- Configured to connect to MySQL database using environment variables
|
||||
- Exposes port 5000
|
||||
|
||||
### MySQL Container
|
||||
- Based on MySQL 8.0 image
|
||||
- Configured with empty root password for development purposes
|
||||
- Initializes with the sensors_db database and sample data
|
||||
- Exposes port 3306
|
||||
|
||||
## Application Management
|
||||
|
||||
### Preparation
|
||||
1. Make all scripts executable:
|
||||
```
|
||||
chmod +x prepare-app.sh start-app.sh stop-app.sh
|
||||
```
|
||||
2. Run the preparation script:
|
||||
```
|
||||
./prepare-app.sh
|
||||
```
|
||||
This will:
|
||||
- Create the required namespace
|
||||
- Prepare the persistent volume directory
|
||||
- Build the Docker images
|
||||
|
||||
### Starting the Application
|
||||
1. Run the start script:
|
||||
```
|
||||
./start-app.sh
|
||||
```
|
||||
This will:
|
||||
- Apply all Kubernetes configurations
|
||||
- Wait for all components to be ready
|
||||
- Display the URL to access the application
|
||||
|
||||
### Stopping the Application
|
||||
1. Run the stop script:
|
||||
```
|
||||
./stop-app.sh
|
||||
```
|
||||
This will:
|
||||
- Remove all Kubernetes objects created for the application
|
||||
- The persistent volume data will remain intact
|
||||
|
||||
### Viewing the Application
|
||||
1. Open your web browser
|
||||
2. Navigate to the URL displayed after running the start script http://localhost:8080
|
||||
3. You should see the interactive floor plan with sensors
|
||||
4. Use the buttons at the bottom to switch between floors
|
||||
5. Click on sensors to view their data in the right panel
|
Loading…
Reference in New Issue
Block a user