-
Notifications
You must be signed in to change notification settings - Fork 170
/
next-steps.mdt
106 lines (74 loc) · 6.07 KB
/
next-steps.mdt
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
{{define "next-steps.md" -}}
# Next Steps after `azd init`
## Table of Contents
1. [Next Steps](#next-steps)
2. [What was added](#what-was-added)
3. [Billing](#billing)
4. [Troubleshooting](#troubleshooting)
## Next Steps
### Define environment variables for running services
1. Modify or add environment variables to configure the running application. Environment variables can be configured by updating the `settings` node(s) for each service in [main.parameters.json](./infra/main.parameters.json).
2. For services using a database, environment variables have been pre-configured under the `env` node in the following files to allow connection to the database. Modify the name of these variables as needed to match your application.
{{- range .Services}}
- [app/{{.Name}}.bicep](./infra/app/{{.Name}}.bicep)
{{- end}}
### Provision infrastructure and deploy application code
Run `azd up` to provision your infrastructure and deploy to Azure in one step (or run `azd provision` then `azd deploy` to accomplish the tasks separately). Visit the service endpoints listed to see your application up-and-running!
To troubleshoot any issues, see [troubleshooting](#troubleshooting).
### Configure CI/CD pipeline
1. Create a workflow pipeline file locally. The following starters are available:
- [Deploy with GitHub Actions](https://github.com/Azure-Samples/azd-starter-bicep/blob/main/.github/workflows/azure-dev.yml)
- [Deploy with Azure Pipelines](https://github.com/Azure-Samples/azd-starter-bicep/blob/main/.azdo/pipelines/azure-dev.yml)
2. Run `azd pipeline config -e <environment name>` to configure the deployment pipeline to connect securely to Azure. An environment name is specified here to configure the pipeline with a different environment for isolation purposes. Run `azd env list` and `azd env set` to reselect the default environment after this step.
## What was added
### Infrastructure configuration
To describe the infrastructure and application, `azure.yaml` along with Infrastructure as Code files using Bicep were added with the following directory structure:
```yaml
- azure.yaml # azd project configuration
- infra/ # Infrastructure as Code (bicep) files
- main.bicep # main deployment module
- app/ # Application resource modules
- shared/ # Shared resource modules
- modules/ # Library modules
```
Each bicep file declares resources to be provisioned. The resources are provisioned when running `azd up` or `azd provision`.
{{range .Services}}
- [app/{{.Name}}.bicep](./infra/app/{{.Name}}.bicep) - Azure Container Apps resources to host the '{{.Name}}' service.
{{- end}}
{{- if .DbPostgres}}
- [app/db-postgre.bicep](./infra/app/db-postgre.bicep) - Azure Postgres Flexible Server to host the '{{.DbPostgres.DatabaseName}}' database.
{{- end}}
{{- if .DbCosmosMongo}}
- [app/db-cosmos.bicep](./infra/app/db-cosmos.bicep) - Azure Cosmos DB (MongoDB) to host the '{{.DbCosmosMongo.DatabaseName}}' database.
{{- end}}
- [shared/keyvault.bicep](./infra/shared/keyvault.bicep) - Azure KeyVault to store secrets.
- [shared/monitoring.bicep](./infra/shared/monitoring.bicep) - Azure Log Analytics workspace and Application Insights to log and store instrumentation logs.
- [shared/registry.bicep](./infra/shared/registry.bicep) - Azure Container Registry to store docker images.
More information about [Bicep](https://aka.ms/bicep) language.
### Build from source (no Dockerfile)
*Note: Build from source is currently experimental. We recommend authoring a Dockerfile for a static front-end service.*
#### Build with Buildpacks using Oryx
If your project does not contain a Dockerfile, we will use [Buildpacks](https://buildpacks.io/) using [Oryx](https://github.com/microsoft/Oryx/blob/main/doc/README.md) to create an image for the services in `azure.yaml` and get your containerized app onto Azure.
To produce and run the docker image locally:
1. Run `azd package` to build the image.
2. Copy the *Image Tag* shown.
3. Run `docker run -it <Image Tag>` to run the image locally.
#### Exposed port
Oryx will automatically set `PORT` to a default value of `80` or `8080` depending on the language. Additionally, it will auto-configure supported web servers such as `gunicorn` and `ASP .NET Core` to listen to the target `PORT`. If your application already listens to the port specified by the `PORT` variable, the application will work out-of-the-box. Otherwise, you may need to perform one of the steps below:
1. Update your application code or configuration to listen to the port specified by the `PORT` variable
1. (Alternatively) Search for `targetPort` in a .bicep file under the `infra/app` folder, and update the variable to match the port used by the application.
## Billing
Visit the *Cost Management + Billing* page in Azure Portal to track current spend. For more information about how you're billed, and how you can monitor the costs incurred in your Azure subscriptions, visit [billing overview](https://learn.microsoft.com/en-us/azure/developer/intro/azure-developer-billing).
## Troubleshooting
Q: I visited the service endpoint listed, and I'm seeing a blank or error page.
A: Your service may have failed to start or misconfigured. To investigate further:
1. Click on the resource group link shown to visit Azure Portal.
2. Navigate to the specific Azure Container App resource for the service.
3. Select *Monitoring -> Log stream* under the navigation pane.
4. Observe the log output to identify any errors.
5. If there are no errors, ensure that the ingress target port matches the port that your service listens on:
1. Under *Settings -> Ingress*, ensure the *Target port* matches the desired port.
2. After modifying this setting, also update the `targetPort` setting in the .bicep file for the service under `infra/app`.
6. If logs are written to disk, examine the local logs or debug the application by using the *Console* to connect to a shell within the running container.
For additional information about setting up your `azd` project, visit our official [docs](https://learn.microsoft.com/en-us/azure/developer/azure-developer-cli/make-azd-compatible?pivots=azd-convert).
{{ end}}