@ossy/deployment-tools 0.0.53 → 0.0.55

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.
Files changed (76) hide show
  1. package/jsdoc/AwsCredentialsService.html +166 -0
  2. package/jsdoc/AwsProfile.html +166 -0
  3. package/jsdoc/CaddyService.html +293 -0
  4. package/jsdoc/ContainerServer.html +265 -0
  5. package/jsdoc/DeploymentQueueService.html +166 -0
  6. package/jsdoc/DeploymentToolsService.html +166 -0
  7. package/jsdoc/DockerService.html +166 -0
  8. package/jsdoc/EstablishTrustStack.html +268 -0
  9. package/jsdoc/PlatformConfigService.html +166 -0
  10. package/jsdoc/PlatformDeploymentService.html +166 -0
  11. package/jsdoc/PlatformServerService.html +166 -0
  12. package/jsdoc/PlatformStack.html +166 -0
  13. package/jsdoc/PlatformTemplateService.html +502 -0
  14. package/jsdoc/RestApiService.html +166 -0
  15. package/jsdoc/aws-credentials_aws-credentials.js.html +138 -0
  16. package/jsdoc/config_platform-config.js.html +113 -0
  17. package/jsdoc/deploy_platform-deployment.js.html +155 -0
  18. package/jsdoc/deployment-queue_deployment-queue.js.html +132 -0
  19. package/jsdoc/fonts/OpenSans-Bold-webfont.eot +0 -0
  20. package/jsdoc/fonts/OpenSans-Bold-webfont.svg +1830 -0
  21. package/jsdoc/fonts/OpenSans-Bold-webfont.woff +0 -0
  22. package/jsdoc/fonts/OpenSans-BoldItalic-webfont.eot +0 -0
  23. package/jsdoc/fonts/OpenSans-BoldItalic-webfont.svg +1830 -0
  24. package/jsdoc/fonts/OpenSans-BoldItalic-webfont.woff +0 -0
  25. package/jsdoc/fonts/OpenSans-Italic-webfont.eot +0 -0
  26. package/jsdoc/fonts/OpenSans-Italic-webfont.svg +1830 -0
  27. package/jsdoc/fonts/OpenSans-Italic-webfont.woff +0 -0
  28. package/jsdoc/fonts/OpenSans-Light-webfont.eot +0 -0
  29. package/jsdoc/fonts/OpenSans-Light-webfont.svg +1831 -0
  30. package/jsdoc/fonts/OpenSans-Light-webfont.woff +0 -0
  31. package/jsdoc/fonts/OpenSans-LightItalic-webfont.eot +0 -0
  32. package/jsdoc/fonts/OpenSans-LightItalic-webfont.svg +1835 -0
  33. package/jsdoc/fonts/OpenSans-LightItalic-webfont.woff +0 -0
  34. package/jsdoc/fonts/OpenSans-Regular-webfont.eot +0 -0
  35. package/jsdoc/fonts/OpenSans-Regular-webfont.svg +1831 -0
  36. package/jsdoc/fonts/OpenSans-Regular-webfont.woff +0 -0
  37. package/jsdoc/global.html +800 -0
  38. package/jsdoc/index.html +65 -0
  39. package/jsdoc/infrastructure_container-server_aws-profile.js.html +76 -0
  40. package/jsdoc/infrastructure_container-server_caddy.service.js.html +123 -0
  41. package/jsdoc/infrastructure_container-server_container-server.js.html +229 -0
  42. package/jsdoc/infrastructure_container-server_deployment-tools.service.js.html +91 -0
  43. package/jsdoc/infrastructure_establish-trust-stack.js.html +119 -0
  44. package/jsdoc/infrastructure_platform-stack.js.html +107 -0
  45. package/jsdoc/scripts/linenumber.js +25 -0
  46. package/jsdoc/scripts/prettify/Apache-License-2.0.txt +202 -0
  47. package/jsdoc/scripts/prettify/lang-css.js +2 -0
  48. package/jsdoc/scripts/prettify/prettify.js +28 -0
  49. package/jsdoc/server_caddy.js.html +165 -0
  50. package/{src/server/docker.js → jsdoc/server_docker.js.html} +55 -1
  51. package/jsdoc/server_platform-server.js.html +91 -0
  52. package/jsdoc/server_rest-api.js.html +82 -0
  53. package/jsdoc/styles/jsdoc-default.css +358 -0
  54. package/jsdoc/styles/prettify-jsdoc.css +111 -0
  55. package/jsdoc/styles/prettify-tomorrow.css +132 -0
  56. package/jsdoc/template_platform-template.js.html +134 -0
  57. package/package.json +7 -6
  58. package/src/aws-credentials/aws-credentials.js +3 -0
  59. package/src/config/platform-config.js +9 -0
  60. package/src/deploy/platform-deployment.js +30 -0
  61. package/src/deployment-queue/deployment-queue.js +6 -3
  62. package/src/docker/docker-service.js +62 -0
  63. package/src/docker/docker-service.playground.js +17 -0
  64. package/src/docker/index.js +1 -0
  65. package/src/infrastructure/container-server/aws-profile.js +3 -0
  66. package/src/infrastructure/container-server/caddy.service.js +3 -0
  67. package/src/infrastructure/container-server/container-server.js +7 -0
  68. package/src/infrastructure/container-server/deployment-tools.service.js +5 -2
  69. package/src/infrastructure/establish-trust-stack.js +3 -0
  70. package/src/infrastructure/platform-stack.js +6 -2
  71. package/src/log.js +1 -1
  72. package/src/server/caddy.js +3 -0
  73. package/src/server/platform-server.js +5 -2
  74. package/src/server/rest-api.js +3 -0
  75. package/src/template/platform-template.js +24 -9
  76. package/src/types.js +0 -32
@@ -0,0 +1,165 @@
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,9 +1,40 @@
1
- const { exec } = require('child_process')
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')
2
30
  const fs = require('fs')
3
31
  const { nanoid } = require('nanoid')
4
32
 
5
33
  const { logInfo, logError } = require('../log')
6
34
 
35
+ /**
36
+ * @class
37
+ */
7
38
  class DockerService {
8
39
 
9
40
  static createDockerNetworkForContainerManagerServer(platformConfig) {
@@ -77,3 +108,26 @@ ${DockerService.startContainer(platformConfig, deploymentRequest)}`
77
108
  module.exports = {
78
109
  DockerService
79
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>
@@ -0,0 +1,91 @@
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>
@@ -0,0 +1,82 @@
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>