You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

106 lines
2.4 KiB
Markdown

# Docker Setup for Digital Twin Monitoring
This document provides instructions for setting up and running the Digital Twin Monitoring application using Docker.
## Prerequisites
- Ubuntu server
- Internet connection
- Basic knowledge of terminal commands
## Quick Start
The easiest way to get started is to run the provided installation script:
```bash
chmod +x install.sh
./install.sh
```
This script will:
1. Check if Docker is installed and install it if needed
2. Build the Docker image
3. Stop any existing containers with the same name
4. Start a new container with the application
After running the script, the application will be available at `http://[server-ip]:5003`.
## Manual Setup
If you prefer to set up manually, follow these steps:
### 1. Build the Docker image
```bash
docker build -t digital-twin-monitoring -f Docker/Dockerfile .
```
### 2. Run the Docker container
```bash
docker run -d \
--name digital-twin-monitoring \
--restart unless-stopped \
-p 5003:5003 \
--env-file .env \
digital-twin-monitoring
```
## Environment Variables
The application uses the following environment variables from the `.env` file:
- `TELEGRAM_BOT_TOKEN`: Token for Telegram bot notifications
- `TELEGRAM_CHAT_ID`: Chat ID for Telegram notifications
- `DB_HOST_1`: PostgreSQL host for tables: pf_parts, ms_equipment_master
- `DB_HOST_2`: PostgreSQL host for table: dl_pi_fetch_last
- `DB_PORT`: PostgreSQL port
- `DB_USER`: PostgreSQL username
- `DB_PASS`: PostgreSQL password
- `DB_NAME`: PostgreSQL database name
Make sure your `.env` file is properly configured before running the container.
## Maintenance
### Viewing logs
```bash
docker logs digital-twin-monitoring
```
### Stopping the container
```bash
docker stop digital-twin-monitoring
```
### Restarting the container
```bash
docker restart digital-twin-monitoring
```
### Removing the container
```bash
docker stop digital-twin-monitoring
docker rm digital-twin-monitoring
```
### Updating the application
To update the application, pull the latest code, rebuild the image, and restart the container:
```bash
git pull
docker build -t digital-twin-monitoring -f Docker/Dockerfile .
docker stop digital-twin-monitoring
docker rm digital-twin-monitoring
docker run -d \
--name digital-twin-monitoring \
--restart unless-stopped \
-p 5003:5003 \
--env-file .env \
digital-twin-monitoring
```