@ossy/deployment-tools 0.0.81 → 0.0.82
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/cdk.context.json
CHANGED
|
@@ -72,5 +72,9 @@
|
|
|
72
72
|
"hosted-zone:account=858451553223:domainName=oskarssylwan.se:region=eu-north-1": {
|
|
73
73
|
"Id": "/hostedzone/Z06541531WYSO7D1IVDTT",
|
|
74
74
|
"Name": "oskarssylwan.se."
|
|
75
|
+
},
|
|
76
|
+
"hosted-zone:account=858451553223:domainName=oskarssylwan.com:region=eu-north-1": {
|
|
77
|
+
"Id": "/hostedzone/Z07488011P8FXGWA11LTS",
|
|
78
|
+
"Name": "oskarssylwan.com."
|
|
75
79
|
}
|
|
76
80
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ossy/deployment-tools",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.82",
|
|
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",
|
|
@@ -41,7 +41,7 @@ class DockerService {
|
|
|
41
41
|
|
|
42
42
|
static startContainer(platformConfig, { image, containerPort, hostPort, registry, env, domain }) {
|
|
43
43
|
const imageUrl = !!registry ? `${registry}/${image}` : image
|
|
44
|
-
const envsAsString = Object.entries(env || {}).reduce((envs, [name, value]) => `${envs} --env ${name}
|
|
44
|
+
const envsAsString = Object.entries(env || {}).reduce((envs, [name, value]) => `${envs} --env ${name}="${value}"`, '')
|
|
45
45
|
logInfo({ message: `[DockerService] Starting container for ${domain} with port mapping ${hostPort}:${containerPort} and source ${imageUrl}` })
|
|
46
46
|
return exec(`docker run -d -p ${hostPort}:${containerPort} --name=${domain} --network=${platformConfig.ciDockerNetworkName} --network-alias=${domain} --rm ${envsAsString} ${imageUrl}`)
|
|
47
47
|
.catch(logErrorAndReject(`[DockerService] Could not start container ${image}`))
|
|
@@ -1,6 +1,19 @@
|
|
|
1
1
|
const { DockerService } = require('./docker-service')
|
|
2
2
|
|
|
3
|
+
const platformConfig = {
|
|
4
|
+
ciDockerNetworkName: 'foo'
|
|
5
|
+
}
|
|
3
6
|
|
|
4
|
-
|
|
5
|
-
|
|
7
|
+
const deploymentTemplate = {
|
|
8
|
+
"domain": "api.qa.ossy.se",
|
|
9
|
+
"image": "ossy-se/cms-api",
|
|
10
|
+
"targetDeploymentPlatform": "ossybot",
|
|
11
|
+
"type": "CONTAINER",
|
|
12
|
+
"hostPort": "3001",
|
|
13
|
+
"containerPort": "3000",
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
DockerService.startContainer(
|
|
17
|
+
platformConfig,
|
|
18
|
+
deploymentTemplate
|
|
6
19
|
)
|
|
@@ -10,7 +10,9 @@ const {
|
|
|
10
10
|
SecurityGroup,
|
|
11
11
|
Peer,
|
|
12
12
|
Port,
|
|
13
|
-
UserData
|
|
13
|
+
UserData,
|
|
14
|
+
BlockDevice,
|
|
15
|
+
BlockDeviceVolume
|
|
14
16
|
} = require('aws-cdk-lib/aws-ec2')
|
|
15
17
|
const { Role, ServicePrincipal, Policy, PolicyStatement, Effect } = require('aws-cdk-lib/aws-iam')
|
|
16
18
|
const { Queue } = require('aws-cdk-lib/aws-sqs')
|
|
@@ -73,7 +75,7 @@ class ContainerDeploymentTarget extends Construct {
|
|
|
73
75
|
})
|
|
74
76
|
|
|
75
77
|
const platformConfigDeployment = new BucketDeployment(this, 'PlatformConfigDeployment', {
|
|
76
|
-
sources: [Source.jsonData('platform-config.json', props.config)],
|
|
78
|
+
sources: [Source.jsonData('platform-config.json', { ...props.config, awsRoleToAssume: undefined })],
|
|
77
79
|
destinationBucket: props.bucket
|
|
78
80
|
})
|
|
79
81
|
|
|
@@ -143,11 +145,17 @@ class ContainerDeploymentTarget extends Construct {
|
|
|
143
145
|
role,
|
|
144
146
|
instanceType: InstanceType.of(
|
|
145
147
|
InstanceClass.T3,
|
|
146
|
-
InstanceSize.
|
|
148
|
+
InstanceSize.LARGE
|
|
147
149
|
),
|
|
148
150
|
machineImage: new GenericLinuxImage({
|
|
149
151
|
[SupportedRegions.North]: InstanceImages.UBUNTU
|
|
150
152
|
}),
|
|
153
|
+
blockDevices: [
|
|
154
|
+
{
|
|
155
|
+
deviceName: '/dev/sda1',
|
|
156
|
+
volume: BlockDeviceVolume.ebs(50)
|
|
157
|
+
}
|
|
158
|
+
],
|
|
151
159
|
keyName: props.config.awsKeyPairName
|
|
152
160
|
})
|
|
153
161
|
|