mirror of
https://github.com/OneUptime/oneuptime.git
synced 2026-04-06 00:32:12 +02:00
[skip-ci] expose status endpoint
This commit is contained in:
@@ -61,6 +61,17 @@ app.get(['/env.js', '/admin/env.js'], function(req, res) {
|
||||
res.send('window._env = ' + JSON.stringify(env));
|
||||
});
|
||||
|
||||
app.get(['/admin/status', '/status'], function(req, res) {
|
||||
res.setHeader('Content-Type', 'application/json');
|
||||
res.send(
|
||||
JSON.stringify({
|
||||
status: 200,
|
||||
message: 'Service Status - OK',
|
||||
serviceType: 'oneuptime-admin-dashboard',
|
||||
})
|
||||
);
|
||||
});
|
||||
|
||||
app.use(express.static(path.join(__dirname, 'build')));
|
||||
app.use('/admin', express.static(path.join(__dirname, 'build')));
|
||||
app.use(
|
||||
|
||||
@@ -58,16 +58,7 @@ const cronApplicationSecurityStartTime = Math.floor(Math.random() * 50);
|
||||
app.use(cors());
|
||||
app.set('port', process.env.PORT || 3005);
|
||||
|
||||
http.listen(app.get('port'), function() {
|
||||
// eslint-disable-next-line
|
||||
console.log(
|
||||
`Application Scanner Started on port ${app.get(
|
||||
'port'
|
||||
)}. OneUptime API URL: ${config.serverUrl}`
|
||||
);
|
||||
});
|
||||
|
||||
app.get('/', function(req, res) {
|
||||
app.get(['/application/status', '/status'], function(req, res) {
|
||||
res.setHeader('Content-Type', 'application/json');
|
||||
res.send(
|
||||
JSON.stringify({
|
||||
@@ -94,4 +85,13 @@ cron.schedule('*/5 * * * *', () => {
|
||||
}, cronApplicationSecurityStartTime * 1000);
|
||||
});
|
||||
|
||||
http.listen(app.get('port'), function() {
|
||||
// eslint-disable-next-line
|
||||
console.log(
|
||||
`Application Scanner Started on port ${app.get(
|
||||
'port'
|
||||
)}. OneUptime API URL: ${config.serverUrl}`
|
||||
);
|
||||
});
|
||||
|
||||
module.exports = app;
|
||||
|
||||
@@ -56,16 +56,7 @@ const cronContainerSecurityStartTime = Math.floor(Math.random() * 50);
|
||||
app.use(cors());
|
||||
app.set('port', process.env.PORT || 3055);
|
||||
|
||||
http.listen(app.get('port'), function() {
|
||||
// eslint-disable-next-line
|
||||
console.log(
|
||||
`Container Scanner Started on port ${app.get(
|
||||
'port'
|
||||
)}. OneUptime API URL: ${config.serverUrl}`
|
||||
);
|
||||
});
|
||||
|
||||
app.get('/', function(req, res) {
|
||||
app.get(['/container/status', '/status'], function(req, res) {
|
||||
res.setHeader('Content-Type', 'application/json');
|
||||
res.send(
|
||||
JSON.stringify({
|
||||
@@ -92,4 +83,13 @@ cron.schedule('*/5 * * * *', () => {
|
||||
}, cronContainerSecurityStartTime * 1000);
|
||||
});
|
||||
|
||||
http.listen(app.get('port'), function() {
|
||||
// eslint-disable-next-line
|
||||
console.log(
|
||||
`Container Scanner Started on port ${app.get(
|
||||
'port'
|
||||
)}. OneUptime API URL: ${config.serverUrl}`
|
||||
);
|
||||
});
|
||||
|
||||
module.exports = app;
|
||||
|
||||
@@ -140,6 +140,17 @@ app.use(['/dashboard/api/version', '/dashboard/version'], function(req, res) {
|
||||
res.json({ dashboardVersion: process.env.npm_package_version });
|
||||
});
|
||||
|
||||
app.get(['/dashboard/status', '/status'], function(req, res) {
|
||||
res.setHeader('Content-Type', 'application/json');
|
||||
res.send(
|
||||
JSON.stringify({
|
||||
status: 200,
|
||||
message: 'Service Status - OK',
|
||||
serviceType: 'oneuptime-dashboard',
|
||||
})
|
||||
);
|
||||
});
|
||||
|
||||
app.use(express.static(path.join(__dirname, 'build')));
|
||||
app.use('/dashboard', express.static(path.join(__dirname, 'build')));
|
||||
app.use(/^\/dashboard\/static\/js\/2\.(.+)\.chunk\.js$/, function(
|
||||
|
||||
@@ -97,6 +97,17 @@ app.use(function(req, res, next) {
|
||||
app.use(express.urlencoded({ limit: '10mb', extended: true }));
|
||||
app.use(express.json({ limit: '10mb' }));
|
||||
|
||||
app.get(['/data-ingestor/status', '/status'], function(req, res) {
|
||||
res.setHeader('Content-Type', 'application/json');
|
||||
res.send(
|
||||
JSON.stringify({
|
||||
status: 200,
|
||||
message: 'Service Status - OK',
|
||||
serviceType: 'oneuptime-data-ingestor',
|
||||
})
|
||||
);
|
||||
});
|
||||
|
||||
app.use(['/probe', '/api/probe'], require('./api/probe'));
|
||||
|
||||
app.use(Sentry.Handlers.errorHandler());
|
||||
|
||||
@@ -71,6 +71,17 @@ app.use(bodyParser.json());
|
||||
|
||||
app.use(require('./backend/api/settings'));
|
||||
|
||||
app.get('/status', function(req, res) {
|
||||
res.setHeader('Content-Type', 'application/json');
|
||||
res.send(
|
||||
JSON.stringify({
|
||||
status: 200,
|
||||
message: 'Service Status - OK',
|
||||
serviceType: 'oneuptime-http-test-server',
|
||||
})
|
||||
);
|
||||
});
|
||||
|
||||
app.get('/', function(req, res) {
|
||||
if (http.STATUS_CODES[global.httpServerResponse.statusCode]) {
|
||||
res.status(global.httpServerResponse.statusCode);
|
||||
|
||||
@@ -56,16 +56,7 @@ const cronMinuteStartTime = Math.floor(Math.random() * 50);
|
||||
app.use(cors());
|
||||
app.set('port', process.env.PORT || 3015);
|
||||
|
||||
http.listen(app.get('port'), function() {
|
||||
// eslint-disable-next-line
|
||||
console.log(
|
||||
`Lighthouse Started on port ${app.get('port')}. OneUptime API URL: ${
|
||||
config.serverUrl
|
||||
}`
|
||||
);
|
||||
});
|
||||
|
||||
app.get('/', function(req, res) {
|
||||
app.get(['/lighthouse/status', '/status'], function(req, res) {
|
||||
res.setHeader('Content-Type', 'application/json');
|
||||
res.send(
|
||||
JSON.stringify({
|
||||
@@ -92,4 +83,13 @@ cron.schedule('*/30 * * * *', () => {
|
||||
}, cronMinuteStartTime * 1000);
|
||||
});
|
||||
|
||||
http.listen(app.get('port'), function() {
|
||||
// eslint-disable-next-line
|
||||
console.log(
|
||||
`Lighthouse Started on port ${app.get('port')}. OneUptime API URL: ${
|
||||
config.serverUrl
|
||||
}`
|
||||
);
|
||||
});
|
||||
|
||||
module.exports = app;
|
||||
|
||||
@@ -61,20 +61,9 @@ const cronMinuteStartTime = Math.floor(Math.random() * 50);
|
||||
app.use(cors());
|
||||
app.set('port', process.env.PORT || 3008);
|
||||
|
||||
http.listen(app.get('port'), function() {
|
||||
// eslint-disable-next-line
|
||||
console.log(
|
||||
`Probe with Probe Name ${config.probeName} and Probe Key ${
|
||||
config.probeKey
|
||||
} Started on port ${app.get('port')}. OneUptime API URL: ${
|
||||
config.serverUrl
|
||||
}`
|
||||
);
|
||||
});
|
||||
|
||||
const monitorStore = {};
|
||||
|
||||
app.get('/status', function(req, res) {
|
||||
app.get(['/probe/status', '/status'], function(req, res) {
|
||||
res.setHeader('Content-Type', 'application/json');
|
||||
res.send(
|
||||
JSON.stringify({
|
||||
@@ -111,4 +100,15 @@ cron.schedule('*/2 * * * *', () => {
|
||||
}, cronMinuteStartTime * 1000);
|
||||
});
|
||||
|
||||
http.listen(app.get('port'), function() {
|
||||
// eslint-disable-next-line
|
||||
console.log(
|
||||
`Probe with Probe Name ${config.probeName} and Probe Key ${
|
||||
config.probeKey
|
||||
} Started on port ${app.get('port')}. OneUptime API URL: ${
|
||||
config.serverUrl
|
||||
}`
|
||||
);
|
||||
});
|
||||
|
||||
module.exports = app;
|
||||
|
||||
@@ -125,7 +125,7 @@ app.use(function(req, res, next) {
|
||||
app.use(express.urlencoded({ limit: '10mb', extended: true }));
|
||||
app.use(express.json({ limit: '10mb' }));
|
||||
|
||||
app.get('/realtime/stat', function(req, res) {
|
||||
app.get(['/realtime/status', '/status'], function(req, res) {
|
||||
res.setHeader('Content-Type', 'application/json');
|
||||
res.send(
|
||||
JSON.stringify({
|
||||
|
||||
@@ -73,7 +73,7 @@ app.set('port', process.env.PORT || 3009);
|
||||
app.use(bodyParser.urlencoded({ limit: '10mb', extended: true }));
|
||||
app.use(bodyParser.json({ limit: '10mb' }));
|
||||
|
||||
app.get('/script/status', function(req, res) {
|
||||
app.get(['/script/status', '/status'], function(req, res) {
|
||||
res.setHeader('Content-Type', 'application/json');
|
||||
res.send(
|
||||
JSON.stringify({
|
||||
|
||||
@@ -193,31 +193,6 @@ app.use(async function(req, res, next) {
|
||||
}
|
||||
});
|
||||
|
||||
// app.use(async function(req, res, next) {
|
||||
// const host = req.hostname;
|
||||
|
||||
// try {
|
||||
// if (host && host === 'fyipe.com') {
|
||||
// res.writeHead(301, {
|
||||
// Location: `https://oneuptime.com${req.url}`,
|
||||
// });
|
||||
// return res.end();
|
||||
// }
|
||||
// if (host && host === 'staging.fyipe.com') {
|
||||
// res.writeHead(301, {
|
||||
// Location: `https://staging.oneuptime.com${req.url}`,
|
||||
// });
|
||||
// return res.end();
|
||||
// }
|
||||
|
||||
// return next();
|
||||
// } catch (error) {
|
||||
// // eslint-disable-next-line no-console
|
||||
// console.log('Status Page: Error with fetch', error);
|
||||
// return next();
|
||||
// }
|
||||
// });
|
||||
|
||||
app.use('/', async function(req, res, next) {
|
||||
const host = req.hostname;
|
||||
if (
|
||||
@@ -259,6 +234,17 @@ app.use('/', async function(req, res, next) {
|
||||
}
|
||||
});
|
||||
|
||||
app.get(['/status-page/status', '/status'], function(req, res) {
|
||||
res.setHeader('Content-Type', 'application/json');
|
||||
res.send(
|
||||
JSON.stringify({
|
||||
status: 200,
|
||||
message: 'Service Status - OK',
|
||||
serviceType: 'oneuptime-status-page',
|
||||
})
|
||||
);
|
||||
});
|
||||
|
||||
app.use(express.static(path.join(__dirname, 'build')));
|
||||
app.use('/status-page', express.static(path.join(__dirname, 'build')));
|
||||
app.use(
|
||||
|
||||
Reference in New Issue
Block a user