From dde0bc820e47a372c9b1042249637c708a323188 Mon Sep 17 00:00:00 2001 From: Ilion Beyst Date: Sun, 12 Jun 2022 21:03:41 +0200 Subject: accept docker push --- planetwars-server/src/lib.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'planetwars-server/src/lib.rs') diff --git a/planetwars-server/src/lib.rs b/planetwars-server/src/lib.rs index 28d7a76..e50003c 100644 --- a/planetwars-server/src/lib.rs +++ b/planetwars-server/src/lib.rs @@ -16,6 +16,7 @@ use bb8_diesel::{self, DieselConnectionManager}; use config::ConfigError; use diesel::{Connection, PgConnection}; use modules::ranking::run_ranker; +use modules::registry::registry_service; use serde::Deserialize; use axum::{ @@ -104,11 +105,22 @@ pub fn get_config() -> Result { .try_deserialize() } +async fn run_registry(_db_pool: DbPool) { + // TODO: put in config + let addr = SocketAddr::from(([127, 0, 0, 1], 9001)); + + axum::Server::bind(&addr) + .serve(registry_service().into_make_service()) + .await + .unwrap(); +} + pub async fn run_app() { let configuration = get_config().unwrap(); let db_pool = prepare_db(&configuration.database_url).await; tokio::spawn(run_ranker(db_pool.clone())); + tokio::spawn(run_registry(db_pool.clone())); let api_service = Router::new() .nest("/api", api()) -- cgit v1.2.3 From 951cb293111db9ea0947cd65872da744bce92d31 Mon Sep 17 00:00:00 2001 From: Ilion Beyst Date: Mon, 20 Jun 2022 22:01:26 +0200 Subject: upgrade to axum 0.5 --- planetwars-server/src/lib.rs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'planetwars-server/src/lib.rs') diff --git a/planetwars-server/src/lib.rs b/planetwars-server/src/lib.rs index e50003c..9c9a03c 100644 --- a/planetwars-server/src/lib.rs +++ b/planetwars-server/src/lib.rs @@ -24,7 +24,7 @@ use axum::{ extract::{Extension, FromRequest, RequestParts}, http::StatusCode, routing::{get, post}, - AddExtensionLayer, Router, + Router, }; // TODO: make these configurable @@ -105,12 +105,16 @@ pub fn get_config() -> Result { .try_deserialize() } -async fn run_registry(_db_pool: DbPool) { +async fn run_registry(db_pool: DbPool) { // TODO: put in config let addr = SocketAddr::from(([127, 0, 0, 1], 9001)); axum::Server::bind(&addr) - .serve(registry_service().into_make_service()) + .serve( + registry_service() + .layer(Extension(db_pool)) + .into_make_service(), + ) .await .unwrap(); } @@ -124,7 +128,7 @@ pub async fn run_app() { let api_service = Router::new() .nest("/api", api()) - .layer(AddExtensionLayer::new(db_pool)) + .layer(Extension(db_pool)) .into_make_service(); // TODO: put in config -- cgit v1.2.3 From ea05674b4473d9399f5aa6dca982ae73aad0ebcf Mon Sep 17 00:00:00 2001 From: Ilion Beyst Date: Mon, 4 Jul 2022 22:33:35 +0200 Subject: remove obsolete create match route --- planetwars-server/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'planetwars-server/src/lib.rs') diff --git a/planetwars-server/src/lib.rs b/planetwars-server/src/lib.rs index 9c9a03c..8798945 100644 --- a/planetwars-server/src/lib.rs +++ b/planetwars-server/src/lib.rs @@ -85,7 +85,7 @@ pub fn api() -> Router { ) .route( "/matches", - get(routes::matches::list_matches).post(routes::matches::play_match), + get(routes::matches::list_matches), ) .route("/matches/:match_id", get(routes::matches::get_match_data)) .route( -- cgit v1.2.3 From b3df5c6f8cc59e099a2f1db3df8089af4abca02e Mon Sep 17 00:00:00 2001 From: Ilion Beyst Date: Tue, 5 Jul 2022 20:34:20 +0200 Subject: migrate code_bundles to bot_versions --- planetwars-server/src/lib.rs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'planetwars-server/src/lib.rs') diff --git a/planetwars-server/src/lib.rs b/planetwars-server/src/lib.rs index 8798945..7076604 100644 --- a/planetwars-server/src/lib.rs +++ b/planetwars-server/src/lib.rs @@ -83,10 +83,7 @@ pub fn api() -> Router { "/bots/:bot_id/upload", post(routes::bots::upload_code_multipart), ) - .route( - "/matches", - get(routes::matches::list_matches), - ) + .route("/matches", get(routes::matches::list_matches)) .route("/matches/:match_id", get(routes::matches::get_match_data)) .route( "/matches/:match_id/log", -- cgit v1.2.3 From 0f14dee499f48b11fc329164c30cd475400a9f4d Mon Sep 17 00:00:00 2001 From: Ilion Beyst Date: Thu, 7 Jul 2022 19:13:55 +0200 Subject: refactor: rename save_code_bundle to save_code_string --- planetwars-server/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'planetwars-server/src/lib.rs') diff --git a/planetwars-server/src/lib.rs b/planetwars-server/src/lib.rs index 7076604..fdaf800 100644 --- a/planetwars-server/src/lib.rs +++ b/planetwars-server/src/lib.rs @@ -51,7 +51,7 @@ pub async fn seed_simplebot(pool: &ConnectionPool) { let simplebot_code = std::fs::read_to_string(SIMPLEBOT_PATH).expect("could not read simplebot code"); - modules::bots::save_code_bundle(&simplebot_code, Some(simplebot.id), &conn)?; + modules::bots::save_code_string(&simplebot_code, Some(simplebot.id), &conn)?; println!("initialized simplebot"); -- cgit v1.2.3 From 00459f9e3d818f0fb84160862f02898d64f98110 Mon Sep 17 00:00:00 2001 From: Ilion Beyst Date: Thu, 14 Jul 2022 20:53:08 +0200 Subject: create a configuration to hold docker registry url --- planetwars-server/src/lib.rs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'planetwars-server/src/lib.rs') diff --git a/planetwars-server/src/lib.rs b/planetwars-server/src/lib.rs index fdaf800..eb69c82 100644 --- a/planetwars-server/src/lib.rs +++ b/planetwars-server/src/lib.rs @@ -10,13 +10,14 @@ pub mod util; use std::net::SocketAddr; use std::ops::Deref; +use std::sync::Arc; use bb8::{Pool, PooledConnection}; use bb8_diesel::{self, DieselConnectionManager}; use config::ConfigError; use diesel::{Connection, PgConnection}; -use modules::ranking::run_ranker; use modules::registry::registry_service; +use modules::{matches::MatchRunnerConfig, ranking::run_ranker}; use serde::Deserialize; use axum::{ @@ -120,12 +121,18 @@ pub async fn run_app() { let configuration = get_config().unwrap(); let db_pool = prepare_db(&configuration.database_url).await; - tokio::spawn(run_ranker(db_pool.clone())); + let runner_config = Arc::new(MatchRunnerConfig { + python_runner_image: "python:3.10-slim-buster".to_string(), + container_registry_url: "localhost:9001".to_string(), + }); + + tokio::spawn(run_ranker(runner_config.clone(), db_pool.clone())); tokio::spawn(run_registry(db_pool.clone())); let api_service = Router::new() .nest("/api", api()) .layer(Extension(db_pool)) + .layer(Extension(runner_config)) .into_make_service(); // TODO: put in config -- cgit v1.2.3 From ec5c91d37b46cb3cec4878176469c66d2304dadd Mon Sep 17 00:00:00 2001 From: Ilion Beyst Date: Thu, 14 Jul 2022 21:50:42 +0200 Subject: change runnerconfig to globalconfig --- planetwars-server/src/lib.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'planetwars-server/src/lib.rs') diff --git a/planetwars-server/src/lib.rs b/planetwars-server/src/lib.rs index eb69c82..d9f5e8e 100644 --- a/planetwars-server/src/lib.rs +++ b/planetwars-server/src/lib.rs @@ -16,8 +16,8 @@ use bb8::{Pool, PooledConnection}; use bb8_diesel::{self, DieselConnectionManager}; use config::ConfigError; use diesel::{Connection, PgConnection}; +use modules::ranking::run_ranker; use modules::registry::registry_service; -use modules::{matches::MatchRunnerConfig, ranking::run_ranker}; use serde::Deserialize; use axum::{ @@ -36,6 +36,11 @@ const SIMPLEBOT_PATH: &str = "../simplebot/simplebot.py"; type ConnectionPool = bb8::Pool>; +pub struct GlobalConfig { + pub python_runner_image: String, + pub container_registry_url: String, +} + pub async fn seed_simplebot(pool: &ConnectionPool) { let conn = pool.get().await.expect("could not get database connection"); // This transaction is expected to fail when simplebot already exists. @@ -121,7 +126,7 @@ pub async fn run_app() { let configuration = get_config().unwrap(); let db_pool = prepare_db(&configuration.database_url).await; - let runner_config = Arc::new(MatchRunnerConfig { + let runner_config = Arc::new(GlobalConfig { python_runner_image: "python:3.10-slim-buster".to_string(), container_registry_url: "localhost:9001".to_string(), }); -- cgit v1.2.3 From d13d131130ab53fb8ee7d49d2b40718622a4ab11 Mon Sep 17 00:00:00 2001 From: Ilion Beyst Date: Sat, 16 Jul 2022 21:22:03 +0200 Subject: move storage paths to GlobalConfig --- planetwars-server/src/lib.rs | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) (limited to 'planetwars-server/src/lib.rs') diff --git a/planetwars-server/src/lib.rs b/planetwars-server/src/lib.rs index d9f5e8e..7e14add 100644 --- a/planetwars-server/src/lib.rs +++ b/planetwars-server/src/lib.rs @@ -29,9 +29,6 @@ use axum::{ }; // TODO: make these configurable -const BOTS_DIR: &str = "./data/bots"; -const MATCHES_DIR: &str = "./data/matches"; -const MAPS_DIR: &str = "./data/maps"; const SIMPLEBOT_PATH: &str = "../simplebot/simplebot.py"; type ConnectionPool = bb8::Pool>; @@ -39,9 +36,13 @@ type ConnectionPool = bb8::Pool>; pub struct GlobalConfig { pub python_runner_image: String, pub container_registry_url: String, + + pub bots_directory: String, + pub match_logs_directory: String, + pub maps_directory: String, } -pub async fn seed_simplebot(pool: &ConnectionPool) { +pub async fn seed_simplebot(config: &GlobalConfig, pool: &ConnectionPool) { let conn = pool.get().await.expect("could not get database connection"); // This transaction is expected to fail when simplebot already exists. let _res = conn.transaction::<(), diesel::result::Error, _>(|| { @@ -57,7 +58,7 @@ pub async fn seed_simplebot(pool: &ConnectionPool) { let simplebot_code = std::fs::read_to_string(SIMPLEBOT_PATH).expect("could not read simplebot code"); - modules::bots::save_code_string(&simplebot_code, Some(simplebot.id), &conn)?; + modules::bots::save_code_string(&simplebot_code, Some(simplebot.id), &conn, config)?; println!("initialized simplebot"); @@ -67,10 +68,10 @@ pub async fn seed_simplebot(pool: &ConnectionPool) { pub type DbPool = Pool>; -pub async fn prepare_db(database_url: &str) -> DbPool { +pub async fn prepare_db(database_url: &str, config: &GlobalConfig) -> DbPool { let manager = DieselConnectionManager::::new(database_url); let pool = bb8::Pool::builder().build(manager).await.unwrap(); - seed_simplebot(&pool).await; + seed_simplebot(&config, &pool).await; pool } @@ -124,20 +125,25 @@ async fn run_registry(db_pool: DbPool) { pub async fn run_app() { let configuration = get_config().unwrap(); - let db_pool = prepare_db(&configuration.database_url).await; - let runner_config = Arc::new(GlobalConfig { + let global_config = Arc::new(GlobalConfig { python_runner_image: "python:3.10-slim-buster".to_string(), container_registry_url: "localhost:9001".to_string(), + + bots_directory: "./data/bots".to_string(), + match_logs_directory: "./data/matches".to_string(), + maps_directory: "./data/maps".to_string(), }); - tokio::spawn(run_ranker(runner_config.clone(), db_pool.clone())); + let db_pool = prepare_db(&configuration.database_url, &global_config).await; + + tokio::spawn(run_ranker(global_config.clone(), db_pool.clone())); tokio::spawn(run_registry(db_pool.clone())); let api_service = Router::new() .nest("/api", api()) .layer(Extension(db_pool)) - .layer(Extension(runner_config)) + .layer(Extension(global_config)) .into_make_service(); // TODO: put in config -- cgit v1.2.3 From 0cf7b5299d1085e32760ae9843625724a09c8c29 Mon Sep 17 00:00:00 2001 From: Ilion Beyst Date: Sat, 16 Jul 2022 21:47:22 +0200 Subject: integrate registry with GlobalConfig --- planetwars-server/src/lib.rs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'planetwars-server/src/lib.rs') diff --git a/planetwars-server/src/lib.rs b/planetwars-server/src/lib.rs index 7e14add..87495e9 100644 --- a/planetwars-server/src/lib.rs +++ b/planetwars-server/src/lib.rs @@ -40,6 +40,9 @@ pub struct GlobalConfig { pub bots_directory: String, pub match_logs_directory: String, pub maps_directory: String, + + pub registry_directory: String, + pub registry_admin_password: String, } pub async fn seed_simplebot(config: &GlobalConfig, pool: &ConnectionPool) { @@ -109,7 +112,7 @@ pub fn get_config() -> Result { .try_deserialize() } -async fn run_registry(db_pool: DbPool) { +async fn run_registry(config: Arc, db_pool: DbPool) { // TODO: put in config let addr = SocketAddr::from(([127, 0, 0, 1], 9001)); @@ -117,6 +120,7 @@ async fn run_registry(db_pool: DbPool) { .serve( registry_service() .layer(Extension(db_pool)) + .layer(Extension(config)) .into_make_service(), ) .await @@ -133,12 +137,15 @@ pub async fn run_app() { bots_directory: "./data/bots".to_string(), match_logs_directory: "./data/matches".to_string(), maps_directory: "./data/maps".to_string(), + + registry_directory: "./data/registry".to_string(), + registry_admin_password: "verysecretadminpassword".to_string(), }); let db_pool = prepare_db(&configuration.database_url, &global_config).await; tokio::spawn(run_ranker(global_config.clone(), db_pool.clone())); - tokio::spawn(run_registry(db_pool.clone())); + tokio::spawn(run_registry(global_config.clone(), db_pool.clone())); let api_service = Router::new() .nest("/api", api()) -- cgit v1.2.3 From dad19548d1e704c31800c5d6b132299ee5e88d45 Mon Sep 17 00:00:00 2001 From: Ilion Beyst Date: Sat, 16 Jul 2022 21:57:12 +0200 Subject: read GlobalConfig from configuration.toml --- planetwars-server/src/lib.rs | 39 ++++++++++++++++++++------------------- 1 file changed, 20 insertions(+), 19 deletions(-) (limited to 'planetwars-server/src/lib.rs') diff --git a/planetwars-server/src/lib.rs b/planetwars-server/src/lib.rs index 87495e9..ad7741c 100644 --- a/planetwars-server/src/lib.rs +++ b/planetwars-server/src/lib.rs @@ -18,7 +18,7 @@ use config::ConfigError; use diesel::{Connection, PgConnection}; use modules::ranking::run_ranker; use modules::registry::registry_service; -use serde::Deserialize; +use serde::{Deserialize, Serialize}; use axum::{ async_trait, @@ -33,15 +33,29 @@ const SIMPLEBOT_PATH: &str = "../simplebot/simplebot.py"; type ConnectionPool = bb8::Pool>; +#[derive(Serialize, Deserialize)] pub struct GlobalConfig { + /// url for the postgres database + pub database_url: String, + + /// which image to use for running python bots pub python_runner_image: String, + + /// url for the internal container registry + /// this will be used when running bots pub container_registry_url: String, + /// directory where bot code will be stored pub bots_directory: String, + /// directory where match logs will be stored pub match_logs_directory: String, + /// directory where map files will be stored pub maps_directory: String, + /// base directory for registry data pub registry_directory: String, + /// secret admin password for internal docker login + /// used to pull bots when running matches pub registry_admin_password: String, } @@ -71,8 +85,8 @@ pub async fn seed_simplebot(config: &GlobalConfig, pool: &ConnectionPool) { pub type DbPool = Pool>; -pub async fn prepare_db(database_url: &str, config: &GlobalConfig) -> DbPool { - let manager = DieselConnectionManager::::new(database_url); +pub async fn prepare_db(config: &GlobalConfig) -> DbPool { + let manager = DieselConnectionManager::::new(&config.database_url); let pool = bb8::Pool::builder().build(manager).await.unwrap(); seed_simplebot(&config, &pool).await; pool @@ -104,7 +118,7 @@ pub fn api() -> Router { .route("/save_bot", post(routes::bots::save_bot)) } -pub fn get_config() -> Result { +pub fn get_config() -> Result { config::Config::builder() .add_source(config::File::with_name("configuration.toml")) .add_source(config::Environment::with_prefix("PLANETWARS")) @@ -128,21 +142,8 @@ async fn run_registry(config: Arc, db_pool: DbPool) { } pub async fn run_app() { - let configuration = get_config().unwrap(); - - let global_config = Arc::new(GlobalConfig { - python_runner_image: "python:3.10-slim-buster".to_string(), - container_registry_url: "localhost:9001".to_string(), - - bots_directory: "./data/bots".to_string(), - match_logs_directory: "./data/matches".to_string(), - maps_directory: "./data/maps".to_string(), - - registry_directory: "./data/registry".to_string(), - registry_admin_password: "verysecretadminpassword".to_string(), - }); - - let db_pool = prepare_db(&configuration.database_url, &global_config).await; + let global_config = Arc::new(get_config().unwrap()); + let db_pool = prepare_db(&global_config).await; tokio::spawn(run_ranker(global_config.clone(), db_pool.clone())); tokio::spawn(run_registry(global_config.clone(), db_pool.clone())); -- cgit v1.2.3 From c16b068f8b3848e775f2490851fbc788139febe0 Mon Sep 17 00:00:00 2001 From: Ilion Beyst Date: Sun, 17 Jul 2022 15:10:17 +0200 Subject: cleanup: remove old configuration code --- planetwars-server/src/lib.rs | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) (limited to 'planetwars-server/src/lib.rs') diff --git a/planetwars-server/src/lib.rs b/planetwars-server/src/lib.rs index ad7741c..123fdab 100644 --- a/planetwars-server/src/lib.rs +++ b/planetwars-server/src/lib.rs @@ -28,11 +28,9 @@ use axum::{ Router, }; -// TODO: make these configurable -const SIMPLEBOT_PATH: &str = "../simplebot/simplebot.py"; - type ConnectionPool = bb8::Pool>; +// this should probably be modularized a bit as the config grows #[derive(Serialize, Deserialize)] pub struct GlobalConfig { /// url for the postgres database @@ -59,6 +57,9 @@ pub struct GlobalConfig { pub registry_admin_password: String, } +// TODO: do we still need this? Is there a better way? +const SIMPLEBOT_PATH: &str = "../simplebot/simplebot.py"; + pub async fn seed_simplebot(config: &GlobalConfig, pool: &ConnectionPool) { let conn = pool.get().await.expect("could not get database connection"); // This transaction is expected to fail when simplebot already exists. @@ -88,7 +89,7 @@ pub type DbPool = Pool>; pub async fn prepare_db(config: &GlobalConfig) -> DbPool { let manager = DieselConnectionManager::::new(&config.database_url); let pool = bb8::Pool::builder().build(manager).await.unwrap(); - seed_simplebot(&config, &pool).await; + seed_simplebot(config, &pool).await; pool } @@ -160,11 +161,6 @@ pub async fn run_app() { axum::Server::bind(&addr).serve(api_service).await.unwrap(); } -#[derive(Deserialize)] -pub struct Configuration { - pub database_url: String, -} - // we can also write a custom extractor that grabs a connection from the pool // which setup is appropriate depends on your application pub struct DatabaseConnection(PooledConnection<'static, DieselConnectionManager>); -- cgit v1.2.3 From 09c543eee3dbc361627e4ad6b5f5f55317ff334b Mon Sep 17 00:00:00 2001 From: Ilion Beyst Date: Sun, 17 Jul 2022 17:07:53 +0200 Subject: create all required directories on startup --- planetwars-server/src/lib.rs | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'planetwars-server/src/lib.rs') diff --git a/planetwars-server/src/lib.rs b/planetwars-server/src/lib.rs index 123fdab..8962c3e 100644 --- a/planetwars-server/src/lib.rs +++ b/planetwars-server/src/lib.rs @@ -8,7 +8,8 @@ pub mod routes; pub mod schema; pub mod util; -use std::net::SocketAddr; +use std::path::PathBuf; +use std::{net::SocketAddr, fs}; use std::ops::Deref; use std::sync::Arc; @@ -93,6 +94,19 @@ pub async fn prepare_db(config: &GlobalConfig) -> DbPool { pool } +// create all directories required for further operation +fn init_directories(config: &GlobalConfig) -> std::io::Result<()> { + fs::create_dir_all(&config.bots_directory)?; + fs::create_dir_all(&config.maps_directory)?; + fs::create_dir_all(&config.match_logs_directory)?; + + let registry_path = PathBuf::from(&config.registry_directory); + fs::create_dir_all(registry_path.join("sha256"))?; + fs::create_dir_all(registry_path.join("manifests"))?; + fs::create_dir_all(registry_path.join("uploads"))?; + Ok(()) +} + pub fn api() -> Router { Router::new() .route("/register", post(routes::users::register)) @@ -145,6 +159,7 @@ async fn run_registry(config: Arc, db_pool: DbPool) { pub async fn run_app() { let global_config = Arc::new(get_config().unwrap()); let db_pool = prepare_db(&global_config).await; + init_directories(&global_config).unwrap(); tokio::spawn(run_ranker(global_config.clone(), db_pool.clone())); tokio::spawn(run_registry(global_config.clone(), db_pool.clone())); -- cgit v1.2.3 From e5cb04208f2287f5ba4f0f70367c0f8190e0082e Mon Sep 17 00:00:00 2001 From: Ilion Beyst Date: Sun, 17 Jul 2022 18:23:24 +0200 Subject: allow disabling ranker in develpoment --- planetwars-server/src/lib.rs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'planetwars-server/src/lib.rs') diff --git a/planetwars-server/src/lib.rs b/planetwars-server/src/lib.rs index 8962c3e..7bc50f3 100644 --- a/planetwars-server/src/lib.rs +++ b/planetwars-server/src/lib.rs @@ -8,10 +8,10 @@ pub mod routes; pub mod schema; pub mod util; -use std::path::PathBuf; -use std::{net::SocketAddr, fs}; use std::ops::Deref; +use std::path::PathBuf; use std::sync::Arc; +use std::{fs, net::SocketAddr}; use bb8::{Pool, PooledConnection}; use bb8_diesel::{self, DieselConnectionManager}; @@ -56,6 +56,9 @@ pub struct GlobalConfig { /// secret admin password for internal docker login /// used to pull bots when running matches pub registry_admin_password: String, + + /// Whether to run the ranker + pub ranker_enabled: bool, } // TODO: do we still need this? Is there a better way? @@ -161,7 +164,9 @@ pub async fn run_app() { let db_pool = prepare_db(&global_config).await; init_directories(&global_config).unwrap(); - tokio::spawn(run_ranker(global_config.clone(), db_pool.clone())); + if global_config.ranker_enabled { + tokio::spawn(run_ranker(global_config.clone(), db_pool.clone())); + } tokio::spawn(run_registry(global_config.clone(), db_pool.clone())); let api_service = Router::new() -- cgit v1.2.3