@ossy/deployment-tools 0.0.52 → 0.0.54
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/jsdoc/AwsCredentialsService.html +166 -0
- package/jsdoc/AwsProfile.html +166 -0
- package/jsdoc/CaddyService.html +293 -0
- package/jsdoc/ContainerServer.html +265 -0
- package/jsdoc/DeploymentQueueService.html +166 -0
- package/jsdoc/DeploymentToolsService.html +166 -0
- package/jsdoc/DockerService.html +166 -0
- package/jsdoc/EstablishTrustStack.html +268 -0
- package/jsdoc/PlatformConfigService.html +166 -0
- package/jsdoc/PlatformDeploymentService.html +166 -0
- package/jsdoc/PlatformServerService.html +166 -0
- package/jsdoc/PlatformStack.html +166 -0
- package/jsdoc/PlatformTemplateService.html +502 -0
- package/jsdoc/RestApiService.html +166 -0
- package/jsdoc/aws-credentials_aws-credentials.js.html +138 -0
- package/jsdoc/config_platform-config.js.html +113 -0
- package/jsdoc/deploy_platform-deployment.js.html +155 -0
- package/jsdoc/deployment-queue_deployment-queue.js.html +132 -0
- package/jsdoc/fonts/OpenSans-Bold-webfont.eot +0 -0
- package/jsdoc/fonts/OpenSans-Bold-webfont.svg +1830 -0
- 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 +1830 -0
- 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 +1830 -0
- 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 +1831 -0
- 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 +1835 -0
- 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 +1831 -0
- package/jsdoc/fonts/OpenSans-Regular-webfont.woff +0 -0
- package/jsdoc/global.html +800 -0
- package/jsdoc/index.html +65 -0
- package/jsdoc/infrastructure_container-server_aws-profile.js.html +76 -0
- package/jsdoc/infrastructure_container-server_caddy.service.js.html +123 -0
- package/jsdoc/infrastructure_container-server_container-server.js.html +229 -0
- package/jsdoc/infrastructure_container-server_deployment-tools.service.js.html +91 -0
- package/jsdoc/infrastructure_establish-trust-stack.js.html +119 -0
- package/jsdoc/infrastructure_platform-stack.js.html +107 -0
- package/jsdoc/scripts/linenumber.js +25 -0
- package/jsdoc/scripts/prettify/Apache-License-2.0.txt +202 -0
- package/jsdoc/scripts/prettify/lang-css.js +2 -0
- package/jsdoc/scripts/prettify/prettify.js +28 -0
- package/jsdoc/server_caddy.js.html +165 -0
- package/{src/server/docker.js → jsdoc/server_docker.js.html} +55 -1
- package/jsdoc/server_platform-server.js.html +91 -0
- package/jsdoc/server_rest-api.js.html +82 -0
- package/jsdoc/styles/jsdoc-default.css +358 -0
- package/jsdoc/styles/prettify-jsdoc.css +111 -0
- package/jsdoc/styles/prettify-tomorrow.css +132 -0
- package/jsdoc/template_platform-template.js.html +134 -0
- package/jsdoc.config.js +8 -12
- package/package.json +8 -7
- package/src/aws-credentials/aws-credentials.js +3 -0
- package/src/config/platform-config.js +9 -0
- package/src/deploy/platform-deployment.js +30 -0
- package/src/deployment-queue/deployment-queue.js +3 -0
- package/src/docker/docker-service.js +91 -0
- package/src/docker/docker-service.playground.js +17 -0
- package/src/docker/index.js +1 -0
- package/src/infrastructure/container-server/aws-profile.js +3 -0
- package/src/infrastructure/container-server/caddy.service.js +3 -0
- package/src/infrastructure/container-server/container-server.js +4 -0
- package/src/infrastructure/container-server/deployment-tools.service.js +3 -0
- package/src/infrastructure/establish-trust-stack.js +3 -0
- package/src/infrastructure/platform-stack.js +6 -2
- package/src/server/caddy.js +3 -0
- package/src/server/platform-server.js +6 -3
- package/src/server/rest-api.js +3 -0
- package/src/template/platform-template.js +24 -9
- package/src/types.js +0 -32
package/jsdoc/index.html
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8">
|
|
5
|
+
<title>JSDoc: Home</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">Home</h1>
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
<h3> </h3>
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
</div>
|
|
51
|
+
|
|
52
|
+
<nav>
|
|
53
|
+
<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>
|
|
54
|
+
</nav>
|
|
55
|
+
|
|
56
|
+
<br class="clear">
|
|
57
|
+
|
|
58
|
+
<footer>
|
|
59
|
+
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)
|
|
60
|
+
</footer>
|
|
61
|
+
|
|
62
|
+
<script> prettyPrint(); </script>
|
|
63
|
+
<script src="scripts/linenumber.js"> </script>
|
|
64
|
+
</body>
|
|
65
|
+
</html>
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8">
|
|
5
|
+
<title>JSDoc: Source: infrastructure/container-server/aws-profile.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: infrastructure/container-server/aws-profile.js</h1>
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
<section>
|
|
28
|
+
<article>
|
|
29
|
+
<pre class="prettyprint source linenums"><code>/**
|
|
30
|
+
* @class
|
|
31
|
+
*/
|
|
32
|
+
class AwsProfile {
|
|
33
|
+
|
|
34
|
+
static writeFile(roleArn, region) {
|
|
35
|
+
|
|
36
|
+
const awsProfileFile = `
|
|
37
|
+
[profile ci-client]
|
|
38
|
+
role_arn = ${roleArn}
|
|
39
|
+
credential_source = Ec2InstanceMetadata
|
|
40
|
+
region = ${region}
|
|
41
|
+
`
|
|
42
|
+
return [
|
|
43
|
+
'sudo mkdir /home/caddy',
|
|
44
|
+
'sudo mkdir /home/caddy/.aws',
|
|
45
|
+
`sudo echo "${awsProfileFile}" >> /home/caddy/.aws/credentials`
|
|
46
|
+
]
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
module.exports = {
|
|
52
|
+
AwsProfile
|
|
53
|
+
}
|
|
54
|
+
</code></pre>
|
|
55
|
+
</article>
|
|
56
|
+
</section>
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
</div>
|
|
62
|
+
|
|
63
|
+
<nav>
|
|
64
|
+
<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>
|
|
65
|
+
</nav>
|
|
66
|
+
|
|
67
|
+
<br class="clear">
|
|
68
|
+
|
|
69
|
+
<footer>
|
|
70
|
+
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)
|
|
71
|
+
</footer>
|
|
72
|
+
|
|
73
|
+
<script> prettyPrint(); </script>
|
|
74
|
+
<script src="scripts/linenumber.js"> </script>
|
|
75
|
+
</body>
|
|
76
|
+
</html>
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8">
|
|
5
|
+
<title>JSDoc: Source: infrastructure/container-server/caddy.service.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: infrastructure/container-server/caddy.service.js</h1>
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
<section>
|
|
28
|
+
<article>
|
|
29
|
+
<pre class="prettyprint source linenums"><code>const systemdServiceFile = `
|
|
30
|
+
# caddy-api.service
|
|
31
|
+
#
|
|
32
|
+
# For using Caddy with its API.
|
|
33
|
+
#
|
|
34
|
+
# This unit is "durable" in that it will automatically resume
|
|
35
|
+
# the last active configuration if the service is restarted.
|
|
36
|
+
#
|
|
37
|
+
# See https://caddyserver.com/docs/install for instructions.
|
|
38
|
+
|
|
39
|
+
[Unit]
|
|
40
|
+
Description=Caddy
|
|
41
|
+
Documentation=https://caddyserver.com/docs/
|
|
42
|
+
After=network.target network-online.target
|
|
43
|
+
Requires=network-online.target
|
|
44
|
+
|
|
45
|
+
[Service]
|
|
46
|
+
Type=notify
|
|
47
|
+
User=caddy
|
|
48
|
+
Group=caddy
|
|
49
|
+
ExecStart=/usr/bin/caddy.route53 run --environ --resume
|
|
50
|
+
TimeoutStopSec=5s
|
|
51
|
+
LimitNOFILE=1048576
|
|
52
|
+
LimitNPROC=512
|
|
53
|
+
PrivateTmp=true
|
|
54
|
+
ProtectSystem=full
|
|
55
|
+
AmbientCapabilities=CAP_NET_BIND_SERVICE
|
|
56
|
+
|
|
57
|
+
[Install]
|
|
58
|
+
WantedBy=multi-user.target cloud-init.target
|
|
59
|
+
`
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* @class
|
|
63
|
+
*/
|
|
64
|
+
class CaddyService {
|
|
65
|
+
|
|
66
|
+
static install() {
|
|
67
|
+
return [
|
|
68
|
+
`sudo echo "${systemdServiceFile}" >> /etc/systemd/system/caddy-route53.service`,
|
|
69
|
+
'sudo apt install -y debian-keyring debian-archive-keyring apt-transport-https',
|
|
70
|
+
'sudo curl -1sLf \'https://dl.cloudsmith.io/public/caddy/stable/gpg.key\' | sudo gpg --dearmor -o /usr/share/keyrings/caddy-stable-archive-keyring.gpg',
|
|
71
|
+
'sudo curl -1sLf \'https://dl.cloudsmith.io/public/caddy/stable/debian.deb.txt\' | sudo tee /etc/apt/sources.list.d/caddy-stable.list',
|
|
72
|
+
'sudo curl -1sLf \'https://dl.cloudsmith.io/public/caddy/xcaddy/gpg.key\' | sudo gpg --dearmor -o /usr/share/keyrings/caddy-xcaddy-archive-keyring.gpg',
|
|
73
|
+
'sudo curl -1sLf \'https://dl.cloudsmith.io/public/caddy/xcaddy/debian.deb.txt\' | sudo tee /etc/apt/sources.list.d/caddy-xcaddy.list',
|
|
74
|
+
'sudo add-apt-repository ppa:longsleep/golang-backports -y',
|
|
75
|
+
'sudo apt update',
|
|
76
|
+
'sudo apt install caddy xcaddy golang-go -y',
|
|
77
|
+
'sudo xcaddy build --with github.com/caddy-dns/route53',
|
|
78
|
+
'sudo mv ./caddy /usr/bin/caddy.route53'
|
|
79
|
+
]
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
static enable() {
|
|
83
|
+
return [
|
|
84
|
+
'sudo systemctl disable caddy.service',
|
|
85
|
+
'sudo systemctl enable caddy-route53.service'
|
|
86
|
+
]
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
static start() {
|
|
90
|
+
return [
|
|
91
|
+
'sudo systemctl stop caddy.service',
|
|
92
|
+
'sudo systemctl start caddy-route53.service'
|
|
93
|
+
]
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
module.exports = {
|
|
99
|
+
CaddyService
|
|
100
|
+
}
|
|
101
|
+
</code></pre>
|
|
102
|
+
</article>
|
|
103
|
+
</section>
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
</div>
|
|
109
|
+
|
|
110
|
+
<nav>
|
|
111
|
+
<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>
|
|
112
|
+
</nav>
|
|
113
|
+
|
|
114
|
+
<br class="clear">
|
|
115
|
+
|
|
116
|
+
<footer>
|
|
117
|
+
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)
|
|
118
|
+
</footer>
|
|
119
|
+
|
|
120
|
+
<script> prettyPrint(); </script>
|
|
121
|
+
<script src="scripts/linenumber.js"> </script>
|
|
122
|
+
</body>
|
|
123
|
+
</html>
|
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8">
|
|
5
|
+
<title>JSDoc: Source: infrastructure/container-server/container-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: infrastructure/container-server/container-server.js</h1>
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
<section>
|
|
28
|
+
<article>
|
|
29
|
+
<pre class="prettyprint source linenums"><code>const { CfnOutput } = require('aws-cdk-lib')
|
|
30
|
+
const { Construct } = require('constructs')
|
|
31
|
+
const {
|
|
32
|
+
Instance,
|
|
33
|
+
InstanceType,
|
|
34
|
+
InstanceClass,
|
|
35
|
+
InstanceSize,
|
|
36
|
+
GenericLinuxImage,
|
|
37
|
+
Vpc,
|
|
38
|
+
SecurityGroup,
|
|
39
|
+
Peer,
|
|
40
|
+
Port,
|
|
41
|
+
UserData
|
|
42
|
+
} = require('aws-cdk-lib/aws-ec2')
|
|
43
|
+
const { HostedZone, ARecord, RecordTarget } = require('aws-cdk-lib/aws-route53')
|
|
44
|
+
const { Role, ServicePrincipal, Policy, PolicyStatement, Effect } = require('aws-cdk-lib/aws-iam')
|
|
45
|
+
const {
|
|
46
|
+
getInstallNodeJs,
|
|
47
|
+
getInstallNpm,
|
|
48
|
+
getInstallDocker
|
|
49
|
+
} = require('./user-data-commands')
|
|
50
|
+
const { CaddyService } = require('./caddy.service')
|
|
51
|
+
const { DeploymentToolsService } = require('./deployment-tools.service')
|
|
52
|
+
const { AwsProfile } = require('./aws-profile')
|
|
53
|
+
const { SupportedRegions } = require('../../config')
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Platform template definition
|
|
57
|
+
* @namespace ContainerServer
|
|
58
|
+
* @typedef {Object} ContainerServerProps
|
|
59
|
+
* @property {PlatformConfig} platformConfig - platform config
|
|
60
|
+
* @property {Bucket} platformConfigBucket - aws bucket
|
|
61
|
+
*/
|
|
62
|
+
const InstanceImages = {
|
|
63
|
+
UBUNTU: 'ami-092cce4a19b438926'
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* @class
|
|
68
|
+
*/
|
|
69
|
+
class ContainerServer extends Construct {
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* EC2 Instance that docker containers are served on
|
|
73
|
+
*
|
|
74
|
+
* @param {object} scope - scope
|
|
75
|
+
* @param {string} id - id
|
|
76
|
+
* @param {ContainerServerProps} props - ContainerServerProps
|
|
77
|
+
*/
|
|
78
|
+
constructor(scope, id, props) {
|
|
79
|
+
super(scope, id)
|
|
80
|
+
|
|
81
|
+
const hostedZone = HostedZone.fromLookup(this, 'HostedZone', { domainName: props.platformConfig.domain })
|
|
82
|
+
|
|
83
|
+
const vpc = Vpc.fromLookup(this, 'VPC', {
|
|
84
|
+
isDefault: true
|
|
85
|
+
})
|
|
86
|
+
|
|
87
|
+
const securityGroup = new SecurityGroup(this, 'SecurityGroup', {
|
|
88
|
+
vpc,
|
|
89
|
+
allowAllOutbound: true
|
|
90
|
+
})
|
|
91
|
+
|
|
92
|
+
securityGroup.addIngressRule(
|
|
93
|
+
Peer.anyIpv4(),
|
|
94
|
+
Port.tcp(22),
|
|
95
|
+
'allow SSH access from anywhere'
|
|
96
|
+
)
|
|
97
|
+
|
|
98
|
+
securityGroup.addIngressRule(
|
|
99
|
+
Peer.anyIpv4(),
|
|
100
|
+
Port.tcp(80),
|
|
101
|
+
'allow HTTP traffic from anywhere'
|
|
102
|
+
)
|
|
103
|
+
|
|
104
|
+
securityGroup.addIngressRule(
|
|
105
|
+
Peer.anyIpv4(),
|
|
106
|
+
Port.tcp(443),
|
|
107
|
+
'allow HTTPS traffic from anywhere'
|
|
108
|
+
)
|
|
109
|
+
|
|
110
|
+
const role = new Role(this, 'role', {
|
|
111
|
+
assumedBy: new ServicePrincipal('ec2.amazonaws.com')
|
|
112
|
+
})
|
|
113
|
+
|
|
114
|
+
role.attachInlinePolicy(new Policy(this, 'policy', {
|
|
115
|
+
statements: [
|
|
116
|
+
new PolicyStatement({
|
|
117
|
+
effect: Effect.ALLOW,
|
|
118
|
+
actions: [
|
|
119
|
+
'route53:ListResourceRecordSets',
|
|
120
|
+
'route53:GetChange',
|
|
121
|
+
'route53:ChangeResourceRecordSets'
|
|
122
|
+
],
|
|
123
|
+
resources: [
|
|
124
|
+
`arn:aws:route53:::hostedzone/${hostedZone.hostedZoneId}`,
|
|
125
|
+
'arn:aws:route53:::change/*'
|
|
126
|
+
]
|
|
127
|
+
}),
|
|
128
|
+
new PolicyStatement({
|
|
129
|
+
effect: Effect.ALLOW,
|
|
130
|
+
actions: [
|
|
131
|
+
'route53:ListHostedZonesByName',
|
|
132
|
+
'route53:ListHostedZones'
|
|
133
|
+
],
|
|
134
|
+
resources: ['*']
|
|
135
|
+
})
|
|
136
|
+
]
|
|
137
|
+
}))
|
|
138
|
+
|
|
139
|
+
const userData = UserData.forLinux()
|
|
140
|
+
|
|
141
|
+
userData.addCommands(
|
|
142
|
+
'sudo apt update -y',
|
|
143
|
+
...getInstallNodeJs(),
|
|
144
|
+
...getInstallNpm(),
|
|
145
|
+
...getInstallDocker(),
|
|
146
|
+
'sudo apt-get install awscli --yes',
|
|
147
|
+
...AwsProfile.writeFile(role.roleArn, SupportedRegions.North),
|
|
148
|
+
...CaddyService.install(),
|
|
149
|
+
...DeploymentToolsService.install()
|
|
150
|
+
)
|
|
151
|
+
|
|
152
|
+
userData.addS3DownloadCommand({
|
|
153
|
+
bucket: props.platformConfigBucket,
|
|
154
|
+
bucketKey: 'platform-config.json',
|
|
155
|
+
localFile: '/home/ubuntu/platform-config.json'
|
|
156
|
+
})
|
|
157
|
+
|
|
158
|
+
userData.addCommands(
|
|
159
|
+
'sudo systemctl daemon-reload',
|
|
160
|
+
...CaddyService.enable(),
|
|
161
|
+
...DeploymentToolsService.enable(),
|
|
162
|
+
...CaddyService.start(),
|
|
163
|
+
...DeploymentToolsService.start()
|
|
164
|
+
)
|
|
165
|
+
|
|
166
|
+
const ec2Instance = new Instance(this, 'Ec2Instance', {
|
|
167
|
+
vpc,
|
|
168
|
+
securityGroup,
|
|
169
|
+
userData,
|
|
170
|
+
role,
|
|
171
|
+
instanceType: InstanceType.of(
|
|
172
|
+
InstanceClass.T3,
|
|
173
|
+
InstanceSize.MICRO
|
|
174
|
+
),
|
|
175
|
+
machineImage: new GenericLinuxImage({
|
|
176
|
+
[SupportedRegions.North]: InstanceImages.UBUNTU
|
|
177
|
+
}),
|
|
178
|
+
keyName: props.platformConfig.awsKeyPairName
|
|
179
|
+
})
|
|
180
|
+
|
|
181
|
+
props.platformConfigBucket.grantRead(ec2Instance, '*')
|
|
182
|
+
|
|
183
|
+
// const hostedZone = !!props.createNewHostedZone
|
|
184
|
+
// ? new PublicHostedZone(this, 'HostedZone', { zoneName: props.domain })
|
|
185
|
+
// : HostedZone.fromLookup(this, 'HostedZone', { domainName: props.domain });
|
|
186
|
+
|
|
187
|
+
// eslint-disable-next-line no-new
|
|
188
|
+
new ARecord(this, 'WildcardRecord', {
|
|
189
|
+
zone: hostedZone,
|
|
190
|
+
recordName: `*.${props.platformConfig.activeEnvironment}.${props.platformConfig.domain}`,
|
|
191
|
+
target: RecordTarget.fromIpAddresses(ec2Instance.instancePublicIp)
|
|
192
|
+
})
|
|
193
|
+
|
|
194
|
+
// eslint-disable-next-line no-new
|
|
195
|
+
new CfnOutput(this, 'Intance Ip', {
|
|
196
|
+
value: ec2Instance.instancePublicIp,
|
|
197
|
+
description: 'Public ip of the ec2 instance',
|
|
198
|
+
exportName: 'instanceIp'
|
|
199
|
+
})
|
|
200
|
+
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
module.exports = {
|
|
205
|
+
ContainerServer
|
|
206
|
+
}
|
|
207
|
+
</code></pre>
|
|
208
|
+
</article>
|
|
209
|
+
</section>
|
|
210
|
+
|
|
211
|
+
|
|
212
|
+
|
|
213
|
+
|
|
214
|
+
</div>
|
|
215
|
+
|
|
216
|
+
<nav>
|
|
217
|
+
<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>
|
|
218
|
+
</nav>
|
|
219
|
+
|
|
220
|
+
<br class="clear">
|
|
221
|
+
|
|
222
|
+
<footer>
|
|
223
|
+
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)
|
|
224
|
+
</footer>
|
|
225
|
+
|
|
226
|
+
<script> prettyPrint(); </script>
|
|
227
|
+
<script src="scripts/linenumber.js"> </script>
|
|
228
|
+
</body>
|
|
229
|
+
</html>
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8">
|
|
5
|
+
<title>JSDoc: Source: infrastructure/container-server/deployment-tools.service.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: infrastructure/container-server/deployment-tools.service.js</h1>
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
<section>
|
|
28
|
+
<article>
|
|
29
|
+
<pre class="prettyprint source linenums"><code>const systemdServiceFile = `
|
|
30
|
+
[Unit]
|
|
31
|
+
Description=D
|
|
32
|
+
After=network.target caddy-route53.service
|
|
33
|
+
|
|
34
|
+
[Service]
|
|
35
|
+
EnvironmentFile=/etc/environment
|
|
36
|
+
User=caddy
|
|
37
|
+
Group=caddy
|
|
38
|
+
AmbientCapabilities=CAP_NET_BIND_SERVICE
|
|
39
|
+
CapabilityBoundingSet=CAP_NET_BIND_SERVICE
|
|
40
|
+
ExecStart=/usr/bin/npx --yes @ossy/deployment-tools server start --platforms /home/ubuntu/platform-config.json
|
|
41
|
+
Restart=on-failure
|
|
42
|
+
|
|
43
|
+
[Install]
|
|
44
|
+
WantedBy=multi-user.target cloud-init.target
|
|
45
|
+
`
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* @class
|
|
49
|
+
*/
|
|
50
|
+
class DeploymentToolsService {
|
|
51
|
+
|
|
52
|
+
static install() {
|
|
53
|
+
return [`sudo echo "${systemdServiceFile}" >> /etc/systemd/system/deployment-tools.service`]
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
static enable() {
|
|
57
|
+
return ['sudo systemctl enable deployment-tools.service']
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
static start() {
|
|
61
|
+
return ['sudo systemctl start deployment-tools.service']
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
module.exports = {
|
|
67
|
+
DeploymentToolsService
|
|
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>
|