aboutsummaryrefslogtreecommitdiff
path: root/src/garage/server.rs
diff options
context:
space:
mode:
authormricher <maximilien.richer@gmail.com>2021-09-28 08:57:20 +0200
committerAlex Auvolat <alex@adnab.me>2022-03-14 10:51:12 +0100
commite349af13a7268d567c1bacc819af5b89c2d4231f (patch)
treeb50fc78efac150bbf3c005c33d39a874c5e37b41 /src/garage/server.rs
parent9d44127245990cc55dbdff5a4bd0a1524348f110 (diff)
downloadgarage-e349af13a7268d567c1bacc819af5b89c2d4231f.tar.gz
garage-e349af13a7268d567c1bacc819af5b89c2d4231f.zip
Update dependencies and add admin module with metrics
- Global dependencies updated in Cargo.lock - New module created in src/admin to host: - the (future) admin REST API - the metric collection - add configuration block No metrics implemented yet
Diffstat (limited to 'src/garage/server.rs')
-rw-r--r--src/garage/server.rs13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/garage/server.rs b/src/garage/server.rs
index f4d62e91..923df1cd 100644
--- a/src/garage/server.rs
+++ b/src/garage/server.rs
@@ -6,6 +6,7 @@ use garage_util::background::*;
use garage_util::config::*;
use garage_util::error::Error;
+use garage_admin::metrics::*;
use garage_api::run_api_server;
use garage_model::garage::Garage;
use garage_web::run_web_server;
@@ -34,6 +35,9 @@ pub async fn run_server(config_file: PathBuf) -> Result<(), Error> {
.open()
.expect("Unable to open sled DB");
+ info!("Configure and run admin web server...");
+ let admin_server_init = AdminServer::init();
+
info!("Initializing background runner...");
let watch_cancel = netapp::util::watch_ctrl_c();
let (background, await_background_done) = BackgroundRunner::new(16, watch_cancel.clone());
@@ -43,7 +47,7 @@ pub async fn run_server(config_file: PathBuf) -> Result<(), Error> {
let run_system = tokio::spawn(garage.system.clone().run(watch_cancel.clone()));
- info!("Crate admin RPC handler...");
+ info!("Create admin RPC handler...");
AdminRpcHandler::new(garage.clone());
info!("Initializing API server...");
@@ -58,6 +62,10 @@ pub async fn run_server(config_file: PathBuf) -> Result<(), Error> {
wait_from(watch_cancel.clone()),
));
+ info!("Configure and run admin web server...");
+ let admin_server =
+ tokio::spawn(admin_server_init.run(garage.clone(), wait_from(watch_cancel.clone())));
+
// Stuff runs
// When a cancel signal is sent, stuff stops
@@ -67,6 +75,9 @@ pub async fn run_server(config_file: PathBuf) -> Result<(), Error> {
if let Err(e) = web_server.await? {
warn!("Web server exited with error: {}", e);
}
+ if let Err(e) = admin_server.await? {
+ warn!("Admin web server exited with error: {}", e);
+ }
// Remove RPC handlers for system to break reference cycles
garage.system.netapp.drop_all_handlers();