Seq is one of my favorite logging and monitoring tools out there. Unfortunately Azure does not have built-in support to run Seq as a SaaS offering. But don't worry, this guide will walk you through configuring and deploying Seq as a Docker container running in Azure Container Instances using Bicep.
Defining Bicep resources
To run Seq in Azure we'll three resources:
- Azure Container Instance hosting our docker image
- Azure Storage Account storing log data
- Azure File Share mounted to the storage account
Before we start defining our resources, let's create a new directory and two bicep files.
mkdir infrastructure && cd infrastructure && touch seq.bicep && touch main.bicep
For demonstration purposes seq.bicep
will contain all our resources:
param location string = resourceGroup().location
var dnsLabelName = 'aci-seq-test'
var fqdn = 'http://${dnsLabelName}.${location}.azurecontainer.io'
resource storageAccount 'Microsoft.Storage/storageAccounts@2022-05-01' = {
name: 'saseqtest'
location: location
sku: {
name: 'Premium_LRS'
}
kind: 'FileStorage'
}
resource fileShare 'Microsoft.Storage/storageAccounts/fileServices/shares@2021-04-01' = {
name: '${storageAccount.name}/default/${shareseqtest}'
}
resource containerGroup 'Microsoft.ContainerInstance/containerGroups@2021-09-01' = {
name: 'aci-seq-test'
location: location
properties: {
containers: [
{
name: 'aci-seq-test'
properties: {
image: 'datalust/seq:latest'
ports: [
{
port: 80
protocol: 'TCP'
}
]
resources: {
requests: {
cpu: 1
memoryInGB: 1
}
}
volumeMounts: [
{
mountPath: '/data'
name: 'seq-data'
}
]
environmentVariables: [
{
name: 'ACCEPT_EULA'
value: 'Y'
}
{
name: 'SEQ_API_CANONICALURI'
value: fqdn
}
]
}
}
]
volumes: [
{
name: 'seq-data'
azureFile: {
shareName: fileShareName
storageAccountName: storageAccount.name
storageAccountKey: storageAccount.listKeys().keys[0].value
}
}
]
osType: 'Linux'
restartPolicy: 'OnFailure'
ipAddress: {
type: 'Public'
dnsNameLabel: dnsLabelName
ports: [
{
port: 80
protocol: 'TCP'
}
]
}
}
}
output fqdn string = containerGroup.properties.ipAddress.fqdn
Lets define our main.bicep
file
module seq 'seq.bicep' = {
name: 'seq'
}
output seqFqdn string = seq.outputs.fqdn
Thats everything you'll need to create an instance of Seq running in Azure with a File share mounted to it. To create these resources, make sure you are logged into your Azure Tenant and the correct subscription is selected. To deploy these resource you can either use the portal or the CLI by running:
az deployment group create --resource-group <resource-group-name> --template-file main.bicep
The cost of running these resources in Azure adds up to around 50 USD/month. Most of the cost is related to running the Container Instance 24/7. For a more detailed overview of the pricing structure, I would recommend to check out the Azure Pricing Calculator.
Make sure that you enable authentication by accessing the seq dashboard!
Happy logging!