Skip to content

Commit

Permalink
add swagger monitor (#2)
Browse files Browse the repository at this point in the history
* add swagger-stats for monitor performance

* ignore volumes when perform lint

* fix name

* update README
  • Loading branch information
cbh778899 authored Jul 30, 2024
1 parent 8d0c334 commit 98d50b7
Show file tree
Hide file tree
Showing 6 changed files with 198 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ pnpm-lock.yaml
eslint.config.mjs
LICENSE
volumes
docker-compose,yaml
docker-compose.yaml
27 changes: 24 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# VOYAGER
This project is OpenAI-like API set for SkywardAI project.

# BUILD & RUN
## BUILD & RUN

## Local Machine
### Local Machine
* This project developed on Node Version `v20.15.0`.
* Make sure you installed `Node.js`.

Expand All @@ -19,4 +19,25 @@ npm install

# RUN
npm run
```
```

### Container
**Please make sure you have `docker` and `make` installed in your server**
```shell
# to simply start with all needed containers started, please run
make up
# if you just want to build this project to docker container, please run
make build
# if you want to start only this project in docker, please run
make start
# PLEASE NOTE: make start will automatically run make build first
```

## Lint
To start lint your code, simply run
```shell
npm run lint
```

## Monitor
This project got monitor build with swagger-stats, when you got this project running, just go to `<Your Server>:<Your Port>/swagger-stats`
1 change: 1 addition & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export default [
}
},
{
ignores: ["volumes/*"],
rules: {
'no-undef': 'off'
}
Expand Down
5 changes: 5 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,16 @@ import { configDotenv } from 'dotenv';

import buildRoutes from './routes/index.js'

import swStats from 'swagger-stats';

configDotenv()

const app = express();
app.use(cors());
app.use(bodyParser.json());
app.use(swStats.getMiddleware({
name: "Voyager Swagger Monitor"
}))

buildRoutes(app);

Expand Down
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
"dotenv": "^16.4.5",
"eslint": "^9.8.0",
"express": "^4.19.2",
"globals": "^15.8.0"
"globals": "^15.8.0",
"prom-client": "12",
"swagger-stats": "^0.99.7"
}
}
Loading

0 comments on commit 98d50b7

Please sign in to comment.