Phillip/prod perf2 (#15596)

* Add new api call for kubernetes startup probe

* add hostname as tag for loggly

* Only listen to one change

* increase vite min chunk size

* respond gracefully to shutdown signal

* update server readiness according to mongodb and redis connection

* make larger vite chunks

* fix lint
This commit is contained in:
Phillip Thelen
2026-02-24 17:17:21 +01:00
committed by GitHub
parent 4ea8636f03
commit 3e93911e70
8 changed files with 82 additions and 4 deletions
@@ -0,0 +1,39 @@
import {
disableCache,
} from '../../middlewares/cache';
import SERVER_STATUS from '../../libs/serverStatus';
const api = {};
/**
* @api {get} /api/v3/ready Get Habitica's Server readiness status
* @apiName GetReady
* @apiGroup Status
*
* @apiSuccess {String} data.status 'ready' if everything is ok
*
* @apiSuccessExample {JSON} Server is Ready
* {
* 'status': 'ready',
* }
*/
api.getReady = {
method: 'GET',
url: '/ready',
// explicitly disable caching so that the server is always checked
middlewares: [disableCache],
async handler (req, res) {
// This allows kubernetes to determine if the server is ready to receive traffic
if (!SERVER_STATUS.MONGODB || !SERVER_STATUS.REDIS || !SERVER_STATUS.EXPRESS) {
res.respond(503, {
status: 'not ready',
});
} else {
res.respond(200, {
status: 'ready',
});
}
},
};
export default api;