@ossy/deployment-tools 1.17.4 → 1.17.5
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/CHANGELOG.md +8 -0
- package/README.md +86 -86
- package/package.json +3 -4
- package/src/index.cli.js +0 -2
- package/src/infrastructure/cli.js +0 -5
- package/src/infrastructure/container-deployment-target/caddy.service.js +28 -10
- package/src/infrastructure/container-deployment-target/container-deployment-target.js +10 -24
- package/src/infrastructure/container-deployment-target/ossy-api.service.js +43 -0
- package/src/infrastructure/container-deployment-target/ossy-runtime.service.js +37 -0
- package/jsdoc/AwsCredentialsService.html +0 -166
- package/jsdoc/AwsProfile.html +0 -166
- package/jsdoc/CaddyService.html +0 -293
- package/jsdoc/ContainerServer.html +0 -265
- package/jsdoc/DeploymentQueueService.html +0 -166
- package/jsdoc/DeploymentToolsService.html +0 -166
- package/jsdoc/DockerService.html +0 -166
- package/jsdoc/EstablishTrustStack.html +0 -268
- package/jsdoc/PlatformConfigService.html +0 -166
- package/jsdoc/PlatformDeploymentService.html +0 -166
- package/jsdoc/PlatformServerService.html +0 -166
- package/jsdoc/PlatformStack.html +0 -166
- package/jsdoc/PlatformTemplateService.html +0 -502
- package/jsdoc/RestApiService.html +0 -166
- package/jsdoc/aws-credentials_aws-credentials.js.html +0 -138
- package/jsdoc/config_platform-config.js.html +0 -113
- package/jsdoc/deploy_platform-deployment.js.html +0 -155
- package/jsdoc/deployment-queue_deployment-queue.js.html +0 -132
- package/jsdoc/fonts/OpenSans-Bold-webfont.eot +0 -0
- package/jsdoc/fonts/OpenSans-Bold-webfont.svg +0 -1830
- package/jsdoc/fonts/OpenSans-Bold-webfont.woff +0 -0
- package/jsdoc/fonts/OpenSans-BoldItalic-webfont.eot +0 -0
- package/jsdoc/fonts/OpenSans-BoldItalic-webfont.svg +0 -1830
- package/jsdoc/fonts/OpenSans-BoldItalic-webfont.woff +0 -0
- package/jsdoc/fonts/OpenSans-Italic-webfont.eot +0 -0
- package/jsdoc/fonts/OpenSans-Italic-webfont.svg +0 -1830
- package/jsdoc/fonts/OpenSans-Italic-webfont.woff +0 -0
- package/jsdoc/fonts/OpenSans-Light-webfont.eot +0 -0
- package/jsdoc/fonts/OpenSans-Light-webfont.svg +0 -1831
- package/jsdoc/fonts/OpenSans-Light-webfont.woff +0 -0
- package/jsdoc/fonts/OpenSans-LightItalic-webfont.eot +0 -0
- package/jsdoc/fonts/OpenSans-LightItalic-webfont.svg +0 -1835
- package/jsdoc/fonts/OpenSans-LightItalic-webfont.woff +0 -0
- package/jsdoc/fonts/OpenSans-Regular-webfont.eot +0 -0
- package/jsdoc/fonts/OpenSans-Regular-webfont.svg +0 -1831
- package/jsdoc/fonts/OpenSans-Regular-webfont.woff +0 -0
- package/jsdoc/global.html +0 -800
- package/jsdoc/index.html +0 -65
- package/jsdoc/infrastructure_container-server_aws-profile.js.html +0 -76
- package/jsdoc/infrastructure_container-server_caddy.service.js.html +0 -123
- package/jsdoc/infrastructure_container-server_container-server.js.html +0 -229
- package/jsdoc/infrastructure_container-server_deployment-tools.service.js.html +0 -91
- package/jsdoc/infrastructure_establish-trust-stack.js.html +0 -119
- package/jsdoc/infrastructure_platform-stack.js.html +0 -107
- package/jsdoc/scripts/linenumber.js +0 -25
- package/jsdoc/scripts/prettify/Apache-License-2.0.txt +0 -202
- package/jsdoc/scripts/prettify/lang-css.js +0 -2
- package/jsdoc/scripts/prettify/prettify.js +0 -28
- package/jsdoc/server_caddy.js.html +0 -165
- package/jsdoc/server_docker.js.html +0 -133
- package/jsdoc/server_platform-server.js.html +0 -91
- package/jsdoc/server_rest-api.js.html +0 -82
- package/jsdoc/styles/jsdoc-default.css +0 -358
- package/jsdoc/styles/prettify-jsdoc.css +0 -111
- package/jsdoc/styles/prettify-tomorrow.css +0 -132
- package/jsdoc/template_platform-template.js.html +0 -134
- package/jsdoc.config.js +0 -15
- package/src/deploy/cli.js +0 -60
- package/src/deploy/index.js +0 -1
- package/src/deploy/platform-deployment.js +0 -122
- package/src/deployment-queue/deployment-queue.js +0 -81
- package/src/deployment-queue/index.js +0 -1
- package/src/docker/docker-service.js +0 -136
- package/src/docker/docker-service.playground.js +0 -15
- package/src/docker/index.js +0 -1
- package/src/infrastructure/ecr-stack.js +0 -53
- package/src/server/cli.js +0 -34
- package/src/server/platform-server.js +0 -42
|
@@ -1,165 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html lang="en">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="utf-8">
|
|
5
|
-
<title>JSDoc: Source: server/caddy.js</title>
|
|
6
|
-
|
|
7
|
-
<script src="scripts/prettify/prettify.js"> </script>
|
|
8
|
-
<script src="scripts/prettify/lang-css.js"> </script>
|
|
9
|
-
<!--[if lt IE 9]>
|
|
10
|
-
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
|
|
11
|
-
<![endif]-->
|
|
12
|
-
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
|
|
13
|
-
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
|
|
14
|
-
</head>
|
|
15
|
-
|
|
16
|
-
<body>
|
|
17
|
-
|
|
18
|
-
<div id="main">
|
|
19
|
-
|
|
20
|
-
<h1 class="page-title">Source: server/caddy.js</h1>
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
<section>
|
|
28
|
-
<article>
|
|
29
|
-
<pre class="prettyprint source linenums"><code>const fetch = require('node-fetch')
|
|
30
|
-
const { logInfo, logError } = require('../log')
|
|
31
|
-
|
|
32
|
-
const Matchers = {
|
|
33
|
-
host: host => ({ host: [host] }),
|
|
34
|
-
path: path => ({ path: [path] })
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
const Handlers = {
|
|
38
|
-
reverseProxy: upstreamPort => ({
|
|
39
|
-
handler: 'reverse_proxy',
|
|
40
|
-
upstreams: [{ dial: `localhost:${upstreamPort}` }]
|
|
41
|
-
}),
|
|
42
|
-
subroute: routes => ({
|
|
43
|
-
handler: 'subroute',
|
|
44
|
-
routes
|
|
45
|
-
})
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* @class
|
|
50
|
-
*/
|
|
51
|
-
class CaddyService {
|
|
52
|
-
|
|
53
|
-
static addDeployment(platformConfig, deploymentRequest) {
|
|
54
|
-
|
|
55
|
-
const url = `${deploymentRequest.subdomain}.${platformConfig.activeEnvironment}.${platformConfig.domain}`
|
|
56
|
-
|
|
57
|
-
logInfo({ message: `[CaddyService] Updating caddy config to route ${url} to localhost:${deploymentRequest.hostPort}` })
|
|
58
|
-
|
|
59
|
-
return fetch(`http://localhost:2019/config/apps/http/servers/${platformConfig.ciServerName}/routes/0/handle`, {
|
|
60
|
-
method: 'POST',
|
|
61
|
-
headers: { 'Content-Type': 'application/json' },
|
|
62
|
-
body: JSON.stringify(Handlers.subroute([
|
|
63
|
-
{
|
|
64
|
-
match: [Matchers.host(url)],
|
|
65
|
-
handle: [Handlers.subroute([{ handle: [Handlers.reverseProxy(deploymentRequest.hostPort)]}])]
|
|
66
|
-
}
|
|
67
|
-
]))
|
|
68
|
-
})
|
|
69
|
-
.catch(error => logError({ message: `[CaddyService] Could not update caddy config to include ${url}`, error }))
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
static applyDefaultConfig(platformConfig) {
|
|
73
|
-
logInfo({ message: '[CaddyService] Applying default caddy config' })
|
|
74
|
-
return fetch('http://localhost:2019/load', {
|
|
75
|
-
method: 'POST',
|
|
76
|
-
headers: { 'Content-Type': 'application/json' },
|
|
77
|
-
body: JSON.stringify({
|
|
78
|
-
apps: {
|
|
79
|
-
http: {
|
|
80
|
-
servers: {
|
|
81
|
-
[platformConfig.ciServerName]: {
|
|
82
|
-
listen: [':80', ':443'],
|
|
83
|
-
routes: [
|
|
84
|
-
{
|
|
85
|
-
match: [Matchers.host(`*.${platformConfig.activeEnvironment}.${platformConfig.domain}`)],
|
|
86
|
-
handle: [Handlers.subroute([
|
|
87
|
-
{
|
|
88
|
-
match: [Matchers.host(`${platformConfig.ciSubDomain}.${platformConfig.activeEnvironment}.${platformConfig.domain}`)],
|
|
89
|
-
handle: [Handlers.subroute([{ handle: [Handlers.reverseProxy(platformConfig.ciInternalServerPort)]}])]
|
|
90
|
-
}
|
|
91
|
-
])],
|
|
92
|
-
terminal: true
|
|
93
|
-
}
|
|
94
|
-
]
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
},
|
|
98
|
-
tls: {
|
|
99
|
-
automation: {
|
|
100
|
-
policies: [
|
|
101
|
-
{
|
|
102
|
-
subjects:[`*.${platformConfig.activeEnvironment}.${platformConfig.domain}`],
|
|
103
|
-
issuers:[
|
|
104
|
-
{
|
|
105
|
-
challenges:{
|
|
106
|
-
dns:{
|
|
107
|
-
provider:{
|
|
108
|
-
'max_retries': 10,
|
|
109
|
-
name: 'route53',
|
|
110
|
-
'aws_profile': 'ci-client'
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
},
|
|
114
|
-
module: 'acme'
|
|
115
|
-
},
|
|
116
|
-
{
|
|
117
|
-
challenges:{
|
|
118
|
-
dns:{
|
|
119
|
-
provider:{
|
|
120
|
-
'max_retries': 10,
|
|
121
|
-
name: 'route53'
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
},
|
|
125
|
-
module: 'zerossl'
|
|
126
|
-
}
|
|
127
|
-
]
|
|
128
|
-
}
|
|
129
|
-
]
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
})
|
|
134
|
-
})
|
|
135
|
-
.catch(error => logError({ message: '[CaddyService] Could not apply default caddy config', error }))
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
module.exports = {
|
|
141
|
-
CaddyService
|
|
142
|
-
}
|
|
143
|
-
</code></pre>
|
|
144
|
-
</article>
|
|
145
|
-
</section>
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
</div>
|
|
151
|
-
|
|
152
|
-
<nav>
|
|
153
|
-
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="AwsCredentialsService.html">AwsCredentialsService</a></li><li><a href="AwsProfile.html">AwsProfile</a></li><li><a href="CaddyService.html">CaddyService</a></li><li><a href="ContainerServer.html">ContainerServer</a></li><li><a href="DeploymentQueueService.html">DeploymentQueueService</a></li><li><a href="DeploymentToolsService.html">DeploymentToolsService</a></li><li><a href="DockerService.html">DockerService</a></li><li><a href="EstablishTrustStack.html">EstablishTrustStack</a></li><li><a href="PlatformConfigService.html">PlatformConfigService</a></li><li><a href="PlatformDeploymentService.html">PlatformDeploymentService</a></li><li><a href="PlatformServerService.html">PlatformServerService</a></li><li><a href="PlatformStack.html">PlatformStack</a></li><li><a href="PlatformTemplateService.html">PlatformTemplateService</a></li><li><a href="RestApiService.html">RestApiService</a></li></ul><h3><a href="global.html">Global</a></h3>
|
|
154
|
-
</nav>
|
|
155
|
-
|
|
156
|
-
<br class="clear">
|
|
157
|
-
|
|
158
|
-
<footer>
|
|
159
|
-
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.11</a> on Sun Oct 23 2022 22:23:31 GMT+0200 (Central European Summer Time)
|
|
160
|
-
</footer>
|
|
161
|
-
|
|
162
|
-
<script> prettyPrint(); </script>
|
|
163
|
-
<script src="scripts/linenumber.js"> </script>
|
|
164
|
-
</body>
|
|
165
|
-
</html>
|
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html lang="en">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="utf-8">
|
|
5
|
-
<title>JSDoc: Source: server/docker.js</title>
|
|
6
|
-
|
|
7
|
-
<script src="scripts/prettify/prettify.js"> </script>
|
|
8
|
-
<script src="scripts/prettify/lang-css.js"> </script>
|
|
9
|
-
<!--[if lt IE 9]>
|
|
10
|
-
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
|
|
11
|
-
<![endif]-->
|
|
12
|
-
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
|
|
13
|
-
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
|
|
14
|
-
</head>
|
|
15
|
-
|
|
16
|
-
<body>
|
|
17
|
-
|
|
18
|
-
<div id="main">
|
|
19
|
-
|
|
20
|
-
<h1 class="page-title">Source: server/docker.js</h1>
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
<section>
|
|
28
|
-
<article>
|
|
29
|
-
<pre class="prettyprint source linenums"><code>const { exec } = require('child_process')
|
|
30
|
-
const fs = require('fs')
|
|
31
|
-
const { nanoid } = require('nanoid')
|
|
32
|
-
|
|
33
|
-
const { logInfo, logError } = require('../log')
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* @class
|
|
37
|
-
*/
|
|
38
|
-
class DockerService {
|
|
39
|
-
|
|
40
|
-
static createDockerNetworkForContainerManagerServer(platformConfig) {
|
|
41
|
-
logInfo({ message: '[DockerService] Creating docker network for comunication between containers' })
|
|
42
|
-
exec(`sudo docker network create ${platformConfig.ciDockerNetworkName}`)
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
static stopContainer(deploymentRequest) {
|
|
46
|
-
const name = deploymentRequest.image.replaceAll('/', '_')
|
|
47
|
-
logInfo({ message: `Running docker stop for image with the name of ${name}` })
|
|
48
|
-
return `sudo docker stop ${name} ||`
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
static startContainer(platformConfig, { image, containerPort, hostPort, registry, env }) {
|
|
52
|
-
const name = image.replaceAll('/', '_')
|
|
53
|
-
const imageUrl = !!registry ? `${registry}/${image}` : image
|
|
54
|
-
const envsAsString = Object.entries(env || {}).reduce((envs, [name, value]) => `${envs} --env ${name}=${value}`, '')
|
|
55
|
-
logInfo({ message: `Running docker start for image with the name of ${name} with port mapping ${hostPort}:${containerPort} and source ${imageUrl}` })
|
|
56
|
-
return `sudo docker run -d -p ${hostPort}:${containerPort} --name=${name} --network=${platformConfig.ciDockerNetworkName} --network-alias=${name} --rm ${envsAsString} ${imageUrl}`
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
static resolveCredentials({ registry, username, authentication }) {
|
|
60
|
-
const shouldAuthenticate = username || authentication
|
|
61
|
-
|
|
62
|
-
if (!shouldAuthenticate) {
|
|
63
|
-
logInfo({ message: 'No docker credentials provided, assuming image is publicly hosted' })
|
|
64
|
-
return ''
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
logInfo({ message: `Resolving docker credentials for ${registry}` })
|
|
68
|
-
return `sudo docker login ${registry} -u ${username} -p ${authentication}`
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
static deploy(platformConfig, deploymentRequest) {
|
|
72
|
-
return new Promise(resolve => {
|
|
73
|
-
logInfo({ message: 'Starting docker deployment sequence' })
|
|
74
|
-
|
|
75
|
-
const dockerCommandScript = `'#!/bin/bash'
|
|
76
|
-
${DockerService.stopContainer(deploymentRequest)}
|
|
77
|
-
${DockerService.resolveCredentials(deploymentRequest)}
|
|
78
|
-
${DockerService.startContainer(platformConfig, deploymentRequest)}`
|
|
79
|
-
|
|
80
|
-
const deploymentId = nanoid()
|
|
81
|
-
|
|
82
|
-
const FilePaths = {
|
|
83
|
-
DeploymentScript: `${__dirname}/${deploymentId}.sh`
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
fs.writeFileSync(FilePaths.DeploymentScript, dockerCommandScript)
|
|
87
|
-
const command = exec(`bash ${FilePaths.DeploymentScript}`)
|
|
88
|
-
|
|
89
|
-
command.stdout.on('data', data => {
|
|
90
|
-
logInfo({ message: `[DockerService]: ${data}` })
|
|
91
|
-
})
|
|
92
|
-
|
|
93
|
-
command.stderr.on('data', (data) => {
|
|
94
|
-
logError({ message: `[DockerService]: ${data}` })
|
|
95
|
-
})
|
|
96
|
-
|
|
97
|
-
command.on('close', code => {
|
|
98
|
-
logInfo({ message: `[DockerService] command exited with code ${code}` })
|
|
99
|
-
fs.unlinkSync(FilePaths.DeploymentScript)
|
|
100
|
-
resolve()
|
|
101
|
-
})
|
|
102
|
-
})
|
|
103
|
-
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
module.exports = {
|
|
109
|
-
DockerService
|
|
110
|
-
}
|
|
111
|
-
</code></pre>
|
|
112
|
-
</article>
|
|
113
|
-
</section>
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
</div>
|
|
119
|
-
|
|
120
|
-
<nav>
|
|
121
|
-
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="AwsCredentialsService.html">AwsCredentialsService</a></li><li><a href="AwsProfile.html">AwsProfile</a></li><li><a href="CaddyService.html">CaddyService</a></li><li><a href="ContainerServer.html">ContainerServer</a></li><li><a href="DeploymentQueueService.html">DeploymentQueueService</a></li><li><a href="DeploymentToolsService.html">DeploymentToolsService</a></li><li><a href="DockerService.html">DockerService</a></li><li><a href="EstablishTrustStack.html">EstablishTrustStack</a></li><li><a href="PlatformConfigService.html">PlatformConfigService</a></li><li><a href="PlatformDeploymentService.html">PlatformDeploymentService</a></li><li><a href="PlatformServerService.html">PlatformServerService</a></li><li><a href="PlatformStack.html">PlatformStack</a></li><li><a href="PlatformTemplateService.html">PlatformTemplateService</a></li><li><a href="RestApiService.html">RestApiService</a></li></ul><h3><a href="global.html">Global</a></h3>
|
|
122
|
-
</nav>
|
|
123
|
-
|
|
124
|
-
<br class="clear">
|
|
125
|
-
|
|
126
|
-
<footer>
|
|
127
|
-
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.11</a> on Sun Oct 23 2022 22:23:31 GMT+0200 (Central European Summer Time)
|
|
128
|
-
</footer>
|
|
129
|
-
|
|
130
|
-
<script> prettyPrint(); </script>
|
|
131
|
-
<script src="scripts/linenumber.js"> </script>
|
|
132
|
-
</body>
|
|
133
|
-
</html>
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html lang="en">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="utf-8">
|
|
5
|
-
<title>JSDoc: Source: server/platform-server.js</title>
|
|
6
|
-
|
|
7
|
-
<script src="scripts/prettify/prettify.js"> </script>
|
|
8
|
-
<script src="scripts/prettify/lang-css.js"> </script>
|
|
9
|
-
<!--[if lt IE 9]>
|
|
10
|
-
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
|
|
11
|
-
<![endif]-->
|
|
12
|
-
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
|
|
13
|
-
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
|
|
14
|
-
</head>
|
|
15
|
-
|
|
16
|
-
<body>
|
|
17
|
-
|
|
18
|
-
<div id="main">
|
|
19
|
-
|
|
20
|
-
<h1 class="page-title">Source: server/platform-server.js</h1>
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
<section>
|
|
28
|
-
<article>
|
|
29
|
-
<pre class="prettyprint source linenums"><code>const { CaddyService } = require('./caddy')
|
|
30
|
-
const { DockerService } = require('./docker')
|
|
31
|
-
const { RestApiService } = require('./rest-api')
|
|
32
|
-
|
|
33
|
-
const { PlatformTemplateService } = require('../template')
|
|
34
|
-
const { PlatformConfigService } = require('../config')
|
|
35
|
-
const { DeploymentQueueService } = require('../deployment-queue')
|
|
36
|
-
const { logError } = require('../log')
|
|
37
|
-
|
|
38
|
-
// journalctl -u service-name.service
|
|
39
|
-
/**
|
|
40
|
-
* @class
|
|
41
|
-
*/
|
|
42
|
-
class PlatformServerService {
|
|
43
|
-
|
|
44
|
-
static start(platformTemplatesFilePath) {
|
|
45
|
-
PlatformTemplateService.readFromFile(platformTemplatesFilePath).then(([firstPlatformTemplateFound]) => {
|
|
46
|
-
const platformConfig = PlatformConfigService.from(firstPlatformTemplateFound)
|
|
47
|
-
|
|
48
|
-
RestApiService.start(platformConfig)
|
|
49
|
-
CaddyService.applyDefaultConfig(platformConfig)
|
|
50
|
-
|
|
51
|
-
DeploymentQueueService.pollForDeploymentRequests(
|
|
52
|
-
platformConfig,
|
|
53
|
-
deploymentRequest => {
|
|
54
|
-
DockerService.deploy(platformConfig, deploymentRequest)
|
|
55
|
-
CaddyService.addDeployment(platformConfig, deploymentRequest)
|
|
56
|
-
return Promise.resolve()
|
|
57
|
-
}
|
|
58
|
-
)
|
|
59
|
-
|
|
60
|
-
})
|
|
61
|
-
.catch(error => logError({ message: '[PlatformServerService] Could not start the platform server', error }))
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
module.exports = {
|
|
67
|
-
PlatformServerService
|
|
68
|
-
}
|
|
69
|
-
</code></pre>
|
|
70
|
-
</article>
|
|
71
|
-
</section>
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
</div>
|
|
77
|
-
|
|
78
|
-
<nav>
|
|
79
|
-
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="AwsCredentialsService.html">AwsCredentialsService</a></li><li><a href="AwsProfile.html">AwsProfile</a></li><li><a href="CaddyService.html">CaddyService</a></li><li><a href="ContainerServer.html">ContainerServer</a></li><li><a href="DeploymentQueueService.html">DeploymentQueueService</a></li><li><a href="DeploymentToolsService.html">DeploymentToolsService</a></li><li><a href="DockerService.html">DockerService</a></li><li><a href="EstablishTrustStack.html">EstablishTrustStack</a></li><li><a href="PlatformConfigService.html">PlatformConfigService</a></li><li><a href="PlatformDeploymentService.html">PlatformDeploymentService</a></li><li><a href="PlatformServerService.html">PlatformServerService</a></li><li><a href="PlatformStack.html">PlatformStack</a></li><li><a href="PlatformTemplateService.html">PlatformTemplateService</a></li><li><a href="RestApiService.html">RestApiService</a></li></ul><h3><a href="global.html">Global</a></h3>
|
|
80
|
-
</nav>
|
|
81
|
-
|
|
82
|
-
<br class="clear">
|
|
83
|
-
|
|
84
|
-
<footer>
|
|
85
|
-
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.11</a> on Sun Oct 23 2022 22:23:31 GMT+0200 (Central European Summer Time)
|
|
86
|
-
</footer>
|
|
87
|
-
|
|
88
|
-
<script> prettyPrint(); </script>
|
|
89
|
-
<script src="scripts/linenumber.js"> </script>
|
|
90
|
-
</body>
|
|
91
|
-
</html>
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
<!DOCTYPE html>
|
|
2
|
-
<html lang="en">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="utf-8">
|
|
5
|
-
<title>JSDoc: Source: server/rest-api.js</title>
|
|
6
|
-
|
|
7
|
-
<script src="scripts/prettify/prettify.js"> </script>
|
|
8
|
-
<script src="scripts/prettify/lang-css.js"> </script>
|
|
9
|
-
<!--[if lt IE 9]>
|
|
10
|
-
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
|
|
11
|
-
<![endif]-->
|
|
12
|
-
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
|
|
13
|
-
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
|
|
14
|
-
</head>
|
|
15
|
-
|
|
16
|
-
<body>
|
|
17
|
-
|
|
18
|
-
<div id="main">
|
|
19
|
-
|
|
20
|
-
<h1 class="page-title">Source: server/rest-api.js</h1>
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
<section>
|
|
28
|
-
<article>
|
|
29
|
-
<pre class="prettyprint source linenums"><code>const express = require('express')
|
|
30
|
-
const { logInfo } = require('../log')
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* @class
|
|
34
|
-
*/
|
|
35
|
-
class RestApiService {
|
|
36
|
-
|
|
37
|
-
static start(platformConfig) {
|
|
38
|
-
const server = express()
|
|
39
|
-
|
|
40
|
-
server.use(express.json())
|
|
41
|
-
|
|
42
|
-
server.get('/', (req, res) => {
|
|
43
|
-
res.redirect('/status')
|
|
44
|
-
})
|
|
45
|
-
|
|
46
|
-
server.get('/status', (req, res) => {
|
|
47
|
-
res.send('Server is live')
|
|
48
|
-
})
|
|
49
|
-
|
|
50
|
-
server.listen(platformConfig.ciInternalServerPort, () => {
|
|
51
|
-
logInfo({ message: `[RestApiService] API is live on port ${platformConfig.ciInternalServerPort}`})
|
|
52
|
-
})
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
module.exports = {
|
|
58
|
-
RestApiService
|
|
59
|
-
}
|
|
60
|
-
</code></pre>
|
|
61
|
-
</article>
|
|
62
|
-
</section>
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
</div>
|
|
68
|
-
|
|
69
|
-
<nav>
|
|
70
|
-
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="AwsCredentialsService.html">AwsCredentialsService</a></li><li><a href="AwsProfile.html">AwsProfile</a></li><li><a href="CaddyService.html">CaddyService</a></li><li><a href="ContainerServer.html">ContainerServer</a></li><li><a href="DeploymentQueueService.html">DeploymentQueueService</a></li><li><a href="DeploymentToolsService.html">DeploymentToolsService</a></li><li><a href="DockerService.html">DockerService</a></li><li><a href="EstablishTrustStack.html">EstablishTrustStack</a></li><li><a href="PlatformConfigService.html">PlatformConfigService</a></li><li><a href="PlatformDeploymentService.html">PlatformDeploymentService</a></li><li><a href="PlatformServerService.html">PlatformServerService</a></li><li><a href="PlatformStack.html">PlatformStack</a></li><li><a href="PlatformTemplateService.html">PlatformTemplateService</a></li><li><a href="RestApiService.html">RestApiService</a></li></ul><h3><a href="global.html">Global</a></h3>
|
|
71
|
-
</nav>
|
|
72
|
-
|
|
73
|
-
<br class="clear">
|
|
74
|
-
|
|
75
|
-
<footer>
|
|
76
|
-
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.11</a> on Sun Oct 23 2022 22:23:31 GMT+0200 (Central European Summer Time)
|
|
77
|
-
</footer>
|
|
78
|
-
|
|
79
|
-
<script> prettyPrint(); </script>
|
|
80
|
-
<script src="scripts/linenumber.js"> </script>
|
|
81
|
-
</body>
|
|
82
|
-
</html>
|