@ossy/deployment-tools 0.0.88 → 0.0.90
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ossy/deployment-tools",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.90",
|
|
4
4
|
"description": "Collection of scripts and tools to aid deployment of containers and static files to Amazon Web Services through GitHub Actions",
|
|
5
5
|
"source": "./src/index.js",
|
|
6
6
|
"main": "./src/index.js",
|
package/src/caddy/caddy.js
CHANGED
|
@@ -60,6 +60,7 @@ class CaddyService {
|
|
|
60
60
|
}
|
|
61
61
|
|
|
62
62
|
static getProxyConfig(containerDeploymentTemplate) {
|
|
63
|
+
logInfo({ message: `[CaddyService] Checking if a proxy for ${containerDeploymentTemplate.domain} exists` })
|
|
63
64
|
return fetch(`http://localhost:2019/id/${containerDeploymentTemplate.domain}`, {
|
|
64
65
|
method: 'GET',
|
|
65
66
|
headers: { 'Content-Type': 'application/json' }
|
|
@@ -73,6 +74,7 @@ class CaddyService {
|
|
|
73
74
|
}
|
|
74
75
|
|
|
75
76
|
static applyProxyConfig(containerDeploymentTemplate) {
|
|
77
|
+
|
|
76
78
|
return CaddyService.getProxyConfig(containerDeploymentTemplate)
|
|
77
79
|
.then(proxyConfig => {
|
|
78
80
|
proxyConfig
|
|
@@ -82,6 +84,7 @@ class CaddyService {
|
|
|
82
84
|
}
|
|
83
85
|
|
|
84
86
|
static addProxyConfig(containerDeploymentTemplate) {
|
|
87
|
+
logInfo({ message: `[CaddyService] Adding proxy for ${containerDeploymentTemplate.domain}` })
|
|
85
88
|
const proxyConfig = CaddyConfigService.createProxyConfig(containerDeploymentTemplate)
|
|
86
89
|
return fetch('http://localhost:2019/config/apps/http/servers/deployment-tools/routes', {
|
|
87
90
|
method: 'POST',
|
|
@@ -93,6 +96,7 @@ class CaddyService {
|
|
|
93
96
|
}
|
|
94
97
|
|
|
95
98
|
static replaceProxyConfig(containerDeploymentTemplate) {
|
|
99
|
+
logInfo({ message: `[CaddyService] Replacing proxy for ${containerDeploymentTemplate.domain}` })
|
|
96
100
|
const proxyConfig = CaddyConfigService.createProxyConfig(containerDeploymentTemplate)
|
|
97
101
|
return fetch(`http://localhost:2019/id/${containerDeploymentTemplate.domain}`, {
|
|
98
102
|
method: 'POST',
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"apps":{"http":{"servers":{"deployment-tools":{"listen":[":443"],"routes":[{"@id":"cms.qa.ossy.se","handle":[{"handler":"subroute","routes":[{"handle":[{"handler":"reverse_proxy","upstreams":[{"dial":"localhost:3015"}]}]}]}],"match":[{"host":["cms.qa.ossy.se"]}]},{"@id":"www.plexus-sanitas.com","handle":[{"handler":"subroute","routes":[{"handle":[{"handler":"reverse_proxy","upstreams":[{"dial":"localhost:3000"}]}]}]}],"match":[{"host":["www.plexus-sanitas.com"]}]},{"@id":"www.plexus-sanitas.com","handle":[{"handler":"subroute","routes":[{"handle":[{"handler":"reverse_proxy","upstreams":[{"dial":"localhost:3016"}]}]}]}],"match":[{"host":["www.plexus-sanitas.com"]}]}]}}},"tls":{"automation":{"policies":[{"issuers":[{"challenges":{"dns":{"provider":{"aws_profile":"ci-client","max_retries":10,"name":"route53"}}},"module":"acme"},{"challenges":{"dns":{"provider":{"max_retries":10,"name":"route53"}}},"module":"zerossl"}],"subjects":["cms.qa.ossy.se","www.plexus-sanitas.com"]}]}}}}
|
|
@@ -27,7 +27,7 @@ class DockerService {
|
|
|
27
27
|
|
|
28
28
|
static stopContainer(deploymentRequest) {
|
|
29
29
|
logInfo({ message: `[DockerService] Stopping container for ${deploymentRequest.domain}` })
|
|
30
|
-
return exec(`docker stop
|
|
30
|
+
return exec(`docker stop c-${deploymentRequest.domain}`)
|
|
31
31
|
.catch(() => {}) // no worries if container isn't there
|
|
32
32
|
}
|
|
33
33
|
|
|
@@ -53,7 +53,7 @@ class DockerService {
|
|
|
53
53
|
return DockerService.getUnusedPort()
|
|
54
54
|
.then(hostPort => {
|
|
55
55
|
logInfo({ message: `[DockerService] Starting container for ${domain} with port mapping ${hostPort}:${containerPort} and source ${imageUrl}` })
|
|
56
|
-
return exec(`docker run -d -p ${hostPort}:${containerPort} --name
|
|
56
|
+
return exec(`docker run -d -p ${hostPort}:${containerPort} --name=c-${domain} --network=${platformConfig.ciDockerNetworkName} --network-alias=c-${domain} --rm ${envsAsString} ${imageUrl}`)
|
|
57
57
|
.then(() => ({ hostPort }))
|
|
58
58
|
.catch(logErrorAndReject(`[DockerService] Could not start container ${image}`))
|
|
59
59
|
})
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
/* eslint-disable no-new */
|
|
3
|
-
const { App
|
|
3
|
+
const { App } = require('aws-cdk-lib')
|
|
4
4
|
const { TrustCiStack } = require('./trust-ci-stack')
|
|
5
5
|
const { DeploymentTargetStack } = require('./deployment-target-stack')
|
|
6
6
|
const { DnsStack } = require('./dns-stack')
|
|
7
7
|
const { PlatformTemplateService, DeploymentTemplateService } = require('../template')
|
|
8
8
|
const { PlatformConfigService } = require('../config')
|
|
9
|
-
const { PlatformDeploymentService } = require('../deploy')
|
|
10
9
|
|
|
11
10
|
Promise.all([
|
|
12
11
|
DeploymentTemplateService.readFromFiles(process.env.DEPLOYMENTS),
|