52 أسطر
857 B
Markdown
52 أسطر
857 B
Markdown
# q1-deploy-monitor
|
|
|
|
Small Node.js and Express API for an SRE take-home assessment.
|
|
|
|
## Install
|
|
|
|
```bash
|
|
npm install
|
|
```
|
|
|
|
## Run locally
|
|
|
|
```bash
|
|
npm start
|
|
```
|
|
|
|
The server listens on `PORT` or `3000`.
|
|
|
|
Open the dashboard in the browser at `http://localhost:3000/dashboard`.
|
|
|
|
You can also open `dashboard.html` directly if the API server is running on `http://localhost:3000`.
|
|
|
|
## Docker
|
|
|
|
Build:
|
|
|
|
```bash
|
|
docker build -t q1-deploy-monitor .
|
|
```
|
|
|
|
Run:
|
|
|
|
```bash
|
|
docker run -p 3000:3000 q1-deploy-monitor
|
|
```
|
|
|
|
## Endpoints
|
|
|
|
- `GET /` - basic API message
|
|
- `GET /health` - health status, uptime, and timestamp
|
|
- `GET /metrics` - health plus request count and memory usage
|
|
- `GET /dashboard` - simple HTML dashboard
|
|
|
|
## Health check script
|
|
|
|
Run:
|
|
|
|
```bash
|
|
sh health-check.sh
|
|
```
|
|
|
|
It calls `/health` every 30 seconds and prints timestamp, status, and response time. |