Deploying Loki on Azure App Service
If you are in love with with Loki and Azure, this article is for you. It will take you through a basic deployment of Loki on Azure App Service.
Why Azure App Service
Let’s be pragmatic and straight forward, Azure App Service has many advantages. Here is my short list of preferred features:
- Fully managed service (no hassle)
- HTTPS / SSL Certificate handling
- Custom domain
- Auto scaling
- Linux support
- Docker (including Docker compose) support
Azure App Service is a great candidate to deploy Loki.
Loki Authentication
Loki does not come with any authentication layer. We will use nginx and docker compose to add the authentication layer as described here.
Here is the docker compose to achieve this :
Don’t forget to adjust BASIC_USERNAME and BASIC_PASSWORD accordingly ! You probably do not want to use the default one above.
Deploy to Azure App Service
We will use Linux based Azure App Service to deploy this Docker compose file.
Create a new Web App:
Then fill in the form, I have highlighted the important fields:
Configure with the docker compose file previously presented:
Next, next, next, create… done !
You can now browse Loki and check that it is working fine by navigating to /loki/api/v1/labels. Note that you’ll get prompted for authentication:
Basic Azure Web Site tuning
Here are a few tips to make it secured :
- TLS/SSL settings : Enforce HTTPS only (required since we are using basic authentication) and enforce TLS 1.2:
- Add a custom domain:
- Create a SSL certificate for your domain:
Conclusion
Getting Loki running on a fully managed service in Azure is extremely simple and straight forward.