This is a simple Axum web server hosted integrated with Azure services and hosted on Azure and is the final outcome of the "Axum meets Azure: Lightning fast web servers" event. The aim is to showcase the feasibility of deploying a Rust backend server to Azure
- Azure Container Registry
- Azure web app for containers
- Azure PostgreSQL flexible server
- Github Actions
You can view the final result here https://axumxazuretest.azurewebsites.net
Routes:
- GET
/
- GET
/test
- GET
/api
- POST
/api
- GET
/api/:id
- PATCH
/api/:id
- DELETE
/api/:id
You can deploy this project using the following steps.
- Fork this repository to your github account
- Clone the fork to your local machine
- Create an Azure Container Registry resource and take note of the
login server
,registry username
, andregistry password
, you should also decide on animage name
and store it - In your fork, go to Settings > Secrets and variables > Actions and add the following repository secrets
AZURE_CONTAINER_REGISTRY_LOGIN_SERVER aslogin server
AZURE_CONTAINER_REGISTRY_USERNAME asregistry username
AZURE_CONTAINER_REGISTRY_PASSWORD asregistry password
AZURE_CONTAINER_REGISTRY_IMAGE_NAME asimage name
- With these credentials set, make a small change to the code and push to github, your action should run smoothly
- Create an Azure Database for PostgreSQL - Flexible server resource and take note of the
database server
,username
,password
. *username and password can be found under Access Keys in the azure portal. - Create a Web App For Container resource in your azure portal
- Head to Settings > Configuration > Application Settings > New application settings
- Head to Deployment Center, select the Container, Repository and tag, and set
Continuous Deployment
to "On" - Set the name as
DATABASE_URL
and the value aspostgresql://{username}:{password}@{database_server}:5432/{database_name: is "postgres" by default}
- Make a small change to your code like adding a comment in the file and push to git to see your Action Running and your web server deployed