Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Helm Chart for running Logfire 🪵️‍🔥

NotificationsYou must be signed in to change notification settings

pydantic/logfire-helm-chart

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

94 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Version: 0.4.1AppVersion: ec5e2c3b

Helm chart for self-hosted Pydantic Logfire

Chart installation

$ helm repo add pydantic https://charts.pydantic.dev/$ helm upgrade --install logfire pydantic/logfire

Prerequisites

There are a number of Pydantic Logfire external prerequisites including PostgreSQL, Dex and Object Storage.

Image Secrets

You will require image pull secrets to pull down the docker images from our private repository. Get in contact with us to get a copy of them.

When you have thekey.json file you can load it in as a secret like so:

kubectl create secret docker-registry logfire-image-key \  --docker-server=us-docker.pkg.dev \  --docker-username=_json_key \  --docker-password="$(cat key.json)" \  --docker-email=YOUR-EMAIL@example.com

Then you can either configure yourservice account to use them or specify this invalues.yaml underimagePullSecrets:

imagePullSecrets:  -logfire-image-key

Hostnames

There is a hostname that is required to be set: I.e,logfire.example.com. Set via theingress.hostname value.

We have an ingress configuration that will allow you to set up ingress:

ingress:enabled:truetls:truehostname:logfire.example.comingressClassName:nginx

Using the direct service

We expose a service calledlogfire-service which will route traffic appropriately.

If you don't want to use the ingress controller, you will still need to define hostnames and whether you are externally using TLS:

I.e, this config will turn off the ingress resource, but still set appropriate cors headers for thelogfire-service:

ingress:# this turns off the ingress resourceenabled:false# used to ensure appropriate CORS headers are set.  If your browser is accessing it on https, then needs to be enabled heretls:true# used to ensure appropriate CORS headers are set.hostname:logfire.example.com

If you arenot using kubernetes ingress, you must still set the hostnames under theingress configuration.

Dex

Dex is used as the identity service for logfire & can be configured for many different types of connectors. The full list of connectors can be found here:https://dexidp.io/docs/connectors/

There is some default configuration provided invalues.yaml.

Authentication Configuration

Depending on whatconnector you want to use, you can configure dex connectors accordingly.

Here's an example usinggithub as a connector:

logfire-dex:...config:connectors:      -type:"github"id:"github"name:"GitHub"config:# You get clientID and clientSecret by creating a GitHub OAuth App# See https://docs.github.com/en/apps/oauth-apps/building-oauth-apps/creating-an-oauth-appclientID:client_idclientSecret:client_secretgetUserInfo:true

To use GitHub as an example, you can find general instructions for creating an OAuth appin the GitHub docs.It should look something like this:

GitHub OAuth App Example

Dex allows configuration parameters to reference environment variables.This can be done by using the$ symbol. For example, theclientID andclientSecret can be set as environment variables:

logfire-dex:env:    -name:GITHUB_CLIENT_IDvalueFrom:secretKeyRef:name:my-github-secretkey:client-id    -name:GITHUB_CLIENT_SECRETvalueFrom:secretKeyRef:name:my-github-secretkey:client-secretconfig:connectors:      -type:"github"id:"github"name:"GitHub"config:clientID:$GITHUB_CLIENT_IDclientSecret:$GITHUB_CLIENT_SECRETgetUserInfo:true

You would have to manually (or via IaC, etc.) createmy-github-secret.This allows you to avoid putting any secrets into avalues.yaml file.

Image pull secrets

Remember to add the image pull secrets to dex's service accountlogfire-dex if you're not usingimagePullSecrets.

We recommend you set secrets as Kubernetes secrets and reference them in thevalues.yaml file instead of hardcoding secrets which is more likely to be exposed and harder to rotate.

Object Storage

Pydantic Logfire requires Object Storage to store data. There are a number of different integrations that can be used:

  • Amazon S3
  • Google Cloud Storage
  • Azure Storage

Each has their own set of environment variables that can be used to configure them. However if your kubernetes service account has the appropriate credentials, that be used by settingserviceAccountName.

Amazon S3

Variables extracted from environment:

Example:

objectStore:uri:s3://<bucket_name># Note: not needed if the service account specified by `serviceAccountName` itself has credentialsenv:AWS_DEFAULT_REGION:<region>AWS_SECRET_ACCESS_KEY:valueFrom:secretKeyRef:name:my-aws-secretkey:secret-keyAWS_ACCESS_KEY_ID:<access_key>

Google Cloud Storage

Variables extracted from environment:

  • GOOGLE_SERVICE_ACCOUNT: location of service account file
  • GOOGLE_SERVICE_ACCOUNT_PATH: (alias) location of service account file
  • SERVICE_ACCOUNT: (alias) location of service account file
  • GOOGLE_SERVICE_ACCOUNT_KEY: JSON serialized service account key
  • GOOGLE_BUCKET: bucket name
  • GOOGLE_BUCKET_NAME: (alias) bucket name

Example:

objectStore:uri:gs://<bucket># Note: not needed if the service account specified by `serviceAccountName` itself has credentialsenv:GOOGLE_SERVICE_ACCOUNT_PATH:/path/to/service/account

Azure Storage

Variables extracted from environment:

  • AZURE_STORAGE_ACCOUNT_NAME: storage account name
  • AZURE_STORAGE_ACCOUNT_KEY: storage account master key
  • AZURE_STORAGE_ACCESS_KEY: alias for AZURE_STORAGE_ACCOUNT_KEY
  • AZURE_STORAGE_CLIENT_ID: client id for service principal authorization
  • AZURE_STORAGE_CLIENT_SECRET: client secret for service principal authorization
  • AZURE_STORAGE_TENANT_ID: tenant id used in oauth flows

Example:

objectStore:uri:az://<container_name>env:AZURE_STORAGE_ACCOUNT_NAME:<storage_account_name>AZURE_STORAGE_ACCOUNT_KEY:valueFrom:secretKeyRef:name:my-azure-secretkey:account-key

PostgreSQL

Pydantic Logfire nominally needs 3 separate PostgreSQL databases:crud,ff, anddex. Each will need a user with owner permissions to allow migrations to run.While they can all be ran on the same instance, they are required to be separate databases to prevent naming/schema collisions.

Here's an example set of values usingpostgres.example.com as the host:

postgresDsn:postgres://postgres:postgres@postgres.example.com:5432/crudpostgresFFDsn:postgres://postgres:postgres@postgres.example.com:5432/ffdex:...# note that the dex chart does not use the uri style connectorconfig:storage:type:postgresconfig:host:postgres.example.comport:5432user:postgresdatabase:dexpassword:postgresssl:mode:disable

Email

Pydantic Logfire uses SMTP to send emails. You will need to configure email using the following values:

smtp:host:smtp.example.comport:25username:userpassword:passuse_tls:false

AI

Pydantic Logfire AI features can be enabled by setting theai configuration invalues.yaml.You need to specify the model provider and model name you want to use:

ai:model:provider:model-nameopenAi:apiKey:openai-api-keyvertexAi:region:region# Optional, only needed for Vertex AI if not using default regionazureOpenAi:endpoint:azure-openai-endpointapiKey:azure-openai-api-keyapiVersion:azure-openai-api-version

Scaling

A number of components within logfire allow containers/pods to be horizontally scaled. Also: depending on your setup you may want a number of replicas to run to ensure redundancy if a node fails.

Each service has both resources and autoscaling configured in the same way:

<service_name>:# -- Number of pod replicasreplicas:1# -- Resource limits and allocationsresources:cpu:"1"memory:"1Gi"# -- Autoscaler settingsautoscaling:minReplicas:2maxReplicas:4memAverage:65cpuAverage:20

Seevalues.yaml for some production level values

Configuring Logfire

Since this is self-hosted you will need to update your logfire configuration to include a different URL to send data to. You can do this by specifying thebase_url in advanced config:

importlogfirelogfire.configure(token='<your_logfire_token>',advanced=logfire.AdvancedOptions(base_url="https://logfire.example.com"))logfire.info('Hello, {place}!',place='World')

Development

There are various development options you can set to test out the helm chart. We have two flavours:values.docker-desktop.yaml andvalues.k3s.yaml. Both of which are intended for development of the helm chart only and should not be considered production ready.

Postgres

You can run up a dev instance of PostgreSQL within the chart if you are just starting out. This deployment will take care of creating all the databases needed

Put the following values in yourvalues.yaml file:

# To enable deployment of internal PostgreSQLdev:deployPostgres:truepostgresDsn:postgres://postgres:postgres@logfire-postgres:5432/crudpostgresFFDsn:postgres://postgres:postgres@logfire-postgres:5432/ffdex:...config:storage:type:postgresconfig:host:logfire-postgresport:5432user:postgresdatabase:dexpassword:postgresssl:mode:disable

MailDev

You can runmaildev which will allow you to send/receive emails without an external SMTP server. Add the following to yourvalues.yaml:

ingress:...maildevHostname:maildev.example.comdev:...deployMaildev:true

Object Storage

By default we bundle a single-nodeMinIO instance to allow you to test out object storage.This is not intended for production use, but is useful for development.

logfire

Version: 0.4.1AppVersion: ec5e2c3b

Helm chart for self-hosted Pydantic Logfire

Requirements

RepositoryNameVersion
https://charts.bitnami.com/bitnamiminio17.0.9
https://charts.bitnami.com/bitnamipostgresql16.7.15

Values

KeyTypeDefaultDescription
ai.azureOpenAi.apiKeystringnilThe Azure OpenAI API key
ai.azureOpenAi.apiVersionstringnilThe Azure OpenAI API version
ai.azureOpenAi.endpointstringnilThe Azure OpenAI endpoint
ai.modelstringnilThe AI provide and model to use. Prefix with the provider. I.e, For azure useazure:gpt-4o Seehttps://ai.pydantic.dev/models/ for more info
ai.openAi.apiKeystringnilThe OpenAI API key
ai.vertexAi.regionstringnilThe region for Vertex AI
devobject{"deployMaildev":false,"deployMinio":false,"deployPostgres":false}Development mode settings
dev.deployMaildevboolfalseDeploy maildev for testing emails
dev.deployMinioboolfalseDo NOT use this in production!
dev.deployPostgresboolfalseDo NOT use this in production!
existingSecretobject{"annotations":{},"enabled":false,"name":""}Existing Secret with the following keys logfire-dex-client-secret logfire-meta-write-token logfire-meta-frontend-token logfire-jwt-secret
existingSecret.annotationsobject{}Optional annotations for the secret, e.g., for external secret managers.
existingSecret.enabledboolfalseSet to true to use an existing secret. Highly recommended for Argo CD users.
existingSecret.namestring""The name of the Kubernetes Secret resource.
hooksAnnotationsstringnilCustom annotations for migration Jobs
image.pullPolicystring"IfNotPresent"The pull policy for docker images
imagePullSecretslist[]The secret used to pull down container images for pods
ingress.annotationsobject{}Any annotations required.
ingress.enabledboolfalseEnable Ingress Resource. If you're not using an ingress resource, you still need to configuretls,hostname
ingress.hostnamestring"logfire.example.com"The hostname used for Pydantic Logfire
ingress.ingressClassNamestring"nginx"
ingress.tlsboolfalseEnable TLS/HTTPS connections. Required for CORS headers
logfire-dexobject{"annotations":{},"config":{"connectors":[],"storage":{"config":{"database":"dex","host":"logfire-postgres","password":"postgres","port":5432,"ssl":{"mode":"disable"},"user":"postgres"},"type":"postgres"}},"podAnnotations":{},"replicas":1,"resources":{"cpu":"1","memory":"1Gi"},"service":{"annotations":{}}}Configuration, autoscaling & resources forlogfire-dex deployment
logfire-dex.annotationsobject{}Workload annotations
logfire-dex.configobject{"connectors":[],"storage":{"config":{"database":"dex","host":"logfire-postgres","password":"postgres","port":5432,"ssl":{"mode":"disable"},"user":"postgres"},"type":"postgres"}}Dex Config
logfire-dex.config.connectorslist[]Dex auth connectors, seehttps://dexidp.io/docs/connectors/ redirectURI config option can be omitted, as it will be automatically generated however if specified, the custom value will be honored
logfire-dex.config.storageobject{"config":{"database":"dex","host":"logfire-postgres","password":"postgres","port":5432,"ssl":{"mode":"disable"},"user":"postgres"},"type":"postgres"}Dex storage configuration, seehttps://dexidp.io/docs/configuration/storage/
logfire-dex.podAnnotationsobject{}Pod annotations
logfire-dex.replicasint1Number of replicas
logfire-dex.resourcesobject{"cpu":"1","memory":"1Gi"}resources
logfire-dex.service.annotationsobject{}Service annotations
logfire-ff-ingest.annotationsobject{}Workload annotations
logfire-ff-ingest.podAnnotationsobject{}Pod annotations
logfire-ff-ingest.service.annotationsobject{}Service annotations
logfire-ff-ingest.volumeClaimTemplatesobject{"storage":"16Gi"}Configuration for the PersistentVolumeClaim template for the stateful set.
logfire-ff-ingest.volumeClaimTemplates.storagestring"16Gi"The amount of storage to provision for each pod.
logfire-redis.enabledbooltrueEnable redis as part of this helm chart. Disable this if you want to provide your own redis instance.
logfire-redis.imageobject{"pullPolicy":"IfNotPresent","repository":"redis","tag":"7.2"}Redis image configuration
logfire-redis.image.pullPolicystring"IfNotPresent"Redis image pull policy
logfire-redis.image.repositorystring"redis"Redis image repository
logfire-redis.image.tagstring"7.2"Redis image tag
minio.args[0]string"server"
minio.args[1]string"/data"
minio.auth.rootPasswordstring"logfire-minio"
minio.auth.rootUserstring"logfire-minio"
minio.command[0]string"minio"
minio.fullnameOverridestring"logfire-minio"
minio.lifecycleHooks.postStart.exec.command[0]string"sh"
minio.lifecycleHooks.postStart.exec.command[1]string"-c"
minio.lifecycleHooks.postStart.exec.command[2]string"# Wait for the server to start\nsleep 5\n# Create a bucket\nmc alias set local http://localhost:9000 logfire-minio logfire-minio\nmc mb local/logfire\nmc anonymous set public local/logfire\n"
minio.persistence.mountPathstring"/data"
minio.persistence.sizestring"32Gi"
objectStoreobject{"env":{},"uri":null}Object storage details
objectStore.envobject{}additional env vars for the object store connection
objectStore.uristringnilUri for object storage i.e,s3://bucket
otel_collectorobject{"prometheus":{"add_metric_suffixes":false,"enable_open_metrics":true,"enabled":false,"endpoint":"0.0.0.0","metric_expiration":"180m","port":9090,"resource_to_telemetry_conversion":{"enabled":true},"send_timestamp":true}}Config for otel-collector
podSecurityContextobject{}Podsecurity context. See theAPI reference for details.
postgresDsnstring"postgresql://postgres:postgres@logfire-postgres:5432/crud"Postgres DSN used forcrud database
postgresFFDsnstring"postgresql://postgres:postgres@logfire-postgres:5432/ff"Postgres DSN used forff database
postgresSecretobject{"annotations":{},"enabled":false,"name":""}User provided postgres credentials containingpostgresDsn andpostgresFFDsn keys
postgresSecret.annotationsobject{}Optional annotations for the secret, e.g., for external secret managers.
postgresSecret.enabledboolfalseSet to true to use an existing secret. Highly recommended for Argo CD users.
postgresSecret.namestring""The name of the Kubernetes Secret resource.
postgresql.auth.postgresPasswordstring"postgres"
postgresql.fullnameOverridestring"logfire-postgres"
postgresql.postgresqlDataDirstring"/var/lib/postgresql/data/pgdata"
postgresql.primary.initdb.scripts."create_databases.sql"string"CREATE DATABASE crud;\nCREATE DATABASE dex;\nCREATE DATABASE ff;\n"
postgresql.primary.persistence.mountPathstring"/var/lib/postgresql"
postgresql.primary.persistence.sizestring"10Gi"
priorityClassNamestring""Specify a priority class name to setpod priority.
redisDsnstring"redis://logfire-redis:6379"The DSN for redis. Change from default if you have an external redis instance
revisionHistoryLimitint2Define thecount of deployment revisions to be kept. May be set to 0 in case of GitOps deployment approach.
securityContextobject{}Containersecurity context. See theAPI reference for details.
serviceAccountNamestring"default"the Kubernetes Service Account that is used by the pods
smtp.hoststringnilHostname of the SMTP server
smtp.passwordstringnilSMTP password
smtp.portint25Port of the SMTP server
smtp.use_tlsboolfalseWhether to use TLS
smtp.usernamestringnilSMTP username

Autogenerated from chart metadata usinghelm-docs v1.14.2

About

Helm Chart for running Logfire 🪵️‍🔥

Resources

Security policy

Stars

Watchers

Forks

Packages

No packages published

Contributors10

Languages


[8]ページ先頭

©2009-2025 Movatter.jp