Skip to content

Commit b3563f8

Browse files
authored
Merge pull request #234 from nitrictech/feature/azure-container-app
Transition to use Azure container apps.
2 parents bca443e + 1679bba commit b3563f8

File tree

8 files changed

+500
-235
lines changed

8 files changed

+500
-235
lines changed

packages/plugins/azure/package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,11 @@
77
"@nitric/cli-common": "workspace:*",
88
"@oclif/command": "^1",
99
"@oclif/config": "^1",
10-
"@pulumi/azure-native": "^1.1.0",
10+
"@pulumi/azure-native": "^1.44.0",
11+
"@pulumi/azuread": "^5.7.0",
1112
"@pulumi/docker": "^3.0.0",
1213
"@pulumi/pulumi": "^3.5.1",
14+
"@pulumi/random": "^4.3.1",
1315
"api-spec-converter": "^2.11.4",
1416
"cli-ux": "^5.5.1",
1517
"cron-parser": "^3.2.0",
@@ -68,6 +70,6 @@
6870
"prepack": "rimraf -rf lib && tsc -p tsconfig.build.json && oclif-dev manifest && oclif-dev readme",
6971
"test": "tsc --emitDeclarationOnly && jest --passWithNoTests",
7072
"set:version": "npm version --version-git-tag false",
71-
"npm:publish": "yarn npm publish --access restricted --tolerate-republish"
73+
"npm:publish": "yarn npm publish --access public --tolerate-republish"
7274
}
7375
}

packages/plugins/azure/src/commands/deploy/azure.ts

Lines changed: 63 additions & 105 deletions
Original file line numberDiff line numberDiff line change
@@ -25,110 +25,74 @@ import {
2525
} from '@nitric/cli-common';
2626
import path from 'path';
2727
import { Deploy } from '../../tasks/deploy';
28-
import { AppServicePlan } from '../../types';
2928

3029
const SUPPORTED_REGIONS = [
31-
'eastus',
32-
'eastus2',
33-
'southcentralus',
34-
'westus2',
35-
'australiaeast',
36-
'southeastasia',
30+
//'eastus',
31+
//'eastus2',
32+
//'southcentralus',
33+
//'westus2',
34+
//'australiaeast',
35+
//'southeastasia',
3736
'northeurope',
38-
'uksouth',
39-
'westeurope',
40-
'centralus',
41-
'northcentralus',
42-
'westus',
43-
'southafricanorth',
44-
'centralindia',
45-
'eastasia',
46-
'japaneast',
47-
'koreacentral',
37+
//'uksouth',
38+
//'westeurope',
39+
//'centralus',
40+
//'northcentralus',
41+
//'westus',
42+
//'southafricanorth',
43+
//'centralindia',
44+
//'eastasia',
45+
//'japaneast',
46+
//'koreacentral',
4847
'canadacentral',
49-
'francecentral',
50-
'germanywestcentral',
51-
'norwayeast',
52-
'switzerlandnorth',
53-
'uaenorth',
54-
'brazilsouth',
55-
'centralusstage',
56-
'eastusstage',
57-
'eastus2stage',
58-
'northcentralusstage',
59-
'southcentralusstage',
60-
'westusstage',
61-
'westus2stage',
62-
'asia',
63-
'asiapacific',
64-
'australia',
65-
'brazil',
66-
'canada',
67-
'europe',
68-
'global',
69-
'india',
70-
'japan',
71-
'uk',
72-
'unitedstates',
73-
'eastasiastage',
74-
'southeastasiastage',
75-
'centraluseuap',
76-
'eastus2euap',
77-
'westcentralus',
78-
'westus3',
79-
'southafricawest',
80-
'australiacentral',
81-
'australiacentral2',
82-
'australiasoutheast',
83-
'japanwest',
84-
'koreasouth',
85-
'southindia',
86-
'westindia',
87-
'canadaeast',
88-
'francesouth',
89-
'germanynorth',
90-
'norwaywest',
91-
'switzerlandwest',
92-
'ukwest',
93-
'uaecentral',
94-
'brazilsoutheast',
48+
//'francecentral',
49+
//'germanywestcentral',
50+
//'norwayeast',
51+
//'switzerlandnorth',
52+
//'uaenorth',
53+
//'brazilsouth',
54+
//'centralusstage',
55+
//'eastusstage',
56+
//'eastus2stage',
57+
//'northcentralusstage',
58+
//'southcentralusstage',
59+
//'westusstage',
60+
//'westus2stage',
61+
//'asia',
62+
//'asiapacific',
63+
//'australia',
64+
//'brazil',
65+
//'canada',
66+
//'europe',
67+
//'global',
68+
//'india',
69+
//'japan',
70+
//'uk',
71+
//'unitedstates',
72+
//'eastasiastage',
73+
//'southeastasiastage',
74+
//'centraluseuap',
75+
//'eastus2euap',
76+
//'westcentralus',
77+
//'westus3',
78+
//'southafricawest',
79+
//'australiacentral',
80+
//'australiacentral2',
81+
//'australiasoutheast',
82+
//'japanwest',
83+
//'koreasouth',
84+
//'southindia',
85+
//'westindia',
86+
//'canadaeast',
87+
//'francesouth',
88+
//'germanynorth',
89+
//'norwaywest',
90+
//'switzerlandwest',
91+
//'ukwest',
92+
//'uaecentral',
93+
//'brazilsoutheast',
9594
];
9695

97-
const APPSERVICE_PLANS: Record<string, AppServicePlan> = {
98-
'Free-F1': {
99-
tier: 'Free',
100-
size: 'F1',
101-
},
102-
'Shared-D1': {
103-
tier: 'Shared',
104-
size: 'D1',
105-
},
106-
'Basic-B1': {
107-
tier: 'Basic',
108-
size: 'B1',
109-
},
110-
'Basic-B2': {
111-
tier: 'Basic',
112-
size: 'B2',
113-
},
114-
'Basic-B3': {
115-
tier: 'Basic',
116-
size: 'B3',
117-
},
118-
'Standard-S1': {
119-
tier: 'Standard',
120-
size: 'S1',
121-
},
122-
'Standard-S2': {
123-
tier: 'Standard',
124-
size: 'S2',
125-
},
126-
'Standard-S3': {
127-
tier: 'Standard',
128-
size: 'S3',
129-
},
130-
};
131-
13296
/**
13397
* Deploy a stack to Microsoft Azure
13498
*
@@ -146,11 +110,6 @@ export default class AzureDeploy extends BaseCommand {
146110
char: 'r',
147111
description: 'azure region to deploy to',
148112
}),
149-
plan: flags.enum({
150-
options: Object.keys(APPSERVICE_PLANS),
151-
char: 'p',
152-
description: 'azure appservice plan tier',
153-
}),
154113
file: flags.string({
155114
char: 'f',
156115
default: 'nitric.yaml',
@@ -197,7 +156,7 @@ export default class AzureDeploy extends BaseCommand {
197156
promptFlags = await inquirer.prompt(prompts);
198157
}
199158

200-
const { file, region, orgName, adminEmail, plan } = { ...flags, ...promptFlags };
159+
const { file, region, orgName, adminEmail } = { ...flags, ...promptFlags };
201160

202161
if (!region) {
203162
throw new Error('Region must be provided, for prompts use the --guided flag');
@@ -222,7 +181,6 @@ export default class AzureDeploy extends BaseCommand {
222181
region,
223182
orgName,
224183
adminEmail,
225-
servicePlan: APPSERVICE_PLANS[plan],
226184
}),
227185
),
228186
],

packages/plugins/azure/src/resources/api.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,14 @@ import * as pulumi from '@pulumi/pulumi';
1515
import { NitricAPITarget, StackAPI, constants } from '@nitric/cli-common';
1616
import { resources, apimanagement } from '@pulumi/azure-native';
1717
import { OpenAPIV3 } from 'openapi-types';
18-
import { NitricComputeAzureAppService } from '.';
18+
import { NitricComputeAzureContainerApp } from '.';
1919

2020
interface NitricApiAzureApiManagementArgs {
2121
resourceGroup: resources.ResourceGroup;
2222
orgName: string;
2323
adminEmail: string;
2424
api: StackAPI;
25-
services: NitricComputeAzureAppService[];
25+
services: NitricComputeAzureContainerApp[];
2626
}
2727

2828
type method = 'get' | 'post' | 'put' | 'update' | 'delete' | 'patch';
@@ -117,7 +117,7 @@ export class NitricApiAzureApiManagement extends pulumi.ComponentResource {
117117
<policies>
118118
<inbound>
119119
<base />
120-
<set-backend-service base-url="https://${func.webapp.defaultHostName}" />
120+
<set-backend-service base-url="https://${func.containerApp.latestRevisionFqdn}" />
121121
</inbound>
122122
<backend>
123123
<base />

0 commit comments

Comments
 (0)