@ossy/deployment-tools 1.19.0 → 1.20.1
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 +22 -0
- package/README.md +129 -34
- package/package.json +2 -6
- package/src/config/platform-config.js +18 -4
- package/src/infrastructure/cli.js +2 -18
- package/src/infrastructure/container-deployment-target/caddy.service.js +22 -29
- package/src/infrastructure/container-deployment-target/container-deployment-target.js +56 -17
- package/src/infrastructure/container-deployment-target/container-service.js +163 -0
- package/src/infrastructure/deployment-target-stack.js +29 -76
- package/src/infrastructure/platform-stage.js +40 -0
- package/src/infrastructure/storage-static-stack.js +87 -0
- package/src/template/platform-template.js +0 -3
- package/src/aws-credentials/aws-credentials.js +0 -87
- package/src/aws-credentials/cli.js +0 -55
- package/src/aws-credentials/index.js +0 -1
- package/src/index.cli.js +0 -11
- package/src/infrastructure/container-deployment-target/ossy-website-ossy.service.js +0 -52
- package/src/infrastructure/container-deployment-target/ossy-website-plexus-sanitas.service.js +0 -52
- package/src/infrastructure/trust-ci-stack.js +0 -76
- package/src/template/cli.js +0 -24
package/src/infrastructure/container-deployment-target/ossy-website-plexus-sanitas.service.js
DELETED
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
// TODO: remove this service once www.plexus-sanitas.com traffic flows through the platform runtime.
|
|
2
|
-
// The platform runtime (ghcr.io/ossy-se/platform) is the long-term host for all
|
|
3
|
-
// tenant sites including plexus-sanitas. This service is a stopgap while the CMS-based
|
|
4
|
-
// publish flow is validated in production.
|
|
5
|
-
|
|
6
|
-
const systemdServiceFile = `
|
|
7
|
-
[Unit]
|
|
8
|
-
Description=Ossy Website (www.plexus-sanitas.com)
|
|
9
|
-
After=network.target docker.service
|
|
10
|
-
Requires=docker.service
|
|
11
|
-
|
|
12
|
-
[Service]
|
|
13
|
-
EnvironmentFile=/etc/environment
|
|
14
|
-
ExecStartPre=-/usr/bin/docker rm -f ossy-website-plexus-sanitas
|
|
15
|
-
ExecStartPre=/usr/bin/docker pull ghcr.io/ossy-se/website-plexus-sanitas:latest
|
|
16
|
-
ExecStart=/usr/bin/docker run --name ossy-website-plexus-sanitas \\
|
|
17
|
-
--network ossy-network \\
|
|
18
|
-
-p 3003:3000 \\
|
|
19
|
-
-e PORT=3000 \\
|
|
20
|
-
-e OSSY_API_URL=http://ossy-api:3001 \\
|
|
21
|
-
-e OSSY_COOKIE_SECRET=\${OSSY_COOKIE_SECRET} \\
|
|
22
|
-
ghcr.io/ossy-se/website-plexus-sanitas:latest
|
|
23
|
-
ExecStop=/usr/bin/docker stop ossy-website-plexus-sanitas
|
|
24
|
-
Restart=on-failure
|
|
25
|
-
RestartSec=5
|
|
26
|
-
|
|
27
|
-
[Install]
|
|
28
|
-
WantedBy=multi-user.target
|
|
29
|
-
`
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* @class
|
|
33
|
-
*/
|
|
34
|
-
class OssyWebsitePlexusSanitasService {
|
|
35
|
-
|
|
36
|
-
static install() {
|
|
37
|
-
return [`sudo tee /etc/systemd/system/ossy-website-plexus-sanitas.service > /dev/null << 'EOF'\n${systemdServiceFile}\nEOF`]
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
static enable() {
|
|
41
|
-
return ['sudo systemctl enable ossy-website-plexus-sanitas']
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
static start() {
|
|
45
|
-
return ['sudo systemctl start ossy-website-plexus-sanitas']
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
module.exports = {
|
|
51
|
-
OssyWebsitePlexusSanitasService
|
|
52
|
-
}
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
const { Stack, Duration, CfnOutput } = require('aws-cdk-lib')
|
|
2
|
-
const {
|
|
3
|
-
OpenIdConnectProvider,
|
|
4
|
-
OpenIdConnectPrincipal,
|
|
5
|
-
Role,
|
|
6
|
-
Effect,
|
|
7
|
-
PolicyDocument,
|
|
8
|
-
PolicyStatement
|
|
9
|
-
} = require('aws-cdk-lib/aws-iam')
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* @class
|
|
13
|
-
*/
|
|
14
|
-
class TrustCiStack extends Stack {
|
|
15
|
-
/**
|
|
16
|
-
* Establishes trust between GithHub and Amazon Web Services.
|
|
17
|
-
* This is needed so that we can interact with Amazon Web Services through
|
|
18
|
-
* GitHub Actions without having to manually provide credentials every time we
|
|
19
|
-
* run a workflow
|
|
20
|
-
*
|
|
21
|
-
* @param {object} scope - scope
|
|
22
|
-
* @param {string} id - id
|
|
23
|
-
* @param {PlatformTemplate} props - PlatformTemplate
|
|
24
|
-
*/
|
|
25
|
-
constructor(scope, id, props) {
|
|
26
|
-
super(scope, id, props)
|
|
27
|
-
|
|
28
|
-
const provider = new OpenIdConnectProvider(this, 'GitHubProvider', {
|
|
29
|
-
url: 'https://token.actions.githubusercontent.com',
|
|
30
|
-
clientIds: ['sts.amazonaws.com']
|
|
31
|
-
})
|
|
32
|
-
|
|
33
|
-
const GitHubPrincipal = new OpenIdConnectPrincipal(provider)
|
|
34
|
-
.withConditions({
|
|
35
|
-
StringLike: {
|
|
36
|
-
'token.actions.githubusercontent.com:sub': `repo:${props.config.ciGithubActionsRepo}:*`
|
|
37
|
-
},
|
|
38
|
-
StringEquals: {
|
|
39
|
-
'token.actions.githubusercontent.com:aud': 'sts.amazonaws.com'
|
|
40
|
-
}
|
|
41
|
-
})
|
|
42
|
-
|
|
43
|
-
// eslint-disable-next-line no-new
|
|
44
|
-
const role = new Role(this, 'GitHubActionsRole', {
|
|
45
|
-
assumedBy: GitHubPrincipal,
|
|
46
|
-
description: 'Role assumed by GitHubPrincipal for deploying from CI using aws cdk',
|
|
47
|
-
maxSessionDuration: Duration.hours(1),
|
|
48
|
-
inlinePolicies: {
|
|
49
|
-
CdkDeploymentPolicy: new PolicyDocument({
|
|
50
|
-
assignSids: true,
|
|
51
|
-
statements: [
|
|
52
|
-
new PolicyStatement({
|
|
53
|
-
effect: Effect.ALLOW,
|
|
54
|
-
actions: ['sts:AssumeRole', 'sqs:SendMessage'],
|
|
55
|
-
resources: [
|
|
56
|
-
`arn:aws:iam::${props.config.awsAccountId}:role/cdk-*`,
|
|
57
|
-
`arn:aws:sqs:${props.config.awsRegion}:${props.config.awsAccountId}:*`
|
|
58
|
-
]
|
|
59
|
-
})
|
|
60
|
-
]
|
|
61
|
-
})
|
|
62
|
-
}
|
|
63
|
-
})
|
|
64
|
-
|
|
65
|
-
new CfnOutput(this, 'CiAwsRoleToAssume', {
|
|
66
|
-
value: role.roleName,
|
|
67
|
-
description: 'Name of role to be assumed in CI/CD pipelines on github',
|
|
68
|
-
exportName: 'awsRoleToAssume'
|
|
69
|
-
})
|
|
70
|
-
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
module.exports = {
|
|
75
|
-
TrustCiStack
|
|
76
|
-
}
|
package/src/template/cli.js
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
const arg = require('arg')
|
|
2
|
-
const { PlatformTemplateService } = require('./platform-template')
|
|
3
|
-
|
|
4
|
-
const { logInfo, logError } = require('../log')
|
|
5
|
-
|
|
6
|
-
const validate = options => {
|
|
7
|
-
logInfo({ message: 'Running validate command' })
|
|
8
|
-
|
|
9
|
-
const parsedArgs = arg({
|
|
10
|
-
'--platforms': String,
|
|
11
|
-
'-p': '--platforms'
|
|
12
|
-
}, { argv: options })
|
|
13
|
-
|
|
14
|
-
PlatformTemplateService.readFromFile(parsedArgs['--platforms'])
|
|
15
|
-
.then(() => logInfo({ message: 'Template is valid' }))
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
module.exports = {
|
|
19
|
-
handler: ([command, ...options]) => {
|
|
20
|
-
!!command
|
|
21
|
-
? { validate }[command](options)
|
|
22
|
-
: logError({ message: 'No command provided' })
|
|
23
|
-
}
|
|
24
|
-
}
|