#include "Web.h" #include "lib/api/public/ServiceContext.h" #include "lib/config/config.h" #include "lib/config/protos/Ports.pb.h" #include "lib/config/protos/quickbus_cfg.pb.h" #include "lib/quickbus/quickbus.h" #include "lib/md/MDClient.h" #include "lib/md/SyntheticSecurityService.h" #include "lib/md/relay/QueryServer.h" #include "lib/metrics/metrics.h" #include "lib/metrics/system_metrics.h" #include "lib/tracing/PerfLog.h" #include "server/sparkd/http/WebServer.h" #include "server/sparkd/md/run_md.h" #include "server/sparkd/user/AdminServiceServer.h" #include "server/sparkd/user/AuthServiceServer.h" #include #include namespace bts::cmds { struct Web::Args { bool md; }; Web::Web() : CLI::App( "Run only the services required for the web admin. This cannot be " "run concurrently with 'sparkd run.'", "web"), _args(new Web::Args()) { add_flag("--md", _args->md, "Start market data"); callback([&] { config::QuickbusNodeCfg qb_cfg; auto &ports = config::get(); qb_cfg.set_my_port(ports.qbus_port()); qbus::Quickbus quickbus(qb_cfg); api::ServiceContext sc(&quickbus); metrics::MetricsContainer stats; metrics::publish_system_metrics(stats); trace::PerfLog perf_log; http::SparkWebServer webserver(sc, stats, perf_log, ports.config_port()); user::AuthServiceServer login_server(sc); if (_args->md) { md::run_market_datapublishers(nullptr, nullptr); } api::synthetic::SyntheticSecurityService synthetic_service(sc); md::MDClient mdclient(&utils::Dispatcher::current(), &synthetic_service); md::QueryServerPtr md_query_server( md::run_query_server(sc, mdclient, stats)); admin::AdminServiceServer admin_service(sc); utils::Dispatcher::current().run(); }); } Web::~Web() {} } // namespace bts::cmds