adding docker files
This commit is contained in:
parent
f2b0e1ab7b
commit
9be859a22a
3
.dockerignore
Normal file
3
.dockerignore
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
node_modules
|
||||||
|
npm-debug.log
|
||||||
|
.git
|
4
05-WAMO-Demo.bat
Normal file
4
05-WAMO-Demo.bat
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
set DIR=%~dp0
|
||||||
|
cd "%DIR%"
|
||||||
|
node .\dist\lib\cli\runNopeBackend.js -c io-server -l info -f ./config/settings_wamo_ips.json
|
||||||
|
pause
|
13
Dockerfile
Normal file
13
Dockerfile
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
FROM node:latest
|
||||||
|
|
||||||
|
RUN mkdir /nope
|
||||||
|
COPY . /nope/
|
||||||
|
|
||||||
|
# Create a Volume containg the configuration
|
||||||
|
WORKDIR /nope
|
||||||
|
|
||||||
|
# Install Binaries
|
||||||
|
RUN npm install
|
||||||
|
|
||||||
|
# Execute the Kernel
|
||||||
|
CMD ["node","./dist/lib/cli/runNopeBackend.js", "-c","io-server","-l","info","-f","./config/settings_wamo_ips.json"]
|
173
resources/admin-shell/host.tsx
Normal file
173
resources/admin-shell/host.tsx
Normal file
@ -0,0 +1,173 @@
|
|||||||
|
/**
|
||||||
|
* @author Martin Karkowski
|
||||||
|
* @email m.karkowski@zema.de
|
||||||
|
* @create date 2021-01-12 16:44:15
|
||||||
|
* @modify date 2021-01-12 16:44:15
|
||||||
|
* @desc [description]
|
||||||
|
*/
|
||||||
|
|
||||||
|
import React from "react";
|
||||||
|
import { Badge, Card, ProgressBar, Table } from "react-bootstrap";
|
||||||
|
import { ENopeDispatcherStatus } from "../../lib/types/nope/nopeDispatcher.interface";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Component used to render the Status of the Memory of a Host.
|
||||||
|
*/
|
||||||
|
export class MemoryStatusOfHostComponent extends React.Component<
|
||||||
|
{
|
||||||
|
value: number;
|
||||||
|
},
|
||||||
|
{}
|
||||||
|
> {
|
||||||
|
render() {
|
||||||
|
// Determine the Now Value.
|
||||||
|
const now = Math.round(1000 - this.props.value * 1000) / 10;
|
||||||
|
const colorRange = {
|
||||||
|
"0": "success",
|
||||||
|
"30": "success",
|
||||||
|
"75": "warning",
|
||||||
|
"90": "danger",
|
||||||
|
"101": "danger"
|
||||||
|
};
|
||||||
|
|
||||||
|
// Determine the Color, Therefore filter the "keys" based on the now Value.
|
||||||
|
const color =
|
||||||
|
colorRange[
|
||||||
|
Object.getOwnPropertyNames(colorRange).filter(
|
||||||
|
(value) => now < parseFloat(value)
|
||||||
|
)[0]
|
||||||
|
];
|
||||||
|
|
||||||
|
// Render
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<ProgressBar now={now} label={`${now} %`} variant={color} />
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export class HostStatusComponent extends React.Component<
|
||||||
|
{
|
||||||
|
status: {
|
||||||
|
cpu: string;
|
||||||
|
cores: number;
|
||||||
|
os: string;
|
||||||
|
ram: number;
|
||||||
|
name: string;
|
||||||
|
pids: {
|
||||||
|
pid: number;
|
||||||
|
dispatchers: {
|
||||||
|
id: string;
|
||||||
|
status: ENopeDispatcherStatus;
|
||||||
|
timestamp: number;
|
||||||
|
}[];
|
||||||
|
}[];
|
||||||
|
status: ENopeDispatcherStatus;
|
||||||
|
timestamp: number;
|
||||||
|
};
|
||||||
|
},
|
||||||
|
{
|
||||||
|
lastUpdate: string;
|
||||||
|
variant: "success" | "warning" | "danger";
|
||||||
|
badge: boolean;
|
||||||
|
badgeText: string;
|
||||||
|
}
|
||||||
|
> {
|
||||||
|
protected _intervall: any = null;
|
||||||
|
|
||||||
|
get _state() {
|
||||||
|
const dict = {
|
||||||
|
0: "success",
|
||||||
|
1: "info",
|
||||||
|
2: "warning",
|
||||||
|
3: "danger"
|
||||||
|
};
|
||||||
|
|
||||||
|
return {
|
||||||
|
lastUpdate: new Date(this.props.status.timestamp).toISOString(),
|
||||||
|
variant: dict[this.props.status.status],
|
||||||
|
badge: this.props.status.status !== ENopeDispatcherStatus.HEALTHY,
|
||||||
|
badgeText: ENopeDispatcherStatus[this.props.status.status]
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
constructor(props) {
|
||||||
|
super(props);
|
||||||
|
this.state = this._state;
|
||||||
|
}
|
||||||
|
|
||||||
|
componentDidMount(): void {
|
||||||
|
const _this = this;
|
||||||
|
this._intervall = setInterval(() => {
|
||||||
|
_this.setState(this._state);
|
||||||
|
}, 200);
|
||||||
|
}
|
||||||
|
|
||||||
|
componentWillUnmount(): void {
|
||||||
|
if (this._intervall) {
|
||||||
|
clearInterval(this._intervall);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
render(): JSX.Element {
|
||||||
|
return (
|
||||||
|
<Card border={this.state.variant}>
|
||||||
|
<Card.Body>
|
||||||
|
<Card.Title>
|
||||||
|
{" "}
|
||||||
|
{this.state.badge ? (
|
||||||
|
<>
|
||||||
|
{this.props.status.name}{" "}
|
||||||
|
<Badge variant={this.state.variant}>
|
||||||
|
ELEMENT {this.state.badgeText} !
|
||||||
|
</Badge>{" "}
|
||||||
|
</>
|
||||||
|
) : (
|
||||||
|
<>{this.props.status.name}</>
|
||||||
|
)}{" "}
|
||||||
|
</Card.Title>
|
||||||
|
<Table bordered>
|
||||||
|
<tbody>
|
||||||
|
{this.props.status.ram > 0 ? (
|
||||||
|
<tr>
|
||||||
|
<td>RAM</td>
|
||||||
|
<td>
|
||||||
|
{" "}
|
||||||
|
{/* Rendert the Memory */}
|
||||||
|
<MemoryStatusOfHostComponent
|
||||||
|
value={this.props.status.ram}
|
||||||
|
></MemoryStatusOfHostComponent>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
) : (
|
||||||
|
<></>
|
||||||
|
)}
|
||||||
|
<tr>
|
||||||
|
<td>CPU</td>
|
||||||
|
<td>{this.props.status.cpu}</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Cores</td>
|
||||||
|
<td>{this.props.status.cores}</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Platform</td>
|
||||||
|
<td>{this.props.status.os}</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Nope-Processes</td>
|
||||||
|
<td>{this.props.status.pids.length}</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</Table>
|
||||||
|
</Card.Body>
|
||||||
|
<Card.Footer>
|
||||||
|
<small className="text-muted">
|
||||||
|
Last updated <b>{this.state.lastUpdate}</b>
|
||||||
|
</small>
|
||||||
|
</Card.Footer>
|
||||||
|
</Card>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user