-
Notifications
You must be signed in to change notification settings - Fork 7
/
.projenrc.js
188 lines (165 loc) · 6.51 KB
/
.projenrc.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
const { awscdk } = require('projen');
const AUTOMATION_TOKEN = 'PROJEN_GITHUB_TOKEN';
const project = new awscdk.AwsCdkTypeScriptApp({
authorName: 'Sébastien Allamand',
authorName: '[email protected]',
authorOrganization: true,
repository: 'https://github.com/aws-samples/magento-ecs-cdk.git',
copyrightPeriod: `2021-${new Date().getFullYear()}`,
copyrightOwner: 'Amazon.com, Inc. or its affiliates. All Rights Reserved.',
keywords: ['aws', 'constructs', 'cdk', 'ecs', 'magento', 'fargate', 'opensearch', 'efs', 'fsx'],
description:
'CDK Project to deploy Magento Applications on top of AWS ECS, FARGATE/EC2, EFS/FsX Ontap, RDS, OpenSearch, ElastiCashe',
cdkVersion: '2.166.0',
defaultReleaseBranch: 'main',
license: 'MIT',
name: 'magento-ecs-cdk',
repositoryUrl: 'https://github.com/aws-samples/magento-ecs-cdk.git',
appEntrypoint: 'integ.ts',
//https://subaud.io/blog/github-action-workflows-in-projen
depsUpgradeOptions: {
ignoreProjen: false,
workflowOptions: {
labels: ['auto-approve', 'auto-merge'],
//schedule: UpgradeDependenciesSchedule.WEEKLY,
secret: AUTOMATION_TOKEN,
},
separateUpgrades: true,
},
autoApproveOptions: {
secret: 'GITHUB_TOKEN',
allowedUsernames: ['github-actions', 'github-actions[bot]', 'allamand'],
},
githubOptions: {
workflows: true,
},
workflowNodeVersion: '20.x', // Specify the Node.js version for the workflow
workflowContainerImage: 'jsii/superchain:1-buster-slim-node18', // Optional: Use a specific container image
// Disable the default build workflow
buildWorkflow: true,
workflowBootstrapSteps: [
{
name: 'Setup Mock AWS Context',
run: [
// 'echo "CDK_DEFAULT_ACCOUNT=123456789012" >> $GITHUB_ENV',
// 'echo "CDK_DEFAULT_REGION=us-east-1" >> $GITHUB_ENV',
// 'echo "AWS_ACCESS_KEY_ID=AKIAIOSFODNN7EXAMPLE" >> $GITHUB_ENV',
// 'echo "AWS_SECRET_ACCESS_KEY=wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY" >> $GITHUB_ENV',
// 'echo "AWS_REGION=us-east-1" >> $GITHUB_ENV',
'echo "CDK_FAKE_AWS=true" >> $GITHUB_ENV',
].join('\n'),
},
],
context: {
'@aws-cdk/aws-apigateway:usagePlanKeyOrderInsensitiveId': true,
'@aws-cdk/core:enablePartitionLiterals': true,
'@aws-cdk/aws-events:eventsTargetQueueSameAccount': true,
'@aws-cdk/aws-iam:standardizedServicePrincipals': true,
'@aws-cdk/aws-ecs:disableExplicitDeploymentControllerForCircuitBreaker': true,
'@aws-cdk/aws-iam:importedRoleStackSafeDefaultPolicyName': true,
'@aws-cdk/aws-s3:serverAccessLogsUseBucketPolicy': true,
'@aws-cdk/aws-route53-patters:useFargateAlb': true,
'@aws-cdk/customresources:installLatestAwsSdkDefault': false,
'aws-cdk:enableDiffNoFail': true,
//Mock
'vpc-provider:account=1234567890:filter.tag:Name=default:region=us-east-1:returnAsymmetricSubnets=true': {
vpcId: 'vpc-1234567890abcdef0',
vpcCidrBlock: '172.31.0.0/16',
availabilityZones: [],
subnetGroups: [
{
name: 'Public',
type: 'Public',
subnets: [
{
subnetId: 'subnet-1234567890abcdef0',
cidr: '172.31.0.0/20',
availabilityZone: 'us-east-1a',
routeTableId: 'rtb-1234567890abcdef0',
},
{
subnetId: 'subnet-1234567890abcdef1',
cidr: '172.31.16.0/20',
availabilityZone: 'us-east-1b',
routeTableId: 'rtb-1234567890abcdef0',
},
{
subnetId: 'subnet-1234567890abcdef2',
cidr: '172.31.32.0/20',
availabilityZone: 'us-east-1c',
routeTableId: 'rtb-1234567890abcdef0',
},
],
},
],
},
'availability-zones:account=1234567890:region=us-east-1': ['us-east-1a', 'us-east-1b', 'us-east-1c'],
'hosted-zone:account=1234567890:domainName=sallaman.people.aws.dev:region=us-east-1': {
Id: '/hostedzone/MOCKZ3AMJ8IL4',
Name: 'sallaman.people.aws.dev.',
},
//vpc_tag_name: 'ecsworkshop-base/BaseVPC', // TAG Name of the VPC to create the cluster into (or 'default' or comment to create new one)
'enablePrivateLink': 'true', // this parameter seems to works only one
'createEFS': 'no', //if yes CDK will create the EFS File System
'useEFS': 'no', // if true, /bitnami/magento directory will be mapped to a new empty FSX volume.
'useFSX': 'yes', // if yes, create en EC2 based cluster (required for FsX), if no create Fargate cluster
'ec2Cluster': 'yes', // if yes, create en EC2 based cluster (required for FsX), if no create Fargate cluster
// You can customize Instances size
// ec2InstanceType: 'c5.9xlarge',
// rdsInstanceType: 'r6g.8xlarge',
// cacheInstanceType: 'r6g.8xlarge',
'taskCpu': 1024,
'taskMem': 4096,
'phpMemoryLimit': '3G',
'magentoMinTasks': 10,
'magentoMaxTasks': 100,
'route53_domain_zone': 'sallaman.people.aws.dev', // You need ot provide a valide AWS Route53 Hosted Zone.
'magento_admin_task': 'yes',
'magento_admin_task_debug': 'no',
},
gitignore: [
'cdk.out',
'cdk.context.json',
'*.d.ts',
'*.js',
'CMD',
'.projenrc.js-*',
'.env*',
'.vscode',
],
devDeps: ['cdk-nag'], /* Build dependencies for this module. */
});
// Add a custom workflow
// const workflow = project.github.addWorkflow('custom-build');
// workflow.on({
// push: { branches: ['main'] },
// pullRequest: { branches: ['main'] },
// workflowDispatch: {},
// });
// workflow.addJobs({
// build: {
// runsOn: ['ubuntu-latest'],
// permissions: {
// contents: 'read',
// },
// steps: [
// { uses: 'actions/checkout@v4'},
// {
// name: 'Setup mock AWS environment',
// run: [
// 'echo "AWS_ACCESS_KEY_ID=AKIAIOSFODNN7EXAMPLE" >> $GITHUB_ENV',
// 'echo "AWS_SECRET_ACCESS_KEY=wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY" >> $GITHUB_ENV',
// 'echo "AWS_DEFAULT_REGION=us-east-1" >> $GITHUB_ENV',
// 'echo "CDK_DEFAULT_ACCOUNT=123456789012" >> $GITHUB_ENV',
// 'echo "CDK_DEFAULT_REGION=us-east-1" >> $GITHUB_ENV',
// 'echo "AWS_REGION=us-east-1" >> $GITHUB_ENV',
// 'echo "CDK_FAKE_AWS=true" >> $GITHUB_ENV',
// ].join('\n'),
// },
// { uses: 'actions/setup-node@v4', with: { 'node-version': '20.x' } },
// { name: 'Install dependencies', run: 'yarn install --check-files' },
// { name: 'mock build', run: 'npx projen build' },
// ],
// },
// });
project.synth();