mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-04-02 05:23:14 +00:00
Feature/remove postgres (#2570)
* wip: move postgres data to patchdb * wip * wip * wip * complete notifications and clean up warnings * fill in user agent * move os tor bindings to single call
This commit is contained in:
@@ -1,6 +1,4 @@
|
||||
use std::collections::BTreeMap;
|
||||
|
||||
use models::{ActionId, PackageId, ProcedureName};
|
||||
use models::ProcedureName;
|
||||
|
||||
use crate::config::ConfigureContext;
|
||||
use crate::prelude::*;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
use std::sync::Arc;
|
||||
use std::time::Duration;
|
||||
use std::{ops::Deref, sync::Arc};
|
||||
|
||||
use chrono::{DateTime, Utc};
|
||||
use clap::Parser;
|
||||
@@ -10,25 +10,25 @@ use persistent_container::PersistentContainer;
|
||||
use rpc_toolkit::{from_fn_async, CallRemoteHandler, Empty, Handler, HandlerArgs};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use start_stop::StartStop;
|
||||
use tokio::sync::{watch, Notify};
|
||||
use tokio::sync::Notify;
|
||||
|
||||
use crate::action::ActionResult;
|
||||
use crate::config::action::ConfigRes;
|
||||
use crate::context::{CliContext, RpcContext};
|
||||
use crate::core::rpc_continuations::RequestGuid;
|
||||
use crate::db::model::{
|
||||
CurrentDependencies, CurrentDependents, InstalledPackageInfo, PackageDataEntry,
|
||||
PackageDataEntryInstalled, PackageDataEntryMatchModel, StaticFiles,
|
||||
InstalledPackageInfo, PackageDataEntry, PackageDataEntryInstalled, PackageDataEntryMatchModel,
|
||||
StaticFiles,
|
||||
};
|
||||
use crate::disk::mount::guard::GenericMountGuard;
|
||||
use crate::install::PKG_ARCHIVE_DIR;
|
||||
use crate::prelude::*;
|
||||
use crate::progress::{self, NamedProgress, Progress};
|
||||
use crate::progress::{NamedProgress, Progress};
|
||||
use crate::s9pk::S9pk;
|
||||
use crate::service::service_map::InstallProgressHandles;
|
||||
use crate::service::transition::{TempDesiredState, TransitionKind, TransitionState};
|
||||
use crate::service::transition::TransitionKind;
|
||||
use crate::status::health_check::HealthCheckResult;
|
||||
use crate::status::{DependencyConfigErrors, MainStatus, Status};
|
||||
use crate::status::{MainStatus, Status};
|
||||
use crate::util::actor::{Actor, BackgroundJobs, SimpleActor};
|
||||
use crate::volume::data_dir;
|
||||
|
||||
@@ -289,6 +289,7 @@ impl Service {
|
||||
marketplace_url: None, // TODO
|
||||
manifest: manifest.clone(),
|
||||
last_backup: None, // TODO
|
||||
hosts: Default::default(), // TODO
|
||||
store: Value::Null, // TODO
|
||||
store_exposed_dependents: Default::default(), // TODO
|
||||
store_exposed_ui: Default::default(), // TODO
|
||||
|
||||
@@ -15,19 +15,18 @@ use tokio::process::Command;
|
||||
use tokio::sync::{oneshot, watch, Mutex, OnceCell};
|
||||
use tracing::instrument;
|
||||
|
||||
use super::{
|
||||
service_effect_handler::{service_effect_handler, EffectContext},
|
||||
transition::{TempDesiredState, TransitionKind},
|
||||
};
|
||||
use super::{transition::TransitionState, ServiceActorSeed};
|
||||
use super::service_effect_handler::{service_effect_handler, EffectContext};
|
||||
use super::transition::{TransitionKind, TransitionState};
|
||||
use super::ServiceActorSeed;
|
||||
use crate::context::RpcContext;
|
||||
use crate::disk::mount::filesystem::bind::Bind;
|
||||
use crate::disk::mount::filesystem::idmapped::IdMapped;
|
||||
use crate::disk::mount::filesystem::loop_dev::LoopDev;
|
||||
use crate::disk::mount::filesystem::overlayfs::OverlayGuard;
|
||||
use crate::disk::mount::filesystem::{MountType, ReadOnly};
|
||||
use crate::disk::mount::guard::{GenericMountGuard, MountGuard};
|
||||
use crate::disk::mount::guard::MountGuard;
|
||||
use crate::lxc::{LxcConfig, LxcContainer, HOST_RPC_SERVER_SOCKET};
|
||||
use crate::net::net_controller::NetService;
|
||||
use crate::prelude::*;
|
||||
use crate::s9pk::merkle_archive::source::FileSource;
|
||||
use crate::s9pk::S9pk;
|
||||
@@ -94,6 +93,7 @@ pub struct PersistentContainer {
|
||||
assets: BTreeMap<VolumeId, MountGuard>,
|
||||
pub(super) overlays: Arc<Mutex<BTreeMap<InternedString, OverlayGuard>>>,
|
||||
pub(super) state: Arc<watch::Sender<ServiceState>>,
|
||||
pub(super) net_service: Mutex<NetService>,
|
||||
}
|
||||
|
||||
impl PersistentContainer {
|
||||
@@ -178,6 +178,10 @@ impl PersistentContainer {
|
||||
.await?;
|
||||
}
|
||||
}
|
||||
let net_service = ctx
|
||||
.net_controller
|
||||
.create_service(s9pk.as_manifest().id.clone(), lxc_container.ip())
|
||||
.await?;
|
||||
Ok(Self {
|
||||
s9pk,
|
||||
lxc_container: OnceCell::new_with(Some(lxc_container)),
|
||||
@@ -189,6 +193,7 @@ impl PersistentContainer {
|
||||
assets,
|
||||
overlays: Arc::new(Mutex::new(BTreeMap::new())),
|
||||
state: Arc::new(watch::channel(ServiceState::new(start)).0),
|
||||
net_service: Mutex::new(net_service),
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ use std::time::Duration;
|
||||
|
||||
use imbl_value::Value;
|
||||
use models::ProcedureName;
|
||||
use rpc_toolkit::yajrc::{RpcError, RpcMethod};
|
||||
use rpc_toolkit::yajrc::RpcMethod;
|
||||
use rpc_toolkit::Empty;
|
||||
|
||||
use crate::prelude::*;
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
use std::ffi::OsString;
|
||||
use std::os::unix::process::CommandExt;
|
||||
use std::path::{Path, PathBuf};
|
||||
use std::str::FromStr;
|
||||
use std::sync::{Arc, Weak};
|
||||
use std::{ffi::OsString, time::Instant};
|
||||
|
||||
use chrono::Utc;
|
||||
use clap::builder::{TypedValueParser, ValueParserFactory};
|
||||
use clap::builder::ValueParserFactory;
|
||||
use clap::Parser;
|
||||
use imbl_value::{json, InternedString};
|
||||
use models::{ActionId, HealthCheckId, ImageId, PackageId};
|
||||
@@ -13,19 +12,18 @@ use patch_db::json_ptr::JsonPointer;
|
||||
use rpc_toolkit::{from_fn, from_fn_async, AnyContext, Context, Empty, HandlerExt, ParentHandler};
|
||||
use tokio::process::Command;
|
||||
|
||||
use crate::db::model::ExposedUI;
|
||||
use crate::disk::mount::filesystem::idmapped::IdMapped;
|
||||
use crate::disk::mount::filesystem::loop_dev::LoopDev;
|
||||
use crate::disk::mount::filesystem::overlayfs::OverlayGuard;
|
||||
use crate::prelude::*;
|
||||
use crate::s9pk::rpc::SKIP_ENV;
|
||||
use crate::service::cli::ContainerCliContext;
|
||||
use crate::service::start_stop::StartStop;
|
||||
use crate::service::ServiceActorSeed;
|
||||
use crate::status::health_check::HealthCheckResult;
|
||||
use crate::status::health_check::{HealthCheckResult, HealthCheckString};
|
||||
use crate::status::MainStatus;
|
||||
use crate::util::clap::FromStrParser;
|
||||
use crate::util::{new_guid, Invoke};
|
||||
use crate::{db::model::ExposedUI, service::RunningStatus};
|
||||
use crate::{disk::mount::filesystem::idmapped::IdMapped, status::health_check::HealthCheckString};
|
||||
use crate::{echo, ARCH};
|
||||
|
||||
#[derive(Clone)]
|
||||
|
||||
@@ -12,12 +12,12 @@ use tracing::instrument;
|
||||
|
||||
use crate::context::RpcContext;
|
||||
use crate::db::model::{
|
||||
InstalledPackageInfo, PackageDataEntry, PackageDataEntryInstalled, PackageDataEntryInstalling,
|
||||
PackageDataEntry, PackageDataEntryInstalled, PackageDataEntryInstalling,
|
||||
PackageDataEntryRestoring, PackageDataEntryUpdating, StaticFiles,
|
||||
};
|
||||
use crate::disk::mount::guard::GenericMountGuard;
|
||||
use crate::install::PKG_ARCHIVE_DIR;
|
||||
use crate::notifications::NotificationLevel;
|
||||
use crate::notifications::{notify, NotificationLevel};
|
||||
use crate::prelude::*;
|
||||
use crate::progress::{
|
||||
FullProgressTracker, FullProgressTrackerHandle, PhaseProgressTrackerHandle,
|
||||
@@ -370,17 +370,19 @@ impl ServiceReloadInfo {
|
||||
.load(&self.ctx, &self.id, LoadDisposition::Undo)
|
||||
.await?;
|
||||
if let Some(error) = error {
|
||||
let error_string = error.to_string();
|
||||
self.ctx
|
||||
.notification_manager
|
||||
.notify(
|
||||
self.ctx.db.clone(),
|
||||
Some(self.id.clone()),
|
||||
NotificationLevel::Error,
|
||||
format!("{} Failed", self.operation),
|
||||
error.to_string(),
|
||||
(),
|
||||
None,
|
||||
)
|
||||
.db
|
||||
.mutate(|db| {
|
||||
notify(
|
||||
db,
|
||||
Some(self.id.clone()),
|
||||
NotificationLevel::Error,
|
||||
format!("{} Failed", self.operation),
|
||||
error_string,
|
||||
(),
|
||||
)
|
||||
})
|
||||
.await?;
|
||||
}
|
||||
Ok(())
|
||||
|
||||
@@ -1,15 +1,13 @@
|
||||
use std::sync::Arc;
|
||||
use std::{fmt::Display, ops::Deref};
|
||||
|
||||
use futures::{Future, FutureExt};
|
||||
use tokio::sync::watch;
|
||||
|
||||
use super::persistent_container::ServiceState;
|
||||
use crate::service::start_stop::StartStop;
|
||||
use crate::util::actor::BackgroundJobs;
|
||||
use crate::util::future::{CancellationHandle, RemoteCancellable};
|
||||
|
||||
use super::persistent_container::ServiceState;
|
||||
|
||||
pub mod backup;
|
||||
pub mod restart;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user