This is the repository for the infrastructure code of the IE Bank web app
This source code works under the following technologies:
- Azure CLI
- Azure Bicep
- Bicep CLI
- Learn modules for Bicep
- Quickstart: Create Bicep files with Visual Studio Code
- Deploy Azure resources by using Bicep and GitHub Actions
- Quickstart: Use a Bicep file to create an Azure Database for PostgreSQL - Flexible Server
- Install Azure CLI. Install Azure CLI from here. Make sure to select the option to add Azure CLI to your PATH while installing.
- Install Visual Studio Code and Bicep extension. Install Visual Studio Code from here. Install the Bicep extension from here. You can also follow the steps from the article Install Bicep tools
The script that will deploy the infrastructure for IE Bank app is main.bicep
.
The script deploys:
Resource | Azure Documentation | Bicep resource definition | Description |
---|---|---|---|
PostgreSQL server | Azure Database for PostgreSQL - Flexible Server | Microsoft.DBforPostgreSQL flexibleServers 2022-12-01 | PostgreSQL server for the IE Bank app |
PostgreSQL database | Azure Database for PostgreSQL - Flexible Server | Microsoft.DBforPostgreSQL flexibleServers/databases 2022-12-01 | PostgreSQL database for the IE Bank app |
module modules/app-service |
See Module app-service.bicep |
- | Bicep module that deploys the web app services for the IE Bank app |
The main.bicep
script uses the module modules/app-service.bicep
to deploy the web app services for the IE Bank app.
The module deploys:
Resource | Azure Documentation | Bicep resource definition | Description |
---|---|---|---|
App Service Plan | Azure App Service plan overview | Microsoft.Web/serverfarms 2021-02-01 | App Service Plan for the IE Bank app |
Linux App Service | Azure App Service overview | Microsoft.Web/sites 2021-02-01 | Linux App Service to host the IE Bank app backend |
Linux App Service | Azure App Service overview | Microsoft.Web/sites 2021-02-01 | Linux App Service to host the IE Bank app frontend |
To determine different configuration options for each environment, we will make use of the files under the parameters
folder.
- File
parameters/dev.parameters.json
contains the configuration for the development environment.
Learn more:
The file .github/workflows/ie-banc-infra.yml
contains the configuration for the CI/CD pipeline.
The workflow uses the following GitHub secrets:
Secret name | Description | Learn more |
---|---|---|
AZURE_CREDENTIALS |
Azure credentials to authenticate to Azure via Service Principal | Use the Azure login action with a service principal secret |
DBPASS |
Password for the PostgreSQL server, configured as App Setting in the backend web server | Environment variables and app settings in Azure App Service |
DBUSER |
Username for the PostgreSQL server, configured as App Setting in the backend web server | Environment variables and app settings in Azure App Service |
The workflow uses the following GitHub variables:
Variable name | Description | Learn more |
---|---|---|
DBHOST |
Hostname for the PostgreSQL server, configured as App Setting in the backend web server | Environment variables and app settings in Azure App Service |
DBNAME |
Name for the PostgreSQL database, configured as App Setting in the backend web server | Environment variables and app settings in Azure App Service |
ENV |
Environment name, configured as App Setting in the backend web server | Environment variables and app settings in Azure App Service |
FLASK_APP |
Name of the flask app to run, configured as App Setting in the backend web server | Environment variables and app settings in Azure App Service |
FLASK_DEBUG |
Debug option for the flask app, configured as App Setting in the backend web server | Environment variables and app settings in Azure App Service |
some new text