Deploying Cat Tracker to Azure¶
To deploy the Cat Tracker web application to Azure, complete the following steps:
Configure the web application
Deploy the web application
Register a new user
Note
Before you start deploying, make sure that you have set up the necessary Azure resources.
Configure the web application¶
The web application needs to be configured to be able to run with your account.
As a first step, you need to create a file called .env.local
, which Create React App uses to make the settings in the file available as environment variables during build-time.
Configure the IDs of your Azure resources¶
The web application requires the IDs of the Azure resources that were created during the setup of the stack.
Run the following command in the bifravst-app
directory to copy the output to the .env.local
file:
node ../bifravst-azure/cli react-config > .env.local
Example for .env.local
¶
Following is an example for the contents of the .env.local
file:
REACT_APP_CLOUD_FLAVOUR=Azure
REACT_APP_AZURE_CLIENT_ID=358162bb-b809-42ef-9b62-22f8fa42b5fb
REACT_APP_AZURE_AD_B2C_AUTHORITY=https://bifravstprod.b2clogin.com/bifravstprod.onmicrosoft.com/B2C_1_signup_signin
REACT_APP_AZURE_B2C_TENANT=bifravstprod
REACT_APP_VERSION=v3.6.1
Version string¶
Run the following command to provide the version to the application:
echo REACT_APP_VERSION=`git describe --tags $(git rev-list --tags --max-count=1)` >> .env.local
Deploy the web application¶
To build and deploy the web application to the Storage Account created while setting up Bifravst in your Azure account, run the following commands:
export APP_URL=`az storage account show -g ${RESOURCE_GROUP_NAME} -n ${APP_NAME}app --query 'primaryEndpoints.web' --output tsv | tr -d '\n'`
export APP_STORAGE_CONNECTION_STRING=`az storage account show-connection-string --name ${APP_NAME}app --query 'connectionString'`
npm run build
az storage blob upload-batch --connection-string ${APP_STORAGE_CONNECTION_STRING} --account-name ${APP_NAME}app -s ./build -d '$web'
echo "Done. Now open $APP_URL to view the web app."
After running the above commands, you can open the domain name printed in APP_URL
to view the web application.
Register a new user¶
Since are no predefined user accounts in the B2C Active Directory, you need to register a new user.