From 0309720c432e9088cd8d6ffd62ea2201e477d569 Mon Sep 17 00:00:00 2001 From: sanjay7178 Date: Mon, 19 Feb 2024 14:21:14 +0530 Subject: [PATCH] Add new tables and columns for notifications, influxdb configurations, realtime logs, LVM configuration, and machine configuration --- configs/config-demo.json | 5 +- .../migrations/mysql/01_init-schema.down.sql | 11 ++ .../migrations/mysql/01_init-schema.up.sql | 103 ++++++++++++++++++ startDemo.sh | 2 +- 4 files changed, 118 insertions(+), 3 deletions(-) diff --git a/configs/config-demo.json b/configs/config-demo.json index d4d8b0c..272dcc3 100644 --- a/configs/config-demo.json +++ b/configs/config-demo.json @@ -1,8 +1,9 @@ { "addr": "127.0.0.1:8080", "db-driver": "mysql", - - "db" : "root:my-secret-pw@(127.0.0.1:3306)/cockpit", + "embed-static-files": false, + "static-files": "./web/frontend/public/", + "db" : "root:my-secret-pw@(127.0.0.1:3306)/clustercockpit", "archive": { "kind": "file", "path": "./var/job-archive" diff --git a/internal/repository/migrations/mysql/01_init-schema.down.sql b/internal/repository/migrations/mysql/01_init-schema.down.sql index 68da646..6627bf3 100644 --- a/internal/repository/migrations/mysql/01_init-schema.down.sql +++ b/internal/repository/migrations/mysql/01_init-schema.down.sql @@ -3,3 +3,14 @@ DROP TABLE IF EXISTS tags; DROP TABLE IF EXISTS jobtag; DROP TABLE IF EXISTS configuration; DROP TABLE IF EXISTS user; +DROP TABLE IF EXISTS notifications; +DROP TABLE IF EXISTS influxdb_configurations; +DROP TABLE IF EXISTS realtime_logs; +DROP TABLE IF EXISTS lvm_conf; +DROP TABLE IF EXISTS machines; +DROP TABLE IF EXISTS logical_volumes +DROP TABLE IF EXISTS volume_groups; +DROP TABLE IF EXISTS physical_volumes; +DROP TABLE IF EXISTS lvm_storage_issuer; +DROP TABLE IF EXISTS machine_conf; + diff --git a/internal/repository/migrations/mysql/01_init-schema.up.sql b/internal/repository/migrations/mysql/01_init-schema.up.sql index 3a6930c..84d1527 100644 --- a/internal/repository/migrations/mysql/01_init-schema.up.sql +++ b/internal/repository/migrations/mysql/01_init-schema.up.sql @@ -64,3 +64,106 @@ CREATE TABLE IF NOT EXISTS configuration ( FOREIGN KEY (username) REFERENCES user (username) ON DELETE CASCADE ON UPDATE NO ACTION); +CREATE TABLE IF NOT EXISTS notifications ( + id INT AUTO_INCREMENT PRIMARY KEY, + message TEXT NOT NULL, + created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP +); + +CREATE TABLE IF NOT EXISTS influxdb_configurations ( + id INT AUTO_INCREMENT PRIMARY KEY, + type VARCHAR(255) NOT NULL, + database_name VARCHAR(255) NOT NULL, + host VARCHAR(255) NOT NULL, + port INT NOT NULL, + user VARCHAR(255) NOT NULL, + password VARCHAR(255) NOT NULL, + organization VARCHAR(255) NOT NULL, + ssl_enabled BOOLEAN NOT NULL, + batch_size INT NOT NULL, + retry_interval VARCHAR(255) NOT NULL, + retry_exponential_base INT NOT NULL, + max_retries INT NOT NULL, + max_retry_time VARCHAR(255) NOT NULL, + meta_as_tags TEXT +); + +CREATE TABLE IF NOT EXISTS realtime_logs ( + id INT AUTO_INCREMENT PRIMARY KEY, + log_message TEXT NOT NULL, + created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP +); + +CREATE TABLE IF NOT EXISTS lvm_conf ( + id INT AUTO_INCREMENT PRIMARY KEY, + username VARCHAR(255) NOT NULL, + minAvailableSpaceGB FLOAT NOT NULL, + maxAvailableSpaceGB FLOAT NOT NULL +); + +-- linux lvm schemas +CREATE TABLE IF NOT EXISTS machines ( + machine_id VARCHAR(255) PRIMARY KEY, + hostname VARCHAR(255) NOT NULL, + os_version VARCHAR(255) NOT NULL, + ip_address VARCHAR(255) NOT NULL +); + +CREATE TABLE IF NOT EXISTS logical_volumes ( + lv_id INT AUTO_INCREMENT PRIMARY KEY, + machine_id VARCHAR(255) NOT NULL, + lv_name VARCHAR(255) NOT NULL, + vg_name VARCHAR(255) NOT NULL, + lv_attr VARCHAR(255) NOT NULL, + lv_size VARCHAR(255) NOT NULL, + FOREIGN KEY (machine_id) REFERENCES machines(machine_id) +); + +CREATE TABLE IF NOT EXISTS volume_groups ( + vg_id INT AUTO_INCREMENT PRIMARY KEY, + machine_id VARCHAR(255) NOT NULL, + vg_name VARCHAR(255) NOT NULL, + pv_count VARCHAR(255) NOT NULL, + lv_count VARCHAR(255) NOT NULL, + snap_count VARCHAR(255) NOT NULL, + vg_attr VARCHAR(255) NOT NULL, + vg_size VARCHAR(255) NOT NULL, + vg_free VARCHAR(255) NOT NULL, + FOREIGN KEY (machine_id) REFERENCES machines(machine_id) +); + +CREATE TABLE IF NOT EXISTS physical_volumes ( + pv_id INT AUTO_INCREMENT PRIMARY KEY, + machine_id VARCHAR(255) NOT NULL, + pv_name VARCHAR(255) NOT NULL, + vg_name VARCHAR(255) NOT NULL, + pv_fmt VARCHAR(255) NOT NULL, + pv_attr VARCHAR(255) NOT NULL, + pv_size VARCHAR(255) NOT NULL, + pv_free VARCHAR(255) NOT NULL, + FOREIGN KEY (machine_id) REFERENCES machines(machine_id) +); + + +CREATE TABLE IF NOT EXISTS lv_storage_issuer ( + id INT AUTO_INCREMENT PRIMARY KEY, + machine_serial_number VARCHAR(255) NOT NULL, + hostname VARCHAR(255) NOT NULL, + username VARCHAR(255) NOT NULL, + minAvailableSpaceGB FLOAT NOT NULL, + maxAvailableSpaceGB FLOAT NOT NULL, + FOREIGN KEY (machine_serial_number) REFERENCES machines(machine_id) +); + +CREATE TABLE IF NOT EXISTS machine_conf ( + id INT AUTO_INCREMENT PRIMARY KEY, + machine_serial_number VARCHAR(255) NOT NULL, + hostname VARCHAR(255) NOT NULL, + username VARCHAR(255) NOT NULL, + passphrase LONGTEXT, + port_number INT NOT NULL, + password VARCHAR(255), + host_key VARCHAR(255), + folder_path VARCHAR(255) , + FOREIGN KEY (machine_serial_number) REFERENCES machines(machine_id) +); diff --git a/startDemo.sh b/startDemo.sh index 41a94dc..197cd15 100755 --- a/startDemo.sh +++ b/startDemo.sh @@ -5,7 +5,7 @@ if [ -d './var' ]; then ./cc-backend -server -dev else make - # wget https://hpc-mover.rrze.uni-erlangen.de/HPC-Data/0x7b58aefb/eig7ahyo6fo2bais0ephuf2aitohv1ai/job-archive-demo.tar + wget https://hpc-mover.rrze.uni-erlangen.de/HPC-Data/0x7b58aefb/eig7ahyo6fo2bais0ephuf2aitohv1ai/job-archive-demo.tar tar xf job-archive-demo.tar # rm ./job-archive-demo.tar