Servicerunner, the base library for most of WMF's nodejs based services is unmaintained. Service runner, and its unmaintained dependencies are causing many issues:
- Security issues
- Performance issues - for example, the preq based http requests are no longer required as node natively has these features
- Coding standards - For example, Promises are native to node these days.
Since cxserver is deployment is based on kubernetes and not baremetal deployments as used to happen many years back, a standard nodejs based service is sufficient.
Plan
- Replace preq library with native http requests T350773: Remove preq and use node fetch
- Simplify the routers. The current approach is reading all files in the routes directory, and loading the routes. Instead, use express's recommended way of handling routes - import the routes definitions and register using app.use('/', rootRoutes) ;app.use('/v1', v1Routes); etc
- Replace the complex testing orchestration with standard express framework testing.
- Use an ECS logger https://github.com/elastic/ecs-logging-nodejs. Remove custom error logging and request logging with ECS express middleware.
- Remove various methods of stats reporting(statsd and Prometheus) and use one and only one way of reporting stats using a Prometheus client
- Simplify the configuration - Current configuration assumes there are multiple services in the repo(service runner was designed for this kind of setup).
- And finally, replace servicerunner with node cluster