@git.zone/cli 2.22.0 → 2.24.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist_ts/00_commitinfo_data.js +1 -1
- package/dist_ts/mod_services/classes.dockercontainer.d.ts +92 -0
- package/dist_ts/mod_services/classes.dockercontainer.js +225 -6
- package/dist_ts/mod_services/classes.globalregistry.d.ts +10 -0
- package/dist_ts/mod_services/classes.globalregistry.js +23 -1
- package/dist_ts/mod_services/classes.serviceconfiguration.d.ts +39 -1
- package/dist_ts/mod_services/classes.serviceconfiguration.js +89 -22
- package/dist_ts/mod_services/classes.servicedatamarker.d.ts +93 -0
- package/dist_ts/mod_services/classes.servicedatamarker.js +166 -0
- package/dist_ts/mod_services/classes.servicemanager.d.ts +103 -3
- package/dist_ts/mod_services/classes.servicemanager.js +352 -100
- package/dist_ts/mod_services/classes.servicepruner.d.ts +102 -0
- package/dist_ts/mod_services/classes.servicepruner.js +410 -0
- package/dist_ts/mod_services/helpers.d.ts +15 -0
- package/dist_ts/mod_services/helpers.js +57 -1
- package/dist_ts/mod_services/index.js +307 -53
- package/package.json +4 -3
- package/readme.hints.md +88 -0
- package/readme.md +71 -5
- package/ts/00_commitinfo_data.ts +1 -1
- package/ts/mod_services/classes.dockercontainer.ts +269 -9
- package/ts/mod_services/classes.globalregistry.ts +27 -0
- package/ts/mod_services/classes.serviceconfiguration.ts +105 -24
- package/ts/mod_services/classes.servicedatamarker.ts +228 -0
- package/ts/mod_services/classes.servicemanager.ts +480 -117
- package/ts/mod_services/classes.servicepruner.ts +532 -0
- package/ts/mod_services/helpers.ts +60 -0
- package/ts/mod_services/index.ts +437 -58
|
@@ -1,3 +1,33 @@
|
|
|
1
|
+
import { ServiceConfiguration } from './classes.serviceconfiguration.js';
|
|
2
|
+
import { type TServiceName } from './classes.servicedatamarker.js';
|
|
3
|
+
import type { ContainerStatus } from './classes.dockercontainer.js';
|
|
4
|
+
export interface IServiceStatus {
|
|
5
|
+
service: TServiceName;
|
|
6
|
+
enabled: boolean;
|
|
7
|
+
container: string;
|
|
8
|
+
status: ContainerStatus;
|
|
9
|
+
port: string;
|
|
10
|
+
connectionString: string;
|
|
11
|
+
dataDirectory: string;
|
|
12
|
+
dataSizeBytes: number;
|
|
13
|
+
/** Only meaningful when the container does not exist yet. */
|
|
14
|
+
portAvailable: boolean | null;
|
|
15
|
+
/** MongoDB only: whether the instance enforces authentication. */
|
|
16
|
+
authEnabled?: boolean;
|
|
17
|
+
}
|
|
18
|
+
export interface IServicesStatus {
|
|
19
|
+
project: {
|
|
20
|
+
name: string;
|
|
21
|
+
path: string;
|
|
22
|
+
enabledServices: string[];
|
|
23
|
+
};
|
|
24
|
+
services: {
|
|
25
|
+
mongodb: IServiceStatus;
|
|
26
|
+
minio: IServiceStatus;
|
|
27
|
+
elasticsearch: IServiceStatus;
|
|
28
|
+
};
|
|
29
|
+
totalDataBytes: number;
|
|
30
|
+
}
|
|
1
31
|
export declare class ServiceManager {
|
|
2
32
|
private config;
|
|
3
33
|
private docker;
|
|
@@ -8,6 +38,10 @@ export declare class ServiceManager {
|
|
|
8
38
|
* Initialize the service manager
|
|
9
39
|
*/
|
|
10
40
|
init(): Promise<void>;
|
|
41
|
+
/**
|
|
42
|
+
* Expose the resolved service configuration to the command layer.
|
|
43
|
+
*/
|
|
44
|
+
getConfiguration(): ServiceConfiguration;
|
|
11
45
|
/**
|
|
12
46
|
* Load service configuration from .smartconfig.json
|
|
13
47
|
*/
|
|
@@ -21,21 +55,72 @@ export declare class ServiceManager {
|
|
|
21
55
|
*/
|
|
22
56
|
private isServiceEnabled;
|
|
23
57
|
/**
|
|
24
|
-
*
|
|
58
|
+
* Prepare a service's data directory: create it and record tool ownership.
|
|
59
|
+
*
|
|
60
|
+
* The marker written here is what later allows `gitzone services prune` to
|
|
61
|
+
* prove the directory is reclaimable instead of guessing from its path.
|
|
62
|
+
*/
|
|
63
|
+
private prepareDataDirectory;
|
|
64
|
+
/**
|
|
65
|
+
* Register this project with the global registry.
|
|
66
|
+
*
|
|
67
|
+
* Public and called from the command layer after any start path: previously
|
|
68
|
+
* only `startAll` registered, so `gitzone services start mongo` created a
|
|
69
|
+
* container the registry never knew about and prune could never account for.
|
|
25
70
|
*/
|
|
26
|
-
|
|
71
|
+
registerWithGlobalRegistry(): Promise<void>;
|
|
27
72
|
/**
|
|
28
73
|
* Start all enabled services
|
|
29
74
|
*/
|
|
30
75
|
startAll(): Promise<void>;
|
|
31
76
|
/**
|
|
32
|
-
* Stop
|
|
77
|
+
* Stop every service container belonging to this project.
|
|
78
|
+
*
|
|
79
|
+
* Deliberately not filtered by the enabled-service list: disabling a service
|
|
80
|
+
* previously left its container running with no command able to stop it,
|
|
81
|
+
* which is how projects accumulated forgotten containers. Stopping a service
|
|
82
|
+
* that is not running is a no-op, so covering all three is always safe.
|
|
33
83
|
*/
|
|
34
84
|
stopAll(): Promise<void>;
|
|
35
85
|
/**
|
|
36
86
|
* Start MongoDB service
|
|
87
|
+
*
|
|
88
|
+
* MongoDB runs as a single-node replica set so that multi-document
|
|
89
|
+
* transactions work. Auth + replSet requires a keyfile; mongod listens on
|
|
90
|
+
* MONGODB_PORT inside the container too, so the advertised member address
|
|
91
|
+
* (localhost:MONGODB_PORT) is reachable from host and container alike.
|
|
37
92
|
*/
|
|
38
93
|
startMongoDB(): Promise<void>;
|
|
94
|
+
/**
|
|
95
|
+
* Create the MongoDB container as a single-node replica set
|
|
96
|
+
*/
|
|
97
|
+
private createMongoContainer;
|
|
98
|
+
/**
|
|
99
|
+
* Generate the replica-set keyfile inside the data volume if missing.
|
|
100
|
+
* Created through a root one-off container so ownership (mongodb uid 999)
|
|
101
|
+
* is correct under both rootful and rootless Docker.
|
|
102
|
+
*/
|
|
103
|
+
private ensureMongoKeyfile;
|
|
104
|
+
/**
|
|
105
|
+
* The mongod argv the container was created with
|
|
106
|
+
*/
|
|
107
|
+
private getMongoContainerCmd;
|
|
108
|
+
/**
|
|
109
|
+
* Make sure the configured root user exists when auth is enabled.
|
|
110
|
+
*
|
|
111
|
+
* `MONGO_INITDB_ROOT_USERNAME` only takes effect on an empty dbpath, so data
|
|
112
|
+
* that was first created with auth disabled has no user at all. Enabling auth
|
|
113
|
+
* over it would leave an unusable database. MongoDB's localhost exception is
|
|
114
|
+
* the designed bootstrap path for exactly this: while zero users exist, a
|
|
115
|
+
* connection from localhost — which, inside the container, is what this is —
|
|
116
|
+
* may create the first one. If users already exist the exception does not
|
|
117
|
+
* apply and creation fails, so this can never overwrite or escalate anything.
|
|
118
|
+
*/
|
|
119
|
+
private ensureMongoRootUser;
|
|
120
|
+
/**
|
|
121
|
+
* Initiate the single-node replica set once mongod is reachable
|
|
122
|
+
*/
|
|
123
|
+
private ensureMongoReplicaSetInitiated;
|
|
39
124
|
/**
|
|
40
125
|
* Start MinIO service
|
|
41
126
|
*/
|
|
@@ -56,10 +141,25 @@ export declare class ServiceManager {
|
|
|
56
141
|
* Stop Elasticsearch service
|
|
57
142
|
*/
|
|
58
143
|
stopElasticsearch(): Promise<void>;
|
|
144
|
+
/**
|
|
145
|
+
* Collect service status as structured data.
|
|
146
|
+
*
|
|
147
|
+
* This is the machine-readable surface behind `gitzone services status
|
|
148
|
+
* --json`; consumers such as test suites can read a connection string from it
|
|
149
|
+
* without scraping human output or re-deriving it from `.nogit/env.json`.
|
|
150
|
+
*/
|
|
151
|
+
collectStatus(): Promise<IServicesStatus>;
|
|
59
152
|
/**
|
|
60
153
|
* Show service status
|
|
61
154
|
*/
|
|
62
155
|
showStatus(): Promise<void>;
|
|
156
|
+
/**
|
|
157
|
+
* Report on-disk size of this project's service data.
|
|
158
|
+
*
|
|
159
|
+
* Reporting comes before any deletion: knowing what a project holds is what
|
|
160
|
+
* makes reclaiming it a decision rather than a guess.
|
|
161
|
+
*/
|
|
162
|
+
showDiskUsage(): Promise<void>;
|
|
63
163
|
/**
|
|
64
164
|
* Show configuration
|
|
65
165
|
*/
|