@zincapp/znvault-plugin-payara 1.0.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/README.md +316 -0
- package/dist/cli.d.ts +40 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +234 -0
- package/dist/cli.js.map +1 -0
- package/dist/index.d.ts +83 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +139 -0
- package/dist/index.js.map +1 -0
- package/dist/payara-manager.d.ts +72 -0
- package/dist/payara-manager.d.ts.map +1 -0
- package/dist/payara-manager.js +239 -0
- package/dist/payara-manager.js.map +1 -0
- package/dist/routes.d.ts +11 -0
- package/dist/routes.d.ts.map +1 -0
- package/dist/routes.js +247 -0
- package/dist/routes.js.map +1 -0
- package/dist/types.d.ts +94 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +3 -0
- package/dist/types.js.map +1 -0
- package/dist/war-deployer.d.ts +77 -0
- package/dist/war-deployer.d.ts.map +1 -0
- package/dist/war-deployer.js +312 -0
- package/dist/war-deployer.js.map +1 -0
- package/package.json +88 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import type { FastifyInstance } from 'fastify';
|
|
2
|
+
import type { Logger } from 'pino';
|
|
3
|
+
import type { PayaraPluginConfig } from './types.js';
|
|
4
|
+
/**
|
|
5
|
+
* Agent plugin interface
|
|
6
|
+
* Matches the AgentPlugin interface from zn-vault-agent
|
|
7
|
+
*/
|
|
8
|
+
export interface AgentPlugin {
|
|
9
|
+
name: string;
|
|
10
|
+
version: string;
|
|
11
|
+
description?: string;
|
|
12
|
+
onInit?(ctx: PluginContext): Promise<void>;
|
|
13
|
+
onStart?(ctx: PluginContext): Promise<void>;
|
|
14
|
+
onStop?(ctx: PluginContext): Promise<void>;
|
|
15
|
+
routes?(fastify: FastifyInstance, ctx: PluginContext): Promise<void>;
|
|
16
|
+
onCertificateDeployed?(event: CertificateDeployedEvent, ctx: PluginContext): Promise<void>;
|
|
17
|
+
healthCheck?(ctx: PluginContext): Promise<PluginHealthStatus>;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Plugin context provided by the agent
|
|
21
|
+
*/
|
|
22
|
+
export interface PluginContext {
|
|
23
|
+
logger: Logger;
|
|
24
|
+
config: unknown;
|
|
25
|
+
vaultUrl: string;
|
|
26
|
+
tenantId: string;
|
|
27
|
+
getSecret(aliasOrId: string): Promise<string>;
|
|
28
|
+
restartChild(reason: string): Promise<void>;
|
|
29
|
+
emit(event: string, data: unknown): void;
|
|
30
|
+
on(event: string, handler: (data: unknown) => void): void;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Certificate deployed event
|
|
34
|
+
*/
|
|
35
|
+
export interface CertificateDeployedEvent {
|
|
36
|
+
certId: string;
|
|
37
|
+
name: string;
|
|
38
|
+
paths: {
|
|
39
|
+
cert?: string;
|
|
40
|
+
key?: string;
|
|
41
|
+
combined?: string;
|
|
42
|
+
};
|
|
43
|
+
expiresAt: string;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Plugin health status
|
|
47
|
+
*/
|
|
48
|
+
export interface PluginHealthStatus {
|
|
49
|
+
name: string;
|
|
50
|
+
status: 'healthy' | 'degraded' | 'unhealthy';
|
|
51
|
+
message?: string;
|
|
52
|
+
details?: Record<string, unknown>;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Create Payara agent plugin
|
|
56
|
+
*
|
|
57
|
+
* @param config - Plugin configuration
|
|
58
|
+
* @returns Agent plugin instance
|
|
59
|
+
*
|
|
60
|
+
* @example
|
|
61
|
+
* ```json
|
|
62
|
+
* {
|
|
63
|
+
* "plugins": [{
|
|
64
|
+
* "package": "@zincapp/znvault-plugin-payara",
|
|
65
|
+
* "config": {
|
|
66
|
+
* "payaraHome": "/opt/payara",
|
|
67
|
+
* "domain": "domain1",
|
|
68
|
+
* "user": "payara",
|
|
69
|
+
* "warPath": "/opt/app/MyApp.war",
|
|
70
|
+
* "appName": "MyApp",
|
|
71
|
+
* "healthEndpoint": "http://localhost:8080/health"
|
|
72
|
+
* }
|
|
73
|
+
* }]
|
|
74
|
+
* }
|
|
75
|
+
* ```
|
|
76
|
+
*/
|
|
77
|
+
export default function createPayaraPlugin(config: PayaraPluginConfig): AgentPlugin;
|
|
78
|
+
export { PayaraManager } from './payara-manager.js';
|
|
79
|
+
export { WarDeployer, calculateDiff, calculateWarHashes, getWarEntry } from './war-deployer.js';
|
|
80
|
+
export { registerRoutes } from './routes.js';
|
|
81
|
+
export { createPayaraCLIPlugin } from './cli.js';
|
|
82
|
+
export type { PayaraPluginConfig, PayaraManagerOptions, WarDeployerOptions, WarFileHashes, FileChange, DeployRequest, DeployResponse, PayaraStatus, } from './types.js';
|
|
83
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAC/C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAInC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAErD;;;GAGG;AACH,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,CAAC,GAAG,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC3C,OAAO,CAAC,CAAC,GAAG,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC5C,MAAM,CAAC,CAAC,GAAG,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC3C,MAAM,CAAC,CAAC,OAAO,EAAE,eAAe,EAAE,GAAG,EAAE,aAAa,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AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,CAAC,OAAO,UAAU,kBAAkB,CAAC,MAAM,EAAE,kBAAkB,GAAG,WAAW,CAsHlF;AAGD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,kBAAkB,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChG,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC;AACjD,YAAY,EACV,kBAAkB,EAClB,oBAAoB,EACpB,kBAAkB,EAClB,aAAa,EACb,UAAU,EACV,aAAa,EACb,cAAc,EACd,YAAY,GACb,MAAM,YAAY,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
// Path: src/index.ts
|
|
2
|
+
// Payara plugin for zn-vault-agent
|
|
3
|
+
import { PayaraManager } from './payara-manager.js';
|
|
4
|
+
import { WarDeployer } from './war-deployer.js';
|
|
5
|
+
import { registerRoutes } from './routes.js';
|
|
6
|
+
/**
|
|
7
|
+
* Create Payara agent plugin
|
|
8
|
+
*
|
|
9
|
+
* @param config - Plugin configuration
|
|
10
|
+
* @returns Agent plugin instance
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```json
|
|
14
|
+
* {
|
|
15
|
+
* "plugins": [{
|
|
16
|
+
* "package": "@zincapp/znvault-plugin-payara",
|
|
17
|
+
* "config": {
|
|
18
|
+
* "payaraHome": "/opt/payara",
|
|
19
|
+
* "domain": "domain1",
|
|
20
|
+
* "user": "payara",
|
|
21
|
+
* "warPath": "/opt/app/MyApp.war",
|
|
22
|
+
* "appName": "MyApp",
|
|
23
|
+
* "healthEndpoint": "http://localhost:8080/health"
|
|
24
|
+
* }
|
|
25
|
+
* }]
|
|
26
|
+
* }
|
|
27
|
+
* ```
|
|
28
|
+
*/
|
|
29
|
+
export default function createPayaraPlugin(config) {
|
|
30
|
+
let payara;
|
|
31
|
+
let deployer;
|
|
32
|
+
let pluginLogger;
|
|
33
|
+
return {
|
|
34
|
+
name: 'payara',
|
|
35
|
+
version: '1.0.0',
|
|
36
|
+
description: 'Payara application server management with WAR diff deployment',
|
|
37
|
+
async onInit(ctx) {
|
|
38
|
+
pluginLogger = ctx.logger.child({ plugin: 'payara' });
|
|
39
|
+
pluginLogger.info({ config }, 'Initializing Payara plugin');
|
|
40
|
+
// Validate required config
|
|
41
|
+
if (!config.payaraHome) {
|
|
42
|
+
throw new Error('Payara plugin: payaraHome is required');
|
|
43
|
+
}
|
|
44
|
+
if (!config.domain) {
|
|
45
|
+
throw new Error('Payara plugin: domain is required');
|
|
46
|
+
}
|
|
47
|
+
if (!config.user) {
|
|
48
|
+
throw new Error('Payara plugin: user is required');
|
|
49
|
+
}
|
|
50
|
+
if (!config.warPath) {
|
|
51
|
+
throw new Error('Payara plugin: warPath is required');
|
|
52
|
+
}
|
|
53
|
+
if (!config.appName) {
|
|
54
|
+
throw new Error('Payara plugin: appName is required');
|
|
55
|
+
}
|
|
56
|
+
// Create Payara manager
|
|
57
|
+
payara = new PayaraManager({
|
|
58
|
+
payaraHome: config.payaraHome,
|
|
59
|
+
domain: config.domain,
|
|
60
|
+
user: config.user,
|
|
61
|
+
healthEndpoint: config.healthEndpoint,
|
|
62
|
+
healthCheckTimeout: config.healthCheckTimeout,
|
|
63
|
+
operationTimeout: config.operationTimeout,
|
|
64
|
+
logger: pluginLogger,
|
|
65
|
+
});
|
|
66
|
+
// Create WAR deployer
|
|
67
|
+
deployer = new WarDeployer({
|
|
68
|
+
warPath: config.warPath,
|
|
69
|
+
appName: config.appName,
|
|
70
|
+
contextRoot: config.contextRoot,
|
|
71
|
+
payara,
|
|
72
|
+
logger: pluginLogger,
|
|
73
|
+
});
|
|
74
|
+
pluginLogger.info('Payara plugin initialized');
|
|
75
|
+
},
|
|
76
|
+
async onStart(_ctx) {
|
|
77
|
+
pluginLogger.info('Starting Payara plugin');
|
|
78
|
+
// Check if Payara is already healthy
|
|
79
|
+
if (await payara.isHealthy()) {
|
|
80
|
+
pluginLogger.info('Payara already running and healthy');
|
|
81
|
+
}
|
|
82
|
+
else {
|
|
83
|
+
pluginLogger.info('Starting Payara...');
|
|
84
|
+
await payara.start();
|
|
85
|
+
// Deploy WAR if it exists
|
|
86
|
+
if (await deployer.warExists()) {
|
|
87
|
+
await deployer.deploy();
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
pluginLogger.info('Payara plugin started');
|
|
91
|
+
},
|
|
92
|
+
async onStop(_ctx) {
|
|
93
|
+
// Don't stop Payara when agent stops - it runs independently
|
|
94
|
+
pluginLogger.info('Payara plugin stopping (Payara will continue running)');
|
|
95
|
+
},
|
|
96
|
+
async routes(fastify, _ctx) {
|
|
97
|
+
await registerRoutes(fastify, payara, deployer, pluginLogger);
|
|
98
|
+
pluginLogger.info('Payara routes registered');
|
|
99
|
+
},
|
|
100
|
+
async onCertificateDeployed(event, _ctx) {
|
|
101
|
+
if (config.restartOnCertChange) {
|
|
102
|
+
pluginLogger.info({ certId: event.certId, name: event.name }, 'Certificate changed, restarting Payara');
|
|
103
|
+
await payara.restart();
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
async healthCheck(_ctx) {
|
|
107
|
+
try {
|
|
108
|
+
const status = await payara.getStatus();
|
|
109
|
+
return {
|
|
110
|
+
name: 'payara',
|
|
111
|
+
status: status.healthy ? 'healthy' : status.running ? 'degraded' : 'unhealthy',
|
|
112
|
+
details: {
|
|
113
|
+
domain: config.domain,
|
|
114
|
+
running: status.running,
|
|
115
|
+
healthy: status.healthy,
|
|
116
|
+
warPath: config.warPath,
|
|
117
|
+
appName: config.appName,
|
|
118
|
+
},
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
catch (err) {
|
|
122
|
+
return {
|
|
123
|
+
name: 'payara',
|
|
124
|
+
status: 'unhealthy',
|
|
125
|
+
message: err instanceof Error ? err.message : String(err),
|
|
126
|
+
details: {
|
|
127
|
+
domain: config.domain,
|
|
128
|
+
warPath: config.warPath,
|
|
129
|
+
},
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
},
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
// Re-export types and utilities
|
|
136
|
+
export { PayaraManager } from './payara-manager.js';
|
|
137
|
+
export { WarDeployer, calculateDiff, calculateWarHashes, getWarEntry } from './war-deployer.js';
|
|
138
|
+
export { registerRoutes } from './routes.js';
|
|
139
|
+
export { createPayaraCLIPlugin } from './cli.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,qBAAqB;AACrB,mCAAmC;AAInC,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAqD7C;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,CAAC,OAAO,UAAU,kBAAkB,CAAC,MAA0B;IACnE,IAAI,MAAqB,CAAC;IAC1B,IAAI,QAAqB,CAAC;IAC1B,IAAI,YAAoB,CAAC;IAEzB,OAAO;QACL,IAAI,EAAE,QAAQ;QACd,OAAO,EAAE,OAAO;QAChB,WAAW,EAAE,+DAA+D;QAE5E,KAAK,CAAC,MAAM,CAAC,GAAkB;YAC7B,YAAY,GAAG,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,CAAC;YACtD,YAAY,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,EAAE,4BAA4B,CAAC,CAAC;YAE5D,2BAA2B;YAC3B,IAAI,CAAC,MAAM,CAAC,UAAU,EAAE,CAAC;gBACvB,MAAM,IAAI,KAAK,CAAC,uCAAuC,CAAC,CAAC;YAC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C,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,WAAW;oBAC9E,OAAO,EAAE;wBACP,MAAM,EAAE,MAAM,CAAC,MAAM;wBACrB,OAAO,EAAE,MAAM,CAAC,OAAO;wBACvB,OAAO,EAAE,MAAM,CAAC,OAAO;wBACvB,OAAO,EAAE,MAAM,CAAC,OAAO;wBACvB,OAAO,EAAE,MAAM,CAAC,OAAO;qBACxB;iBACF,CAAC;YACJ,CAAC;YAAC,OAAO,GAAG,EAAE,CAAC;gBACb,OAAO;oBACL,IAAI,EAAE,QAAQ;oBACd,MAAM,EAAE,WAAW;oBACnB,OAAO,EAAE,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC;oBACzD,OAAO,EAAE;wBACP,MAAM,EAAE,MAAM,CAAC,MAAM;wBACrB,OAAO,EAAE,MAAM,CAAC,OAAO;qBACxB;iBACF,CAAC;YACJ,CAAC;QACH,CAAC;KACF,CAAC;AACJ,CAAC;AAED,gCAAgC;AAChC,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,kBAAkB,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChG,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,qBAAqB,EAAE,MAAM,UAAU,CAAC"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import type { PayaraManagerOptions, PayaraStatus } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Manages Payara application server lifecycle
|
|
4
|
+
*/
|
|
5
|
+
export declare class PayaraManager {
|
|
6
|
+
private readonly payaraHome;
|
|
7
|
+
private readonly asadmin;
|
|
8
|
+
readonly domain: string;
|
|
9
|
+
private readonly user;
|
|
10
|
+
private readonly healthEndpoint?;
|
|
11
|
+
private readonly healthCheckTimeout;
|
|
12
|
+
private readonly operationTimeout;
|
|
13
|
+
private readonly logger;
|
|
14
|
+
constructor(options: PayaraManagerOptions);
|
|
15
|
+
/**
|
|
16
|
+
* Execute a command, optionally as a different user
|
|
17
|
+
*/
|
|
18
|
+
private execCommand;
|
|
19
|
+
/**
|
|
20
|
+
* Run asadmin command
|
|
21
|
+
*/
|
|
22
|
+
private asadminCommand;
|
|
23
|
+
/**
|
|
24
|
+
* Check if Payara domain is running
|
|
25
|
+
*/
|
|
26
|
+
isRunning(): Promise<boolean>;
|
|
27
|
+
/**
|
|
28
|
+
* Check if Payara is healthy via health endpoint
|
|
29
|
+
*/
|
|
30
|
+
isHealthy(): Promise<boolean>;
|
|
31
|
+
/**
|
|
32
|
+
* Start Payara domain
|
|
33
|
+
*/
|
|
34
|
+
start(): Promise<void>;
|
|
35
|
+
/**
|
|
36
|
+
* Stop Payara domain
|
|
37
|
+
*/
|
|
38
|
+
stop(): Promise<void>;
|
|
39
|
+
/**
|
|
40
|
+
* Restart Payara domain
|
|
41
|
+
*/
|
|
42
|
+
restart(): Promise<void>;
|
|
43
|
+
/**
|
|
44
|
+
* Deploy a WAR file to Payara
|
|
45
|
+
*/
|
|
46
|
+
deploy(warPath: string, appName: string, contextRoot?: string): Promise<void>;
|
|
47
|
+
/**
|
|
48
|
+
* Undeploy an application from Payara
|
|
49
|
+
*/
|
|
50
|
+
undeploy(appName: string): Promise<void>;
|
|
51
|
+
/**
|
|
52
|
+
* List deployed applications
|
|
53
|
+
*/
|
|
54
|
+
listApplications(): Promise<string[]>;
|
|
55
|
+
/**
|
|
56
|
+
* Get Payara status
|
|
57
|
+
*/
|
|
58
|
+
getStatus(): Promise<PayaraStatus>;
|
|
59
|
+
/**
|
|
60
|
+
* Wait for Payara to become healthy
|
|
61
|
+
*/
|
|
62
|
+
private waitForHealthy;
|
|
63
|
+
/**
|
|
64
|
+
* Wait for Payara to stop
|
|
65
|
+
*/
|
|
66
|
+
private waitForStopped;
|
|
67
|
+
/**
|
|
68
|
+
* Sleep helper
|
|
69
|
+
*/
|
|
70
|
+
private sleep;
|
|
71
|
+
}
|
|
72
|
+
//# sourceMappingURL=payara-manager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"payara-manager.d.ts","sourceRoot":"","sources":["../src/payara-manager.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,oBAAoB,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAIrE;;GAEG;AACH,qBAAa,aAAa;IACxB,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAS;IACpC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;IACjC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAS;IAC9B,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAC,CAAS;IACzC,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAAS;IAC5C,OAAO,CAAC,QAAQ,CAAC,gBAAgB,CAAS;IAC1C,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;gBAEpB,OAAO,EAAE,oBAAoB;IAazC;;OAEG;YACW,WAAW;IA+BzB;;OAEG;YACW,cAAc;IAM5B;;OAEG;IACG,SAAS,IAAI,OAAO,CAAC,OAAO,CAAC;IAWnC;;OAEG;IACG,SAAS,IAAI,OAAO,CAAC,OAAO,CAAC;IA6BnC;;OAEG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;IAgB5B;;OAEG;IACG,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAqB3B;;OAEG;IACG,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAS9B;;OAEG;IACG,MAAM,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAcnF;;OAEG;IACG,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAY9C;;OAEG;IACG,gBAAgB,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;IAU3C;;OAEG;IACG,SAAS,IAAI,OAAO,CAAC,YAAY,CAAC;IAWxC;;OAEG;YACW,cAAc;IAc5B;;OAEG;YACW,cAAc;IAc5B;;OAEG;IACH,OAAO,CAAC,KAAK;CAGd"}
|
|
@@ -0,0 +1,239 @@
|
|
|
1
|
+
// Path: src/payara-manager.ts
|
|
2
|
+
// Payara application server process management
|
|
3
|
+
import { exec } from 'node:child_process';
|
|
4
|
+
import { promisify } from 'node:util';
|
|
5
|
+
import { join } from 'node:path';
|
|
6
|
+
const execAsync = promisify(exec);
|
|
7
|
+
/**
|
|
8
|
+
* Manages Payara application server lifecycle
|
|
9
|
+
*/
|
|
10
|
+
export class PayaraManager {
|
|
11
|
+
payaraHome;
|
|
12
|
+
asadmin;
|
|
13
|
+
domain;
|
|
14
|
+
user;
|
|
15
|
+
healthEndpoint;
|
|
16
|
+
healthCheckTimeout;
|
|
17
|
+
operationTimeout;
|
|
18
|
+
logger;
|
|
19
|
+
constructor(options) {
|
|
20
|
+
this.payaraHome = options.payaraHome;
|
|
21
|
+
this.domain = options.domain;
|
|
22
|
+
this.user = options.user;
|
|
23
|
+
this.healthEndpoint = options.healthEndpoint;
|
|
24
|
+
this.healthCheckTimeout = options.healthCheckTimeout ?? 30000;
|
|
25
|
+
this.operationTimeout = options.operationTimeout ?? 120000;
|
|
26
|
+
this.logger = options.logger;
|
|
27
|
+
// Path to asadmin command
|
|
28
|
+
this.asadmin = join(this.payaraHome, 'bin', 'asadmin');
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Execute a command, optionally as a different user
|
|
32
|
+
*/
|
|
33
|
+
async execCommand(command, timeout) {
|
|
34
|
+
const effectiveTimeout = timeout ?? this.operationTimeout;
|
|
35
|
+
// If running as root and user is specified, use sudo
|
|
36
|
+
const fullCommand = process.getuid?.() === 0 && this.user
|
|
37
|
+
? `sudo -u ${this.user} ${command}`
|
|
38
|
+
: command;
|
|
39
|
+
this.logger.debug({ command: fullCommand }, 'Executing command');
|
|
40
|
+
try {
|
|
41
|
+
const result = await execAsync(fullCommand, {
|
|
42
|
+
timeout: effectiveTimeout,
|
|
43
|
+
env: {
|
|
44
|
+
...process.env,
|
|
45
|
+
JAVA_HOME: process.env.JAVA_HOME ?? '/usr/lib/jvm/java-11-openjdk-amd64',
|
|
46
|
+
},
|
|
47
|
+
});
|
|
48
|
+
return result;
|
|
49
|
+
}
|
|
50
|
+
catch (err) {
|
|
51
|
+
const error = err;
|
|
52
|
+
this.logger.error({
|
|
53
|
+
command: fullCommand,
|
|
54
|
+
stdout: error.stdout,
|
|
55
|
+
stderr: error.stderr,
|
|
56
|
+
code: error.code,
|
|
57
|
+
}, 'Command failed');
|
|
58
|
+
throw err;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Run asadmin command
|
|
63
|
+
*/
|
|
64
|
+
async asadminCommand(args, timeout) {
|
|
65
|
+
const command = `${this.asadmin} ${args.join(' ')}`;
|
|
66
|
+
const result = await this.execCommand(command, timeout);
|
|
67
|
+
return result.stdout;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Check if Payara domain is running
|
|
71
|
+
*/
|
|
72
|
+
async isRunning() {
|
|
73
|
+
try {
|
|
74
|
+
const output = await this.asadminCommand(['list-domains'], 10000);
|
|
75
|
+
// Output format: "domain1 running" or "domain1 not running"
|
|
76
|
+
const domainLine = output.split('\n').find(line => line.startsWith(this.domain));
|
|
77
|
+
return domainLine?.includes('running') && !domainLine?.includes('not running') || false;
|
|
78
|
+
}
|
|
79
|
+
catch {
|
|
80
|
+
return false;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Check if Payara is healthy via health endpoint
|
|
85
|
+
*/
|
|
86
|
+
async isHealthy() {
|
|
87
|
+
if (!this.healthEndpoint) {
|
|
88
|
+
// No health endpoint configured, just check if running
|
|
89
|
+
return this.isRunning();
|
|
90
|
+
}
|
|
91
|
+
try {
|
|
92
|
+
const controller = new AbortController();
|
|
93
|
+
const timeout = setTimeout(() => controller.abort(), this.healthCheckTimeout);
|
|
94
|
+
const response = await fetch(this.healthEndpoint, {
|
|
95
|
+
signal: controller.signal,
|
|
96
|
+
headers: { 'Accept': 'application/json' },
|
|
97
|
+
});
|
|
98
|
+
clearTimeout(timeout);
|
|
99
|
+
if (!response.ok) {
|
|
100
|
+
this.logger.warn({ status: response.status }, 'Health check returned non-OK status');
|
|
101
|
+
return false;
|
|
102
|
+
}
|
|
103
|
+
return true;
|
|
104
|
+
}
|
|
105
|
+
catch (err) {
|
|
106
|
+
this.logger.debug({ err, endpoint: this.healthEndpoint }, 'Health check failed');
|
|
107
|
+
return false;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Start Payara domain
|
|
112
|
+
*/
|
|
113
|
+
async start() {
|
|
114
|
+
if (await this.isRunning()) {
|
|
115
|
+
this.logger.info({ domain: this.domain }, 'Domain already running');
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
this.logger.info({ domain: this.domain }, 'Starting Payara domain');
|
|
119
|
+
await this.asadminCommand(['start-domain', this.domain]);
|
|
120
|
+
// Wait for domain to be ready
|
|
121
|
+
await this.waitForHealthy(60000);
|
|
122
|
+
this.logger.info({ domain: this.domain }, 'Payara domain started');
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Stop Payara domain
|
|
126
|
+
*/
|
|
127
|
+
async stop() {
|
|
128
|
+
if (!(await this.isRunning())) {
|
|
129
|
+
this.logger.info({ domain: this.domain }, 'Domain not running');
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
this.logger.info({ domain: this.domain }, 'Stopping Payara domain');
|
|
133
|
+
try {
|
|
134
|
+
await this.asadminCommand(['stop-domain', this.domain]);
|
|
135
|
+
}
|
|
136
|
+
catch (err) {
|
|
137
|
+
// Domain might already be stopped
|
|
138
|
+
this.logger.warn({ err }, 'Error stopping domain (may already be stopped)');
|
|
139
|
+
}
|
|
140
|
+
// Wait for domain to stop
|
|
141
|
+
await this.waitForStopped(30000);
|
|
142
|
+
this.logger.info({ domain: this.domain }, 'Payara domain stopped');
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Restart Payara domain
|
|
146
|
+
*/
|
|
147
|
+
async restart() {
|
|
148
|
+
this.logger.info({ domain: this.domain }, 'Restarting Payara domain');
|
|
149
|
+
await this.stop();
|
|
150
|
+
await this.start();
|
|
151
|
+
this.logger.info({ domain: this.domain }, 'Payara domain restarted');
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Deploy a WAR file to Payara
|
|
155
|
+
*/
|
|
156
|
+
async deploy(warPath, appName, contextRoot) {
|
|
157
|
+
this.logger.info({ warPath, appName, contextRoot }, 'Deploying application');
|
|
158
|
+
const args = ['deploy', '--force=true', `--name=${appName}`];
|
|
159
|
+
if (contextRoot) {
|
|
160
|
+
args.push(`--contextroot=${contextRoot}`);
|
|
161
|
+
}
|
|
162
|
+
args.push(warPath);
|
|
163
|
+
await this.asadminCommand(args);
|
|
164
|
+
this.logger.info({ appName }, 'Application deployed');
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* Undeploy an application from Payara
|
|
168
|
+
*/
|
|
169
|
+
async undeploy(appName) {
|
|
170
|
+
this.logger.info({ appName }, 'Undeploying application');
|
|
171
|
+
try {
|
|
172
|
+
await this.asadminCommand(['undeploy', appName]);
|
|
173
|
+
this.logger.info({ appName }, 'Application undeployed');
|
|
174
|
+
}
|
|
175
|
+
catch (err) {
|
|
176
|
+
// Application might not be deployed
|
|
177
|
+
this.logger.warn({ err, appName }, 'Error undeploying (may not be deployed)');
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* List deployed applications
|
|
182
|
+
*/
|
|
183
|
+
async listApplications() {
|
|
184
|
+
try {
|
|
185
|
+
const output = await this.asadminCommand(['list-applications'], 10000);
|
|
186
|
+
const lines = output.split('\n').filter(line => line.trim() && !line.includes('Command'));
|
|
187
|
+
return lines.map(line => line.split(/\s+/)[0] ?? '').filter(Boolean);
|
|
188
|
+
}
|
|
189
|
+
catch {
|
|
190
|
+
return [];
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* Get Payara status
|
|
195
|
+
*/
|
|
196
|
+
async getStatus() {
|
|
197
|
+
const running = await this.isRunning();
|
|
198
|
+
const healthy = running ? await this.isHealthy() : false;
|
|
199
|
+
return {
|
|
200
|
+
healthy,
|
|
201
|
+
running,
|
|
202
|
+
domain: this.domain,
|
|
203
|
+
};
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* Wait for Payara to become healthy
|
|
207
|
+
*/
|
|
208
|
+
async waitForHealthy(timeoutMs) {
|
|
209
|
+
const startTime = Date.now();
|
|
210
|
+
const pollInterval = 2000;
|
|
211
|
+
while (Date.now() - startTime < timeoutMs) {
|
|
212
|
+
if (await this.isHealthy()) {
|
|
213
|
+
return;
|
|
214
|
+
}
|
|
215
|
+
await this.sleep(pollInterval);
|
|
216
|
+
}
|
|
217
|
+
throw new Error(`Payara did not become healthy within ${timeoutMs}ms`);
|
|
218
|
+
}
|
|
219
|
+
/**
|
|
220
|
+
* Wait for Payara to stop
|
|
221
|
+
*/
|
|
222
|
+
async waitForStopped(timeoutMs) {
|
|
223
|
+
const startTime = Date.now();
|
|
224
|
+
const pollInterval = 1000;
|
|
225
|
+
while (Date.now() - startTime < timeoutMs) {
|
|
226
|
+
if (!(await this.isRunning())) {
|
|
227
|
+
return;
|
|
228
|
+
}
|
|
229
|
+
await this.sleep(pollInterval);
|
|
230
|
+
}
|
|
231
|
+
throw new Error(`Payara did not stop within ${timeoutMs}ms`);
|
|
232
|
+
}
|
|
233
|
+
/**
|
|
234
|
+
* Sleep helper
|
|
235
|
+
*/
|
|
236
|
+
sleep(ms) {
|
|
237
|
+
return new Promise(resolve => setTimeout(resolve, ms));
|
|
238
|
+
}
|
|
239
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"payara-manager.js","sourceRoot":"","sources":["../src/payara-manager.ts"],"names":[],"mappings":"AAAA,8BAA8B;AAC9B,+CAA+C;AAE/C,OAAO,EAAE,IAAI,EAAE,MAAM,oBAAoB,CAAC;AAC1C,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAIjC,MAAM,SAAS,GAAG,SAAS,CAAC,IAAI,CAAC,CAAC;AAElC;;GAEG;AACH,MAAM,OAAO,aAAa;IACP,UAAU,CAAS;IACnB,OAAO,CAAS;IACxB,MAAM,CAAS;IACP,IAAI,CAAS;IACb,cAAc,CAAU;IACxB,kBAAkB,CAAS;IAC3B,gBAAgB,CAAS;IACzB,MAAM,CAAS;IAEhC,YAAY,OAA6B;QACvC,IAAI,CAAC,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC;QACrC,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;QAC7B,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;QACzB,IAAI,CAAC,cAAc,GAAG,OAAO,CAAC,cAAc,CAAC;QAC7C,IAAI,CAAC,kBAAkB,GAAG,OAAO,CAAC,kBAAkB,IAAI,KAAK,CAAC;QAC9D,IAAI,CAAC,gBAAgB,GAAG,OAAO,CAAC,gBAAgB,IAAI,MAAM,CAAC;QAC3D,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;QAE7B,0BAA0B;QAC1B,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,KAAK,EAAE,SAAS,CAAC,CAAC;IACzD,CAAC;IAED;;OAEG;IACK,KAAK,CAAC,WAAW,CAAC,OAAe,EAAE,OAAgB;QACzD,MAAM,gBAAgB,GAAG,OA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AI,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC;IACzD,CAAC;CACF"}
|
package/dist/routes.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { FastifyInstance } from 'fastify';
|
|
2
|
+
import type { Logger } from 'pino';
|
|
3
|
+
import type { PayaraManager } from './payara-manager.js';
|
|
4
|
+
import type { WarDeployer } from './war-deployer.js';
|
|
5
|
+
/**
|
|
6
|
+
* Register Payara plugin HTTP routes
|
|
7
|
+
*
|
|
8
|
+
* Routes are registered under /plugins/payara/ prefix by the agent
|
|
9
|
+
*/
|
|
10
|
+
export declare function registerRoutes(fastify: FastifyInstance, payara: PayaraManager, deployer: WarDeployer, logger: Logger): Promise<void>;
|
|
11
|
+
//# sourceMappingURL=routes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"routes.d.ts","sourceRoot":"","sources":["../src/routes.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAC/C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AACnC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGrD;;;;GAIG;AACH,wBAAsB,cAAc,CAClC,OAAO,EAAE,eAAe,EACxB,MAAM,EAAE,aAAa,EACrB,QAAQ,EAAE,WAAW,EACrB,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,IAAI,CAAC,CA4Pf"}
|