-
Notifications
You must be signed in to change notification settings - Fork 4
Feat/w3ds evoting #290
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
Merged
Merged
Feat/w3ds evoting #290
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
e475c7e
chore: add migrations
coodos 842f129
feat: voting logic
coodos d1d7d59
feat: points & rank based voting
coodos 12bbf8e
chore: control panel features
coodos 12b8ec0
chore: sign pages
coodos 6f53fb7
feat: eVoting
coodos 62e4aca
fix: deeplink stuff
coodos 6c0c7fe
feat: eVoting responsiveness
coodos ad2e662
chore: merge upstream
coodos File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,167 @@ | ||
# sv | ||
# Control Panel | ||
|
||
Everything you need to build a Svelte project, powered by [`sv`](https://github.com/sveltejs/cli). | ||
A SvelteKit-based control panel for monitoring and managing various services and platforms. | ||
|
||
## Creating a project | ||
## Features | ||
|
||
If you're seeing this, you've probably already done this step. Congrats! | ||
### eVault Monitoring | ||
|
||
- **Real-time eVault Discovery**: Automatically discovers eVault pods across all Kubernetes namespaces | ||
- **Pod Information**: Displays comprehensive pod details including status, readiness, restarts, age, IP, and node | ||
- **Live Logs**: View real-time logs from eVault pods with automatic refresh | ||
- **Pod Details**: Access detailed pod information including YAML configuration and resource usage | ||
- **Metrics**: View pod performance metrics (when metrics-server is available) | ||
|
||
## Prerequisites | ||
|
||
### Kubernetes Access | ||
|
||
- `kubectl` must be installed and configured | ||
- Access to the Kubernetes cluster where eVaults are running | ||
- Proper RBAC permissions to list and describe pods | ||
|
||
### System Requirements | ||
|
||
- Node.js 18+ | ||
- Access to execute `kubectl` commands | ||
|
||
## Installation | ||
|
||
1. Install dependencies: | ||
|
||
```bash | ||
# create a new project in the current directory | ||
npx sv create | ||
npm install | ||
``` | ||
|
||
2. Ensure kubectl is configured: | ||
|
||
# create a new project in my-app | ||
npx sv create my-app | ||
```bash | ||
kubectl cluster-info | ||
``` | ||
|
||
## Developing | ||
## Usage | ||
|
||
Once you've created a project and installed dependencies with `npm install` (or `pnpm install` or `yarn`), start a development server: | ||
### Development | ||
|
||
```bash | ||
npm run dev | ||
|
||
# or start the server and open the app in a new browser tab | ||
npm run dev -- --open | ||
``` | ||
|
||
## Building | ||
|
||
To create a production version of your app: | ||
### Building | ||
|
||
```bash | ||
npm run build | ||
``` | ||
|
||
You can preview the production build with `npm run preview`. | ||
## eVault Monitoring | ||
|
||
### Main Dashboard | ||
|
||
The main page displays a table of all eVault pods found across your Kubernetes cluster: | ||
|
||
- **Name**: Clickable link to detailed pod view | ||
- **Namespace**: Kubernetes namespace where the pod is running | ||
- **Status**: Current pod status (Running, Pending, Failed, etc.) | ||
- **Ready**: Number of ready containers vs total containers | ||
- **Restarts**: Number of container restarts | ||
- **Age**: How long the pod has been running | ||
- **IP**: Pod IP address | ||
- **Node**: Kubernetes node where the pod is scheduled | ||
|
||
### Detailed Pod View | ||
|
||
Click on any eVault name to access detailed monitoring: | ||
|
||
#### Logs Tab | ||
|
||
- Real-time pod logs with automatic refresh | ||
- Configurable log tail length | ||
- Terminal-style display for easy reading | ||
|
||
#### Details Tab | ||
|
||
- Complete pod description from `kubectl describe pod` | ||
- YAML configuration from `kubectl get pod -o yaml` | ||
- Resource requests and limits | ||
- Environment variables and volume mounts | ||
|
||
#### Metrics Tab | ||
|
||
- CPU and memory usage (requires metrics-server) | ||
- Resource consumption trends | ||
- Performance monitoring data | ||
|
||
### API Endpoints | ||
|
||
#### GET /api/evaults | ||
|
||
Returns a list of all eVault pods across all namespaces. | ||
|
||
#### GET /api/evaults/[namespace]/[pod]/logs?tail=[number] | ||
|
||
Returns the most recent logs from a specific pod. | ||
|
||
#### GET /api/evaults/[namespace]/[pod]/details | ||
|
||
Returns detailed information about a specific pod. | ||
|
||
## Configuration | ||
|
||
### eVault Detection | ||
|
||
The system automatically detects eVault pods by filtering for pods with names containing: | ||
|
||
- `evault` | ||
- `vault` | ||
- `web3` | ||
|
||
You can modify the filter in `src/routes/api/evaults/+server.ts` to adjust detection criteria. | ||
|
||
### Log Tail Length | ||
|
||
Default log tail length is 100 lines. This can be configured via the `tail` query parameter. | ||
|
||
## Troubleshooting | ||
|
||
### No eVaults Found | ||
|
||
1. Verify kubectl is configured: `kubectl cluster-info` | ||
2. Check if eVault pods are running: `kubectl get pods --all-namespaces` | ||
3. Verify pod names contain expected keywords | ||
4. Check RBAC permissions for pod listing | ||
|
||
### Permission Denied | ||
|
||
Ensure your kubectl context has permissions to: | ||
|
||
- List pods across namespaces | ||
- Describe pods | ||
- Access pod logs | ||
- View pod metrics (if using metrics-server) | ||
|
||
### Metrics Not Available | ||
|
||
If the metrics tab shows no data: | ||
|
||
1. Verify metrics-server is installed: `kubectl get pods -n kube-system | grep metrics` | ||
2. Check metrics-server logs for errors | ||
3. Ensure HPA (Horizontal Pod Autoscaler) is configured if needed | ||
|
||
## Security Considerations | ||
|
||
- The control panel executes kubectl commands on the server | ||
- Ensure proper access controls and authentication | ||
- Consider implementing role-based access control | ||
- Monitor and audit kubectl command execution | ||
|
||
## Contributing | ||
|
||
1. Fork the repository | ||
2. Create a feature branch | ||
3. Make your changes | ||
4. Add tests if applicable | ||
5. Submit a pull request | ||
|
||
## License | ||
|
||
> To deploy your app, you may need to install an [adapter](https://svelte.dev/docs/kit/adapters) for your target environment. | ||
[Add your license information here] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
57 changes: 57 additions & 0 deletions
57
infrastructure/control-panel/src/lib/services/evaultService.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
import type { EVault } from '../../routes/api/evaults/+server'; | ||
|
||
export class EVaultService { | ||
static async getEVaults(): Promise<EVault[]> { | ||
try { | ||
const response = await fetch('/api/evaults'); | ||
if (!response.ok) { | ||
throw new Error('Failed to fetch eVaults'); | ||
} | ||
const data = await response.json(); | ||
return data.evaults || []; | ||
} catch (error) { | ||
console.error('Error fetching eVaults:', error); | ||
return []; | ||
} | ||
} | ||
|
||
static async getEVaultLogs(namespace: string, podName: string, tail: number = 100): Promise<string[]> { | ||
try { | ||
const response = await fetch(`/api/evaults/${encodeURIComponent(namespace)}/${encodeURIComponent(podName)}/logs?tail=${tail}`); | ||
if (!response.ok) { | ||
throw new Error('Failed to fetch logs'); | ||
} | ||
const data = await response.json(); | ||
return data.logs || []; | ||
} catch (error) { | ||
console.error('Error fetching logs:', error); | ||
return []; | ||
} | ||
} | ||
|
||
static async getEVaultDetails(namespace: string, podName: string): Promise<any> { | ||
try { | ||
const response = await fetch(`/api/evaults/${encodeURIComponent(namespace)}/${encodeURIComponent(podName)}/details`); | ||
if (!response.ok) { | ||
throw new Error('Failed to fetch eVault details'); | ||
} | ||
return await response.json(); | ||
} catch (error) { | ||
console.error('Error fetching eVault details:', error); | ||
return null; | ||
} | ||
} | ||
|
||
static async getEVaultMetrics(namespace: string, podName: string): Promise<any> { | ||
try { | ||
const response = await fetch(`/api/evaults/${encodeURIComponent(namespace)}/${encodeURIComponent(podName)}/metrics`); | ||
if (!response.ok) { | ||
throw new Error('Failed to fetch metrics'); | ||
} | ||
return await response.json(); | ||
} catch (error) { | ||
console.error('Error fetching eVault metrics:', error); | ||
return null; | ||
} | ||
} | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
💡 Verification agent
🧩 Analysis chain
Verify lucide-svelte compatibility with Svelte 5 and lock if needed
Adding lucide-svelte looks fine, but please confirm peer compatibility with your Svelte version and consider pinning if you see downstream breakage (icons libs sometimes ship breaking changes).
You can quickly check the latest version and peer deps:
🏁 Script executed:
Length of output: 121
I wasn’t able to parse the peer info from the previous command—let’s try explicitly requesting JSON for both peerDependencies and engines:
🏁 Script executed:
Length of output: 147
Confirm lucide-svelte peer dependency supports your Svelte version
The current lucide-svelte@0.539.0 lists
– it does not include stable Svelte 5.x releases. If this control-panel is upgraded to Svelte 5.0.0 (or higher), you’ll encounter peer-dependency warnings or runtime breakage.
Please verify your Svelte version in infrastructure/control-panel/package.json and choose one of the following:
"^5"
support.File: infrastructure/control-panel/package.json
Line: 53