-
Notifications
You must be signed in to change notification settings - Fork 0
Add Next.js web dashboard foundation #44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| version: '3.9' | ||
|
|
||
| services: | ||
| api: | ||
| build: . | ||
| command: uvicorn detlab.api:app --host 0.0.0.0 --port 8000 | ||
| ports: | ||
| - '8000:8000' | ||
|
|
||
| web: | ||
| build: ./web | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
With the documented Useful? React with 👍 / 👎. |
||
| ports: | ||
| - '3000:3000' | ||
| depends_on: | ||
| - api | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| async function getHealth() { | ||
| try { | ||
| const response = await fetch('http://localhost:8000/health', { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
In the Compose deployment, this page is rendered on the Next.js server inside the Useful? React with 👍 / 👎. |
||
| cache: 'no-store' | ||
| }) | ||
|
|
||
| return response.json() | ||
| } catch { | ||
| return { status: 'offline' } | ||
| } | ||
| } | ||
|
|
||
| export default async function HomePage() { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
This adds an App Router page under Useful? React with 👍 / 👎. |
||
| const health = await getHealth() | ||
|
|
||
| return ( | ||
| <main style={{ padding: '2rem', fontFamily: 'Arial' }}> | ||
| <h1>DetLab Dashboard</h1> | ||
|
|
||
| <div style={{ marginTop: '2rem' }}> | ||
| <h2>Platform Status</h2> | ||
| <p>API Status: {health.status}</p> | ||
| </div> | ||
|
|
||
| <div style={{ marginTop: '2rem' }}> | ||
| <h2>Capabilities</h2> | ||
|
|
||
| <ul> | ||
| <li>ATT&CK Analytics</li> | ||
| <li>Detection Scoring</li> | ||
| <li>Behavioral Sequences</li> | ||
| <li>Pack Registry</li> | ||
| <li>Trust Verification</li> | ||
| <li>Governance Reporting</li> | ||
| </ul> | ||
| </div> | ||
| </main> | ||
| ) | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| { | ||
| "name": "detlab-web", | ||
| "private": true, | ||
| "version": "0.1.0", | ||
| "scripts": { | ||
| "dev": "next dev", | ||
| "build": "next build", | ||
| "start": "next start" | ||
| }, | ||
| "dependencies": { | ||
| "next": "14.2.5", | ||
| "react": "18.3.1", | ||
| "react-dom": "18.3.1" | ||
| } | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When the documented Docker Compose stack is used, this service builds the existing root
Dockerfile, whoseENTRYPOINTis['detlab']and whose install step does not includerequirements-api.txt. The Composecommandis therefore passed as arguments to thedetlabCLI instead of replacing the entrypoint, so the API container starts asdetlab uvicorn ...and exits before/healthis available. Use an API-specific image/install path and overrideentrypoint(or change the Dockerfile entrypoint) before relying on this stack.Useful? React with 👍 / 👎.