Working to make basic information to be visible.
This commit is contained in:
@ -14,6 +14,7 @@ RUN apk add --no-cache sqlite-libs \
|
|||||||
&& adduser -S -G appgroup appuser
|
&& adduser -S -G appgroup appuser
|
||||||
|
|
||||||
# Copy requirements first (optimization for caching)
|
# Copy requirements first (optimization for caching)
|
||||||
|
COPY gunicorn.conf.py .
|
||||||
COPY requirements.txt .
|
COPY requirements.txt .
|
||||||
RUN pip install --no-cache-dir -r requirements.txt
|
RUN pip install --no-cache-dir -r requirements.txt
|
||||||
|
|
||||||
@ -35,5 +36,5 @@ USER appuser
|
|||||||
# Expose port
|
# Expose port
|
||||||
EXPOSE 5000
|
EXPOSE 5000
|
||||||
|
|
||||||
# Run the application
|
# Run the application with Gunicorn
|
||||||
CMD ["python", "main.py"]
|
CMD ["gunicorn", "--config", "gunicorn.conf.py", "main:app"]
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
-- Table for node authentication information (unchanged)
|
-- Table for node authentication information (unchanged)
|
||||||
CREATE TABLE node_auth (
|
CREATE TABLE IF NOT EXISTS node_auth (
|
||||||
node_id INTEGER PRIMARY KEY AUTOINCREMENT,
|
node_id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||||
node_name TEXT NOT NULL UNIQUE,
|
node_name TEXT NOT NULL UNIQUE,
|
||||||
api_key TEXT NOT NULL,
|
api_key TEXT NOT NULL,
|
||||||
@ -16,7 +16,7 @@ CREATE TABLE IF NOT EXISTS admin_keys (
|
|||||||
);
|
);
|
||||||
|
|
||||||
-- Updated table for basic node information with new fields
|
-- Updated table for basic node information with new fields
|
||||||
CREATE TABLE node_info (
|
CREATE TABLE IF NOT EXISTS node_info (
|
||||||
node_id INTEGER PRIMARY KEY,
|
node_id INTEGER PRIMARY KEY,
|
||||||
hostname TEXT NOT NULL,
|
hostname TEXT NOT NULL,
|
||||||
node_nickname TEXT,
|
node_nickname TEXT,
|
||||||
@ -34,7 +34,7 @@ CREATE TABLE node_info (
|
|||||||
);
|
);
|
||||||
|
|
||||||
-- Table for node-to-node connection metrics
|
-- Table for node-to-node connection metrics
|
||||||
CREATE TABLE node_connections (
|
CREATE TABLE IF NOT EXISTS node_connections (
|
||||||
connection_id INTEGER PRIMARY KEY AUTOINCREMENT,
|
connection_id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||||
source_node_id INTEGER,
|
source_node_id INTEGER,
|
||||||
target_node_id INTEGER,
|
target_node_id INTEGER,
|
||||||
@ -46,7 +46,7 @@ CREATE TABLE node_connections (
|
|||||||
);
|
);
|
||||||
|
|
||||||
-- Timeseries table for CPU usage
|
-- Timeseries table for CPU usage
|
||||||
CREATE TABLE cpu_usage (
|
CREATE TABLE IF NOT EXISTS cpu_usage (
|
||||||
measurement_id INTEGER PRIMARY KEY AUTOINCREMENT,
|
measurement_id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||||
node_id INTEGER,
|
node_id INTEGER,
|
||||||
cpu_percent REAL,
|
cpu_percent REAL,
|
||||||
@ -56,7 +56,7 @@ CREATE TABLE cpu_usage (
|
|||||||
);
|
);
|
||||||
|
|
||||||
-- Timeseries table for memory usage
|
-- Timeseries table for memory usage
|
||||||
CREATE TABLE memory_usage (
|
CREATE TABLE IF NOT EXISTS memory_usage (
|
||||||
measurement_id INTEGER PRIMARY KEY AUTOINCREMENT,
|
measurement_id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||||
node_id INTEGER,
|
node_id INTEGER,
|
||||||
memory_used_mb INTEGER,
|
memory_used_mb INTEGER,
|
||||||
@ -67,7 +67,7 @@ CREATE TABLE memory_usage (
|
|||||||
);
|
);
|
||||||
|
|
||||||
-- Timeseries table for disk usage
|
-- Timeseries table for disk usage
|
||||||
CREATE TABLE disk_usage (
|
CREATE TABLE IF NOT EXISTS disk_usage (
|
||||||
measurement_id INTEGER PRIMARY KEY AUTOINCREMENT,
|
measurement_id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||||
node_id INTEGER,
|
node_id INTEGER,
|
||||||
disk_used_gb INTEGER,
|
disk_used_gb INTEGER,
|
||||||
@ -79,7 +79,7 @@ CREATE TABLE disk_usage (
|
|||||||
);
|
);
|
||||||
|
|
||||||
-- Table for network usage
|
-- Table for network usage
|
||||||
CREATE TABLE network_usage (
|
CREATE TABLE IF NOT EXISTS network_usage (
|
||||||
measurement_id INTEGER PRIMARY KEY AUTOINCREMENT,
|
measurement_id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||||
node_id INTEGER,
|
node_id INTEGER,
|
||||||
bytes_sent INTEGER,
|
bytes_sent INTEGER,
|
||||||
@ -91,7 +91,7 @@ CREATE TABLE network_usage (
|
|||||||
);
|
);
|
||||||
|
|
||||||
-- Table process monitoring
|
-- Table process monitoring
|
||||||
CREATE TABLE process_stats (
|
CREATE TABLE IF NOT EXISTS process_stats (
|
||||||
measurement_id INTEGER PRIMARY KEY AUTOINCREMENT,
|
measurement_id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||||
node_id INTEGER,
|
node_id INTEGER,
|
||||||
process_count INTEGER,
|
process_count INTEGER,
|
||||||
@ -101,7 +101,7 @@ CREATE TABLE process_stats (
|
|||||||
);
|
);
|
||||||
|
|
||||||
-- Table for monitoring configuration and alarm thresholds
|
-- Table for monitoring configuration and alarm thresholds
|
||||||
CREATE TABLE monitoring_config (
|
CREATE TABLE IF NOT EXISTS monitoring_config (
|
||||||
config_id INTEGER PRIMARY KEY AUTOINCREMENT,
|
config_id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||||
node_id INTEGER,
|
node_id INTEGER,
|
||||||
cpu_threshold_percent REAL,
|
cpu_threshold_percent REAL,
|
||||||
@ -116,7 +116,7 @@ CREATE TABLE monitoring_config (
|
|||||||
);
|
);
|
||||||
|
|
||||||
-- Table for alarm history
|
-- Table for alarm history
|
||||||
CREATE TABLE alarm_history (
|
CREATE TABLE IF NOT EXISTS alarm_history (
|
||||||
alarm_id INTEGER PRIMARY KEY AUTOINCREMENT,
|
alarm_id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||||
node_id INTEGER,
|
node_id INTEGER,
|
||||||
alarm_type TEXT CHECK(alarm_type IN ('cpu', 'memory', 'disk', 'temperature',
|
alarm_type TEXT CHECK(alarm_type IN ('cpu', 'memory', 'disk', 'temperature',
|
||||||
@ -130,7 +130,7 @@ CREATE TABLE alarm_history (
|
|||||||
);
|
);
|
||||||
|
|
||||||
-- Table for node status events
|
-- Table for node status events
|
||||||
CREATE TABLE node_events (
|
CREATE TABLE IF NOT EXISTS node_events (
|
||||||
event_id INTEGER PRIMARY KEY AUTOINCREMENT,
|
event_id INTEGER PRIMARY KEY AUTOINCREMENT,
|
||||||
node_id INTEGER,
|
node_id INTEGER,
|
||||||
event_type TEXT CHECK(event_type IN ('online', 'offline', 'error', 'warning')),
|
event_type TEXT CHECK(event_type IN ('online', 'offline', 'error', 'warning')),
|
||||||
|
@ -177,7 +177,7 @@
|
|||||||
x: { ticks: { color: '#aaa' }, grid: { color: 'rgba(255, 255, 255, 0.1)' } },
|
x: { ticks: { color: '#aaa' }, grid: { color: 'rgba(255, 255, 255, 0.1)' } },
|
||||||
y: {
|
y: {
|
||||||
min: 0,
|
min: 0,
|
||||||
max: 100,
|
max: 400,
|
||||||
ticks: { color: '#aaa' },
|
ticks: { color: '#aaa' },
|
||||||
grid: { color: 'rgba(255, 255, 255, 0.1)' }
|
grid: { color: 'rgba(255, 255, 255, 0.1)' }
|
||||||
}
|
}
|
||||||
|
4
gunicorn.conf.py
Normal file
4
gunicorn.conf.py
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
bind = "0.0.0.0:5000"
|
||||||
|
workers = 2 # Adjust based on your needs (e.g., 2 * CPU cores + 1)
|
||||||
|
threads = 4 # Number of threads per worker
|
||||||
|
timeout = 30 # Worker timeout in seconds
|
Reference in New Issue
Block a user