Merge branch 'next/minor' of github.com:Start9Labs/start-os into rebase/feat/domains

This commit is contained in:
Matt Hill
2024-03-30 21:14:53 -06:00
191 changed files with 1789 additions and 1316 deletions

View File

@@ -1,8 +1,6 @@
import {
InstalledState,
PackageDataEntry,
PackageMainStatus,
PackageState,
ServerStatusInfo,
} from 'src/app/services/patch-db/data-model'
import {
@@ -12,15 +10,12 @@ import {
ServerNotifications,
} from './api.types'
import { BTC_ICON, LND_ICON, PROXY_ICON } from './api-icons'
import {
DependencyMetadata,
Manifest,
MarketplacePkg,
} from '@start9labs/marketplace'
import { DependencyMetadata, MarketplacePkg } from '@start9labs/marketplace'
import { Log } from '@start9labs/shared'
import { configBuilderToSpec } from 'src/app/util/configBuilderToSpec'
import { CT } from '@start9labs/start-sdk'
import { CB } from '@start9labs/start-sdk'
import { Manifest } from '../../../../../../../core/startos/bindings/Manifest'
export module Mock {
export const ServerUpdated: ServerStatusInfo = {
@@ -83,16 +78,26 @@ export module Mock {
osVersion: '0.2.12',
dependencies: {},
hasConfig: true,
images: ['main'],
assets: [],
volumes: ['main'],
hardwareRequirements: {
device: {},
arch: null,
ram: null,
},
}
export const MockManifestLnd: Manifest = {
id: 'lnd',
title: 'Lightning Network Daemon',
version: '0.11.1',
gitHash: 'abcdefgh',
description: {
short: 'A bolt spec compliant client.',
long: 'More info about LND. More info about LND. More info about LND.',
},
replaces: ['banks', 'governments'],
releaseNotes: 'Dual funded channels!',
license: 'MIT',
wrapperRepo: 'https://github.com/start9labs/lnd-wrapper',
@@ -121,6 +126,14 @@ export module Mock {
},
},
hasConfig: true,
images: ['main'],
assets: [],
volumes: ['main'],
hardwareRequirements: {
device: {},
arch: null,
ram: null,
},
}
export const MockManifestBitcoinProxy: Manifest = {
@@ -153,7 +166,16 @@ export module Mock {
optional: false,
},
},
replaces: [],
hasConfig: false,
images: ['main'],
assets: [],
volumes: ['main'],
hardwareRequirements: {
device: {},
arch: null,
ram: null,
},
}
export const BitcoinDep: DependencyMetadata = {
@@ -1260,7 +1282,7 @@ export module Mock {
export const bitcoind: PackageDataEntry<InstalledState> = {
stateInfo: {
state: PackageState.Installed,
state: 'installed',
manifest: MockManifestBitcoind,
},
icon: '/assets/img/service-icons/bitcoind.svg',
@@ -1269,7 +1291,7 @@ export module Mock {
status: {
configured: true,
main: {
status: PackageMainStatus.Running,
status: 'running',
started: new Date().toISOString(),
health: {},
},
@@ -1293,9 +1315,10 @@ export module Mock {
scheme: 'http',
preferredExternalPort: 80,
addSsl: {
addXForwardedHeaders: false,
// addXForwardedHeaders: false,
preferredExternalPort: 443,
scheme: 'https',
alpn: { specified: ['http/1.1', 'h2'] },
},
secure: null,
},
@@ -1365,9 +1388,10 @@ export module Mock {
scheme: 'http',
preferredExternalPort: 80,
addSsl: {
addXForwardedHeaders: false,
// addXForwardedHeaders: false,
preferredExternalPort: 443,
scheme: 'https',
alpn: { specified: ['http/1.1'] },
},
secure: null,
},
@@ -1493,6 +1517,8 @@ export module Mock {
},
},
currentDependencies: {},
hosts: {},
storeExposedDependents: [],
marketplaceUrl: 'https://registry.start9.com/',
developerKey: 'developer-key',
outboundProxy: null,
@@ -1500,7 +1526,7 @@ export module Mock {
export const bitcoinProxy: PackageDataEntry<InstalledState> = {
stateInfo: {
state: PackageState.Installed,
state: 'installed',
manifest: MockManifestBitcoinProxy,
},
icon: '/assets/img/service-icons/btc-rpc-proxy.png',
@@ -1509,7 +1535,7 @@ export module Mock {
status: {
configured: false,
main: {
status: PackageMainStatus.Stopped,
status: 'stopped',
},
dependencyConfigErrors: {},
},
@@ -1530,9 +1556,10 @@ export module Mock {
scheme: 'http',
preferredExternalPort: 80,
addSsl: {
addXForwardedHeaders: false,
// addXForwardedHeaders: false,
preferredExternalPort: 443,
scheme: 'https',
alpn: { specified: ['http/1.1', 'h2'] },
},
secure: {
ssl: true,
@@ -1632,6 +1659,8 @@ export module Mock {
healthChecks: [],
},
},
hosts: {},
storeExposedDependents: [],
marketplaceUrl: 'https://registry.start9.com/',
developerKey: 'developer-key',
outboundProxy: null,
@@ -1639,7 +1668,7 @@ export module Mock {
export const lnd: PackageDataEntry<InstalledState> = {
stateInfo: {
state: PackageState.Installed,
state: 'installed',
manifest: MockManifestLnd,
},
icon: '/assets/img/service-icons/lnd.png',
@@ -1648,7 +1677,7 @@ export module Mock {
status: {
configured: true,
main: {
status: PackageMainStatus.Stopped,
status: 'stopped',
},
dependencyConfigErrors: {
'btc-rpc-proxy': 'Username not found',
@@ -1882,9 +1911,10 @@ export module Mock {
kind: 'exists',
registryUrl: 'https://community-registry.start9.com',
versionSpec: '>2.0.0', // @TODO
healthChecks: [],
},
},
hosts: {},
storeExposedDependents: [],
marketplaceUrl: 'https://registry.start9.com/',
developerKey: 'developer-key',
outboundProxy: null,

View File

@@ -1,10 +1,9 @@
import { Dump, Revision } from 'patch-db-client'
import { MarketplacePkg, StoreInfo, Manifest } from '@start9labs/marketplace'
import { MarketplacePkg, StoreInfo } from '@start9labs/marketplace'
import {
DataModel,
DomainInfo,
NetworkStrategy,
HealthCheckResult,
} from 'src/app/services/patch-db/data-model'
import {
StartOSDiskInfo,
@@ -15,6 +14,8 @@ import {
} from '@start9labs/shared'
import { CT } from '@start9labs/start-sdk'
import { config } from '@start9labs/start-sdk'
import { HealthCheckResult } from '../../../../../../../core/startos/bindings/HealthCheckResult'
import { Manifest } from '../../../../../../../core/startos/bindings/Manifest'
export module RR {
// DB
@@ -644,40 +645,29 @@ export type DependencyError =
| DependencyErrorHealthChecksFailed
| DependencyErrorTransitive
export enum DependencyErrorType {
NotInstalled = 'not-installed',
NotRunning = 'not-running',
IncorrectVersion = 'incorrect-version',
ConfigUnsatisfied = 'config-unsatisfied',
HealthChecksFailed = 'health-checks-failed',
InterfaceHealthChecksFailed = 'interface-health-checks-failed',
Transitive = 'transitive',
}
export interface DependencyErrorNotInstalled {
type: DependencyErrorType.NotInstalled
type: 'notInstalled'
}
export interface DependencyErrorNotRunning {
type: DependencyErrorType.NotRunning
type: 'notRunning'
}
export interface DependencyErrorIncorrectVersion {
type: DependencyErrorType.IncorrectVersion
type: 'incorrectVersion'
expected: string // version range
received: string // version
}
export interface DependencyErrorConfigUnsatisfied {
type: DependencyErrorType.ConfigUnsatisfied
error: string
type: 'configUnsatisfied'
}
export interface DependencyErrorHealthChecksFailed {
type: DependencyErrorType.HealthChecksFailed
type: 'healthChecksFailed'
check: HealthCheckResult
}
export interface DependencyErrorTransitive {
type: DependencyErrorType.Transitive
type: 'transitive'
}

View File

@@ -10,11 +10,8 @@ import {
} from 'patch-db-client'
import {
DataModel,
FullProgress,
InstallingState,
PackageDataEntry,
PackageMainStatus,
PackageState,
Proxy,
StateInfo,
UpdatingState,
@@ -39,6 +36,7 @@ import { WebSocketSubjectConfig } from 'rxjs/webSocket'
import { AuthService } from '../auth.service'
import { ConnectionService } from '../connection.service'
import { StoreInfo } from '@start9labs/marketplace'
import { FullProgress } from '../../../../../../../core/startos/bindings/FullProgress'
const PROGRESS: FullProgress = {
overall: {
@@ -864,7 +862,7 @@ export class MockApiService extends ApiService {
{
op: PatchOp.REPLACE,
path: appPath,
value: PackageMainStatus.BackingUp,
value: 'backingUp',
},
]
this.mockRevision(appPatch)
@@ -874,7 +872,7 @@ export class MockApiService extends ApiService {
this.mockRevision([
{
...appPatch[0],
value: PackageMainStatus.Stopped,
value: 'stopped',
},
])
this.mockRevision([
@@ -979,10 +977,10 @@ export class MockApiService extends ApiService {
...Mock.LocalPkgs[params.id],
stateInfo: {
// if installing
// state: PackageState.Installing,
// state: 'installing',
// if updating
state: PackageState.Updating,
state: 'updating',
manifest: mockPatchData.packageData[params.id].stateInfo.manifest!,
// both
@@ -1047,7 +1045,7 @@ export class MockApiService extends ApiService {
value: {
...Mock.LocalPkgs[id],
stateInfo: {
state: PackageState.Restoring,
state: 'restoring',
installingInfo: {
newManifest: Mock.LocalPkgs[id].stateInfo.manifest!,
progress: PROGRESS,
@@ -1090,7 +1088,7 @@ export class MockApiService extends ApiService {
{
op: PatchOp.REPLACE,
path: path + '/status',
value: PackageMainStatus.Running,
value: 'running',
},
{
op: PatchOp.REPLACE,
@@ -1105,7 +1103,7 @@ export class MockApiService extends ApiService {
{
op: PatchOp.REPLACE,
path: path + '/status',
value: PackageMainStatus.Starting,
value: 'starting',
},
]
@@ -1126,7 +1124,7 @@ export class MockApiService extends ApiService {
{
op: PatchOp.REPLACE,
path: path + '/status',
value: PackageMainStatus.Starting,
value: 'starting',
},
{
op: PatchOp.ADD,
@@ -1142,7 +1140,7 @@ export class MockApiService extends ApiService {
{
op: PatchOp.REPLACE,
path: path + '/status',
value: PackageMainStatus.Running,
value: 'running',
},
{
op: PatchOp.REMOVE,
@@ -1179,7 +1177,7 @@ export class MockApiService extends ApiService {
{
op: PatchOp.REPLACE,
path: path + '/status',
value: PackageMainStatus.Restarting,
value: 'restarting',
},
{
op: PatchOp.REPLACE,
@@ -1203,7 +1201,7 @@ export class MockApiService extends ApiService {
op: PatchOp.REPLACE,
path: path,
value: {
status: PackageMainStatus.Stopped,
status: 'stopped',
},
},
]
@@ -1215,7 +1213,7 @@ export class MockApiService extends ApiService {
op: PatchOp.REPLACE,
path: path,
value: {
status: PackageMainStatus.Stopping,
status: 'stopping',
timeout: '35s',
},
},
@@ -1245,7 +1243,7 @@ export class MockApiService extends ApiService {
{
op: PatchOp.REPLACE,
path: `/packageData/${params.id}/stateInfo/state`,
value: PackageState.Removing,
value: 'removing',
},
]
@@ -1397,7 +1395,7 @@ export class MockApiService extends ApiService {
op: PatchOp.REPLACE,
path: `/packageData/${id}/stateInfo`,
value: {
state: PackageState.Installed,
state: 'installed',
manifest: Mock.LocalPkgs[id].stateInfo.manifest,
},
},

View File

@@ -1,9 +1,4 @@
import {
DataModel,
HealthResult,
PackageMainStatus,
PackageState,
} from 'src/app/services/patch-db/data-model'
import { DataModel } from 'src/app/services/patch-db/data-model'
import { Mock } from './api.fixures'
export const mockPatchData: DataModel = {
@@ -12,7 +7,6 @@ export const mockPatchData: DataModel = {
ackWelcome: '1.0.0',
theme: 'Dark',
desktop: ['lnd'],
widgets: [],
marketplace: {
selectedUrl: 'https://registry.start9.com/',
knownHosts: {
@@ -138,11 +132,13 @@ export const mockPatchData: DataModel = {
passwordHash:
'$argon2d$v=19$m=1024,t=1,p=1$YXNkZmFzZGZhc2RmYXNkZg$Ceev1I901G6UwU+hY0sHrFZ56D+o+LNJ',
platform: 'x86_64-nonfree',
arch: 'x86_64',
governor: 'performance',
},
packageData: {
bitcoind: {
stateInfo: {
state: PackageState.Installed,
state: 'installed',
manifest: {
...Mock.MockManifestBitcoind,
version: '0.20.0',
@@ -154,31 +150,33 @@ export const mockPatchData: DataModel = {
status: {
configured: true,
main: {
status: PackageMainStatus.Running,
status: 'running',
started: '2021-06-14T20:49:17.774Z',
health: {
'ephemeral-health-check': {
name: 'Ephemeral Health Check',
result: HealthResult.Starting,
result: 'starting',
message: null,
},
'chain-state': {
name: 'Chain State',
result: HealthResult.Loading,
result: 'loading',
message: 'Bitcoin is syncing from genesis',
},
'p2p-interface': {
name: 'P2P',
result: HealthResult.Success,
result: 'success',
message: 'Health check successful',
},
'rpc-interface': {
name: 'RPC',
result: HealthResult.Failure,
result: 'failure',
message: 'RPC interface unreachable.',
},
'unnecessary-health-check': {
name: 'Unnecessary Health Check',
result: HealthResult.Disabled,
result: 'disabled',
message: null,
},
},
},
@@ -202,9 +200,10 @@ export const mockPatchData: DataModel = {
scheme: 'http',
preferredExternalPort: 80,
addSsl: {
addXForwardedHeaders: false,
// addXForwardedHeaders: false,
preferredExternalPort: 443,
scheme: 'https',
alpn: { specified: ['http/1.1', 'h2'] },
},
secure: null,
},
@@ -274,9 +273,10 @@ export const mockPatchData: DataModel = {
scheme: 'http',
preferredExternalPort: 80,
addSsl: {
addXForwardedHeaders: false,
// addXForwardedHeaders: false,
preferredExternalPort: 443,
scheme: 'https',
alpn: { specified: ['http/1.1'] },
},
secure: null,
},
@@ -402,13 +402,15 @@ export const mockPatchData: DataModel = {
},
},
currentDependencies: {},
hosts: {},
storeExposedDependents: [],
marketplaceUrl: 'https://registry.start9.com/',
developerKey: 'developer-key',
outboundProxy: null,
},
lnd: {
stateInfo: {
state: PackageState.Installed,
state: 'installed',
manifest: {
...Mock.MockManifestLnd,
version: '0.11.0',
@@ -420,7 +422,7 @@ export const mockPatchData: DataModel = {
status: {
configured: true,
main: {
status: PackageMainStatus.Stopped,
status: 'stopped',
},
dependencyConfigErrors: {
'btc-rpc-proxy': 'This is a config unsatisfied error',
@@ -655,6 +657,8 @@ export const mockPatchData: DataModel = {
healthChecks: [],
},
},
hosts: {},
storeExposedDependents: [],
marketplaceUrl: 'https://registry.start9.com/',
developerKey: 'developer-key',
outboundProxy: null,