diff --git a/agent/ambassador-agent.cabal b/agent/ambassador-agent.cabal index ac8fb781b..3f93074ee 100644 --- a/agent/ambassador-agent.cabal +++ b/agent/ambassador-agent.cabal @@ -5,7 +5,7 @@ cabal-version: 1.12 -- see: https://github.com/sol/hpack name: ambassador-agent -version: 0.2.14 +version: 0.2.16 build-type: Simple extra-source-files: ./migrations/0.1.0::0.1.0 @@ -20,6 +20,8 @@ extra-source-files: ./migrations/0.2.11::0.2.12 ./migrations/0.2.12::0.2.13 ./migrations/0.2.13::0.2.14 + ./migrations/0.2.14::0.2.15 + ./migrations/0.2.15::0.2.16 ./migrations/0.2.1::0.2.2 ./migrations/0.2.2::0.2.3 ./migrations/0.2.3::0.2.4 diff --git a/agent/config/settings.yml b/agent/config/settings.yml index 7b5baa203..87c812765 100644 --- a/agent/config/settings.yml +++ b/agent/config/settings.yml @@ -33,5 +33,5 @@ database: database: "start9_agent.sqlite3" poolsize: "_env:YESOD_SQLITE_POOLSIZE:10" -app-mgr-version-spec: "=0.2.15" +app-mgr-version-spec: "=0.2.16" #analytics: UA-YOURCODE diff --git a/agent/migrations/0.2.15::0.2.16 b/agent/migrations/0.2.15::0.2.16 new file mode 100644 index 000000000..b928005e2 --- /dev/null +++ b/agent/migrations/0.2.15::0.2.16 @@ -0,0 +1 @@ +SELECT TRUE; \ No newline at end of file diff --git a/agent/package.yaml b/agent/package.yaml index 62860149e..b20dc690b 100644 --- a/agent/package.yaml +++ b/agent/package.yaml @@ -1,5 +1,5 @@ name: ambassador-agent -version: 0.2.15 +version: 0.2.16 default-extensions: - NoImplicitPrelude diff --git a/agent/src/Lib/SelfUpdate.hs b/agent/src/Lib/SelfUpdate.hs index 36ee8d904..449e24ce7 100644 --- a/agent/src/Lib/SelfUpdate.hs +++ b/agent/src/Lib/SelfUpdate.hs @@ -5,7 +5,9 @@ {-# LANGUAGE TupleSections #-} module Lib.SelfUpdate where -import Startlude hiding ( runReader ) +import Startlude hiding ( handle + , runReader + ) import Control.Carrier.Error.Either import Control.Lens @@ -29,6 +31,7 @@ import Lib.SystemPaths import Lib.Types.Emver import Lib.WebServer import Settings +import UnliftIO.Exception ( handle ) youngAgentPort :: Word16 youngAgentPort = 5960 @@ -191,18 +194,21 @@ runSyncOps syncOps = do pure res synchronizeSystemState :: AgentCtx -> Version -> IO () -synchronizeSystemState ctx _version = handle @SomeException cleanup $ flip runReaderT ctx $ do +synchronizeSystemState ctx _version = handle @_ @SomeException cleanup $ flip runReaderT ctx $ do (restartsAndRuns, mTid) <- case synchronizer of Synchronizer { synchronizerOperations } -> flip runStateT Nothing $ for synchronizerOperations $ \syncOp -> do shouldRun <- lift $ syncOpShouldRun syncOp putStrLn @Text [i|Sync Op "#{syncOpName syncOp}" should run: #{shouldRun}|] when shouldRun $ do - whenM (isNothing <$> get) $ do - tid <- liftIO . forkIO . forever $ playSong 300 updateInProgress *> threadDelay 20_000_000 - put (Just tid) + tid <- get >>= \case + Nothing -> do + tid <- liftIO . forkIO . forever $ playSong 300 updateInProgress *> threadDelay 20_000_000 + put (Just tid) + pure tid + Just tid -> pure tid putStrLn @Text [i|Running Sync Op: #{syncOpName syncOp}|] setUpdate True - lift $ syncOpRun syncOp + lift $ handle @_ @SomeException (\e -> lift $ killThread tid *> cleanup e) $ syncOpRun syncOp pure $ (syncOpRequiresReboot syncOp, shouldRun) case mTid of Nothing -> pure () @@ -222,5 +228,6 @@ synchronizeSystemState ctx _version = handle @SomeException cleanup $ flip runRe void $ try @SomeException Sound.stop void $ try @SomeException Sound.unexport let e' = InternalE $ show e + setUpdate False flip runReaderT ctx $ cantFail $ failUpdate e' diff --git a/agent/src/Lib/Synchronizers.hs b/agent/src/Lib/Synchronizers.hs index 2fb8ddf51..a8b0143ea 100644 --- a/agent/src/Lib/Synchronizers.hs +++ b/agent/src/Lib/Synchronizers.hs @@ -102,12 +102,12 @@ parseKernelVersion = do pure $ KernelVersion (Version (major', minor', patch', 0)) arch synchronizer :: Synchronizer -synchronizer = sync_0_2_15 +synchronizer = sync_0_2_16 {-# INLINE synchronizer #-} -sync_0_2_15 :: Synchronizer -sync_0_2_15 = Synchronizer - "0.2.15" +sync_0_2_16 :: Synchronizer +sync_0_2_16 = Synchronizer + "0.2.16" [ syncCreateAgentTmp , syncCreateSshDir , syncRemoveAvahiSystemdDependency @@ -180,7 +180,7 @@ syncFullUpgrade = SyncOp "Full Upgrade" check migrate True Just (Done _ (KernelVersion (Version av) _)) -> if av < (4, 19, 118, 0) then pure True else pure False _ -> pure False migrate = liftIO . run $ do - shell "apt-get update" + shell "apt-get update --allow-releaseinfo-change" shell "apt-get full-upgrade -y" sync32BitKernel :: SyncOp @@ -205,7 +205,7 @@ syncInstallNginx = SyncOp "Install Nginx" check migrate False where check = liftIO . run $ fmap isNothing (shell [i|which nginx || true|] $| conduit await) migrate = liftIO . run $ do - shell "apt-get update" + shell "apt-get update --allow-releaseinfo-change" shell "apt-get install nginx -y" syncInstallEject :: SyncOp @@ -213,7 +213,7 @@ syncInstallEject = SyncOp "Install Eject" check migrate False where check = liftIO . run $ fmap isNothing (shell [i|which eject || true|] $| conduit await) migrate = liftIO . run $ do - shell "apt-get update" + shell "apt-get update --allow-releaseinfo-change" shell "apt-get install eject -y" syncInstallDuplicity :: SyncOp @@ -221,7 +221,7 @@ syncInstallDuplicity = SyncOp "Install duplicity" check migrate False where check = liftIO . run $ fmap isNothing (shell [i|which duplicity || true|] $| conduit await) migrate = liftIO . run $ do - shell "apt-get update" + shell "apt-get update --allow-releaseinfo-change" shell "apt-get install -y duplicity" syncInstallExfatFuse :: SyncOp @@ -234,7 +234,7 @@ syncInstallExfatFuse = SyncOp "Install exfat-fuse" check migrate False ProcessException _ (ExitFailure 1) -> pure True _ -> throwIO e migrate = liftIO . run $ do - shell "apt-get update" + shell "apt-get update --allow-releaseinfo-change" shell "apt-get install -y exfat-fuse" syncInstallExfatUtils :: SyncOp @@ -247,7 +247,7 @@ syncInstallExfatUtils = SyncOp "Install exfat-utils" check migrate False ProcessException _ (ExitFailure 1) -> pure True _ -> throwIO e migrate = liftIO . run $ do - shell "apt-get update" + shell "apt-get update --allow-releaseinfo-change" shell "apt-get install -y exfat-utils" syncInstallLibAvahi :: SyncOp @@ -260,7 +260,7 @@ syncInstallLibAvahi = SyncOp "Install libavahi-client" check migrate False ProcessException _ (ExitFailure 1) -> pure True _ -> throwIO e migrate = liftIO . run $ do - shell "apt-get update" + shell "apt-get update --allow-releaseinfo-change" shell "apt-get install -y libavahi-client3" syncWriteConf :: Text -> ByteString -> SystemPath -> SyncOp @@ -598,7 +598,7 @@ syncUpgradeTor = SyncOp "Install Latest Tor" check migrate False Just x -> x pure $ compareTorVersions torVersion "0.3.5.15-1" == LT migrate = liftIO . run $ do - shell "apt-get update" + shell "apt-get update --allow-releaseinfo-change" availVersions <- (shell "apt-cache madison tor" $| shell "cut -d '|' -f2" $| shell "xargs" $| conduit consume) latest <- case lastMay $ sortBy compareTorVersions availVersions of diff --git a/appmgr/Cargo.lock b/appmgr/Cargo.lock index cf4297ad8..3e8b39922 100644 --- a/appmgr/Cargo.lock +++ b/appmgr/Cargo.lock @@ -43,7 +43,7 @@ checksum = "afddf7f520a80dbf76e6f50a35bca42a2331ef227a28b3b6dc5c2e2338d114b1" [[package]] name = "appmgr" -version = "0.2.15" +version = "0.2.16" dependencies = [ "async-trait", "avahi-sys", diff --git a/appmgr/Cargo.toml b/appmgr/Cargo.toml index e21b416bf..e5c40374a 100644 --- a/appmgr/Cargo.toml +++ b/appmgr/Cargo.toml @@ -2,7 +2,7 @@ authors = ["Aiden McClelland "] edition = "2018" name = "appmgr" -version = "0.2.15" +version = "0.2.16" [lib] name = "appmgrlib" diff --git a/appmgr/src/version/mod.rs b/appmgr/src/version/mod.rs index 31e6190aa..df8b7e101 100644 --- a/appmgr/src/version/mod.rs +++ b/appmgr/src/version/mod.rs @@ -32,8 +32,9 @@ mod v0_2_12; mod v0_2_13; mod v0_2_14; mod v0_2_15; +mod v0_2_16; -pub use v0_2_15::Version as Current; +pub use v0_2_16::Version as Current; #[derive(serde::Serialize, serde::Deserialize)] #[serde(untagged)] @@ -61,6 +62,7 @@ enum Version { V0_2_13(Wrapper), V0_2_14(Wrapper), V0_2_15(Wrapper), + V0_2_16(Wrapper), Other(emver::Version), } @@ -178,6 +180,7 @@ pub async fn init() -> Result<(), failure::Error> { Version::V0_2_13(v) => v.0.migrate_to(&Current::new()).await?, Version::V0_2_14(v) => v.0.migrate_to(&Current::new()).await?, Version::V0_2_15(v) => v.0.migrate_to(&Current::new()).await?, + Version::V0_2_16(v) => v.0.migrate_to(&Current::new()).await?, Version::Other(_) => (), // TODO find some way to automate this? } @@ -274,6 +277,7 @@ pub async fn self_update(requirement: emver::VersionRange) -> Result<(), Error> Version::V0_2_13(v) => Current::new().migrate_to(&v.0).await?, Version::V0_2_14(v) => Current::new().migrate_to(&v.0).await?, Version::V0_2_15(v) => Current::new().migrate_to(&v.0).await?, + Version::V0_2_16(v) => Current::new().migrate_to(&v.0).await?, Version::Other(_) => (), // TODO find some way to automate this? }; diff --git a/appmgr/src/version/v0_2_16.rs b/appmgr/src/version/v0_2_16.rs new file mode 100644 index 000000000..747a384cd --- /dev/null +++ b/appmgr/src/version/v0_2_16.rs @@ -0,0 +1,21 @@ +use super::*; + +const V0_2_16: emver::Version = emver::Version::new(0, 2, 16, 0); + +pub struct Version; +#[async_trait] +impl VersionT for Version { + type Previous = v0_2_15::Version; + fn new() -> Self { + Version + } + fn semver(&self) -> &'static emver::Version { + &V0_2_16 + } + async fn up(&self) -> Result<(), Error> { + Ok(()) + } + async fn down(&self) -> Result<(), Error> { + Ok(()) + } +} diff --git a/ui/client-manifest.yaml b/ui/client-manifest.yaml index 899184c60..2bec76002 100644 --- a/ui/client-manifest.yaml +++ b/ui/client-manifest.yaml @@ -1,6 +1,6 @@ manifest-version: 0 app-id: start9-ambassador -app-version: 0.2.15 +app-version: 0.2.16 uri-rewrites: - =/api -> http://{{start9-ambassador}}:5959/authenticate - /api/ -> http://{{start9-ambassador}}:5959/ diff --git a/ui/package-lock.json b/ui/package-lock.json index 0c9278539..2a11c3390 100644 --- a/ui/package-lock.json +++ b/ui/package-lock.json @@ -1,6 +1,6 @@ { "name": "embassy-ui", - "version": "0.2.14", + "version": "0.2.16", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/ui/package.json b/ui/package.json index 14ecc6758..76dd0cd73 100644 --- a/ui/package.json +++ b/ui/package.json @@ -1,6 +1,6 @@ { "name": "embassy-ui", - "version": "0.2.15", + "version": "0.2.16", "description": "GUI for EmbassyOS", "author": "Start9 Labs", "homepage": "https://github.com/Start9Labs/embassy-ui", diff --git a/ui/src/app/modals/os-welcome/os-welcome.page.html b/ui/src/app/modals/os-welcome/os-welcome.page.html index 11c2ddea4..65d918bea 100644 --- a/ui/src/app/modals/os-welcome/os-welcome.page.html +++ b/ui/src/app/modals/os-welcome/os-welcome.page.html @@ -1,7 +1,7 @@ - Welcome to 0.2.15! + Welcome to 0.2.16! diff --git a/ui/src/app/services/api/mock-api.service.ts b/ui/src/app/services/api/mock-api.service.ts index 5213010e5..356c59fdf 100644 --- a/ui/src/app/services/api/mock-api.service.ts +++ b/ui/src/app/services/api/mock-api.service.ts @@ -499,8 +499,8 @@ const mockApiNotifications: ReqRes.GetNotificationsRes = [ const mockApiServer: () => ReqRes.GetServerRes = () => ({ serverId: 'start9-mockxyzab', name: 'Embassy:12345678', - versionInstalled: '0.2.15', - versionLatest: '0.2.15', + versionInstalled: '0.2.16', + versionLatest: '0.2.16', status: ServerStatus.RUNNING, alternativeRegistryUrl: 'beta-registry.start9labs.com', welcomeAck: true,