1#![recursion_limit = "256"]
2
3#[cfg(any(test, feature = "test-utils"))]
7extern crate self as server;
8
9pub mod auth_keys;
10pub mod bootstrap;
11pub mod config;
12
13pub mod db;
14
15pub mod account;
17pub mod account_state;
18pub mod artifact_mgmt;
19pub(crate) mod attempt;
20pub mod command;
21pub mod commodity;
22pub mod commodity_state;
23pub mod error;
24#[cfg(any(test, feature = "test-utils"))]
25pub mod exhausted_pool;
26pub mod fleet;
27pub(crate) mod hierarchy;
28#[cfg(any(test, feature = "test-utils"))]
29pub mod log_capture;
30pub mod logical;
31#[cfg(any(test, feature = "test-utils"))]
32pub mod lossless;
33pub mod preflight;
34pub mod provision;
35pub mod script;
36pub mod script_run;
37pub mod script_state;
38pub mod script_tags;
39pub mod snapshot;
40pub mod split;
41pub mod ssh_keys;
42pub mod tag;
43pub mod tag_state;
44pub mod telemetry;
45pub mod template_state;
46#[cfg(test)]
47mod test_support;
48pub mod timezone;
49pub mod user;
50use sqlx::any::install_default_drivers;
51use tokio::{runtime::Handle, task::JoinHandle};
52
53#[macro_use]
54extern crate rust_i18n;
55
56i18n!("locales", fallback = "en");
57
58pub async fn boot() -> anyhow::Result<()> {
64 install_default_drivers();
65 db::migrate_db().await?;
66 bootstrap::seed().await?;
67 config::load_config().await?;
68
69 tracing::info!("{}", t!("The server boot complete"));
70 Ok(())
71}
72
73pub async fn start() -> JoinHandle<anyhow::Result<()>> {
74 let handle = Handle::current();
75
76 handle.spawn(boot())
77}