215 lines
5.4 KiB
Markdown
215 lines
5.4 KiB
Markdown
# SAMI-CLOUD Status Dashboard
|
|
|
|
A modern, cross-platform status dashboard with built-in app deployment capabilities.
|
|
|
|
## Features
|
|
|
|
- **Real-time Service Monitoring** - Monitor all your services with live status checks
|
|
- **Weather Integration** - Display current weather conditions
|
|
- **One-Click App Deployment** - Deploy new apps with automatic DNS and reverse proxy configuration
|
|
- **Cross-Platform** - Works on Windows, Linux, and macOS
|
|
- **API-Driven** - Uses Caddy Admin API and Technitium DNS API (no scripts required)
|
|
- **PWA Support** - Install as a Progressive Web App
|
|
- **Responsive Design** - Works on desktop, tablet, and mobile
|
|
- **Dark/Light Themes** - Multiple theme options
|
|
|
|
## Quick Start
|
|
|
|
### 1. Install Dependencies
|
|
|
|
```bash
|
|
cd api
|
|
npm install
|
|
```
|
|
|
|
### 2. Set Environment Variables
|
|
|
|
```bash
|
|
# Windows (PowerShell)
|
|
$env:CADDY_ADMIN_API="http://localhost:2019"
|
|
$env:DNS_SERVER_API="http://192.168.254.204:5380"
|
|
$env:TECHNITIUM_API_TOKEN="your_token_here"
|
|
|
|
# Linux/macOS
|
|
export CADDY_ADMIN_API=http://localhost:2019
|
|
export DNS_SERVER_API=http://192.168.254.204:5380
|
|
export TECHNITIUM_API_TOKEN=your_token_here
|
|
```
|
|
|
|
### 3. Start the API Server
|
|
|
|
```bash
|
|
# Windows
|
|
cd api
|
|
start.bat
|
|
|
|
# Linux/macOS
|
|
cd api
|
|
./start.sh
|
|
```
|
|
|
|
### 4. Configure Caddy
|
|
|
|
Add to your Caddyfile:
|
|
|
|
```caddyfile
|
|
status.sami {
|
|
tls internal
|
|
|
|
handle /api/* {
|
|
reverse_proxy localhost:3001
|
|
}
|
|
|
|
root * /path/to/sites/status
|
|
file_server
|
|
}
|
|
```
|
|
|
|
### 5. Access Dashboard
|
|
|
|
Open your browser to:
|
|
```
|
|
https://status.sami
|
|
```
|
|
|
|
## Documentation
|
|
|
|
- **[Deployment Guide](DEPLOYMENT_GUIDE.md)** - Complete deployment instructions
|
|
- **[API Documentation](api/README.md)** - API server setup and configuration
|
|
- **[Caddyfile](C:/caddy/Caddyfile)** - Production Caddyfile example
|
|
|
|
## Project Structure
|
|
|
|
```
|
|
status/
|
|
├── index.html # Main dashboard page
|
|
├── apps.json # Service configuration
|
|
├── sw.js # Service worker for PWA
|
|
├── assets/ # Images, fonts, and static assets
|
|
├── api/ # Node.js API server
|
|
│ ├── caddy-api.js # Main API server
|
|
│ ├── package.json # Dependencies
|
|
│ ├── test-api.js # API test script
|
|
│ ├── start.bat # Windows startup script
|
|
│ ├── start.sh # Linux/macOS startup script
|
|
│ └── README.md # API documentation
|
|
├── DEPLOYMENT_GUIDE.md # Complete deployment guide
|
|
└── README.md # This file
|
|
```
|
|
|
|
## Key Technologies
|
|
|
|
- **Frontend**: Vanilla JavaScript, HTML5, CSS3
|
|
- **Backend**: Node.js, Express.js
|
|
- **Web Server**: Caddy v2
|
|
- **DNS**: Technitium DNS Server
|
|
- **APIs**:
|
|
- Caddy Admin API (reverse proxy configuration)
|
|
- Technitium DNS API (DNS record management)
|
|
|
|
## How App Deployment Works
|
|
|
|
1. **User Input** - User selects app template and enters configuration (subdomain, IP, port)
|
|
2. **DNS Creation** - API creates A record in Technitium DNS
|
|
3. **Caddy Configuration** - API adds reverse proxy route via Caddy Admin API
|
|
4. **Instant Access** - App is immediately accessible at `https://subdomain.sami`
|
|
5. **Automatic Rollback** - If any step fails, previous changes are rolled back
|
|
|
|
## Features in Detail
|
|
|
|
### Service Monitoring
|
|
- HTTP/HTTPS status checks
|
|
- Response time tracking
|
|
- Visual status indicators
|
|
- Configurable check intervals
|
|
|
|
### App Deployment
|
|
- Pre-configured app templates (Plex, Radarr, Sonarr, etc.)
|
|
- Custom app deployment
|
|
- Automatic DNS record creation
|
|
- Automatic Caddy reverse proxy configuration
|
|
- Internal CA or Let's Encrypt SSL
|
|
- Private or public DNS options
|
|
|
|
### Weather Widget
|
|
- Current conditions
|
|
- Temperature and wind speed
|
|
- Location-based
|
|
- Configurable via settings
|
|
|
|
### PWA Support
|
|
- Offline functionality
|
|
- Install to home screen
|
|
- App-like experience
|
|
- Service worker caching
|
|
|
|
## API Endpoints
|
|
|
|
| Method | Endpoint | Description |
|
|
|--------|----------|-------------|
|
|
| POST | `/api/apps/deploy` | Deploy a new app |
|
|
| POST | `/api/apps/delete` | Delete an app |
|
|
| GET | `/api/services` | Get list of services |
|
|
| GET | `/api/caddy/config` | Get Caddy configuration |
|
|
| GET | `/api/caddy/test` | Test API connectivity |
|
|
| GET | `/health` | Health check |
|
|
|
|
## Configuration
|
|
|
|
### Environment Variables
|
|
|
|
- `CADDY_ADMIN_API` - Caddy Admin API URL (default: `http://localhost:2019`)
|
|
- `DNS_SERVER_API` - Technitium DNS API URL (default: `http://192.168.254.204:5380`)
|
|
- `TECHNITIUM_API_TOKEN` - API token for DNS operations (required)
|
|
|
|
### Service Configuration
|
|
|
|
Edit `apps.json` to add/remove services:
|
|
|
|
```json
|
|
[
|
|
{
|
|
"id": "myapp",
|
|
"name": "My App",
|
|
"logo": "assets/myapp.png",
|
|
"url": "https://myapp.sami"
|
|
}
|
|
]
|
|
```
|
|
|
|
## Browser Support
|
|
|
|
- Chrome/Edge (latest)
|
|
- Firefox (latest)
|
|
- Safari (latest)
|
|
- Mobile browsers (iOS Safari, Chrome Mobile)
|
|
|
|
## Security
|
|
|
|
- CORS enabled (configure for production)
|
|
- API access restricted to localhost by default
|
|
- Environment-based configuration
|
|
- Input validation on all endpoints
|
|
- Automatic rollback on deployment failures
|
|
|
|
## Troubleshooting
|
|
|
|
See [DEPLOYMENT_GUIDE.md](DEPLOYMENT_GUIDE.md#troubleshooting) for detailed troubleshooting steps.
|
|
|
|
Common issues:
|
|
- **API not accessible**: Check if Node.js server is running
|
|
- **DNS not working**: Verify `TECHNITIUM_API_TOKEN` is set
|
|
- **Caddy routes not working**: Check Caddy Admin API is enabled
|
|
|
|
## Contributing
|
|
|
|
This is a personal project for SAMI-CLOUD infrastructure. Feel free to fork and adapt for your own use.
|
|
|
|
## License
|
|
|
|
MIT
|
|
|
|
## Author
|
|
|
|
SAMI-CLOUD
|