saleor
A Helm chart for deploying Saleor e-commerce platform with Dashboard
About this chart
Saleor Helm Chart
This is a community-maintained Helm chart for deploying Saleor, a modular, high performance, headless e-commerce platform built with Python, GraphQL, Django, and React. This chart is not officially associated with or maintained by the Saleor team.
Features
- Full Saleor stack deployment (API, Dashboard, Worker)
- Production-grade PostgreSQL configuration with read replica support
- Redis for caching and Celery tasks
- Service mesh integration for improved performance
- Horizontal Pod Autoscaling
- Configurable resource management
- Comprehensive security settings
Prerequisites
- Kubernetes 1.19+
- Helm 3.2.0+
- PV provisioner support in the underlying infrastructure
- Istio (optional, for service mesh features)
Quick Start
- Add the Helm repository:
helm repo add trieb-work https://trieb-work.github.io/helm-charts
helm repo update
- Install the chart:
helm install my-saleor trieb-work/saleor
Architecture
The chart deploys the following components:
- Saleor API server
- Saleor Dashboard
- Celery workers
- PostgreSQL database (optional)
- Redis (optional)
- Service mesh configuration (optional)
Configuration
Global Configuration
global:
# -- Global image pull secrets
imagePullSecrets: []
# -- Storage class to use for persistent volumes
storageClass: ""
# -- External Database URL (if not using internal PostgreSQL)
databaseUrl: ""
# -- External Redis URL (if not using internal Redis)
redisUrl: ""
# -- RSA private key for JWT signing
jwtRsaPrivateKey: ""
# -- Global TLS certificate configuration
tls:
# -- Enable global TLS certificate
enabled: false
# -- Existing TLS secret name to use for all ingress resources
secretName: "my-wildcard-tls-secret"
database:
primaryUrl: "" # External primary database URL
replicaUrl: "" # External read replica URL
maxConnections: 150
connectionTimeout: 5
The global.tls configuration allows you to enable a global TLS certificate for all ingress resources. When enabled, you can specify an existing TLS secret name to use for all ingress resources. This can be useful for deploying a wildcard TLS certificate for your domain.
JWT Configuration
Saleor uses RSA private/public key pairs for JWT token signing. You must configure this for production deployments. Here's how to set it up:
-
Generate a new RSA key pair (if you don't have one):
# Generate private key openssl genrsa -out private.pem 4096 # Generate public key openssl rsa -in private.pem -pubout -out public.pem -
Add the private key to your values file:
global: jwtRsaPrivateKey: | -----BEGIN PRIVATE KEY----- Your RSA private key here -----END PRIVATE KEY-----
The private key will be automatically mounted in both the API and worker services. Keep your private key secure and never commit it to version control.
Note: If jwtRsaPrivateKey is not set, Saleor will use a temporary key in development mode, but this is not suitable for production use.
Database Configuration
The chart offers several options for configuring the database, including support for read replicas:
1. Using the Built-in PostgreSQL Database
By default, the chart will deploy a PostgreSQL instance and automatically manage the credentials:
postgresql:
enabled: true
# Choose between standalone or replication architecture
architecture: replication # or 'standalone'
auth:
username: saleor
database: saleor
# Optional: Provide specific passwords, otherwise they will be auto-generated
existingSecret: postgresql-credentials
secretKeys:
userPasswordKey: password
adminPasswordKey: postgresql-password
replicationPasswordKey: replication-password # Required for replication
# Primary database configuration
primary:
persistence:
size: 50Gi
resources:
requests:
cpu: 2
memory: 4Gi
# Read replica configuration (only used when architecture: replication)
readReplicas:
replicaCount: 1
persistence:
size: 50Gi
When using the built-in PostgreSQL with architecture: replication:
- A read-only replica service is created at
<release>-postgresql-read - Saleor automatically uses this replica for read operations to reduce load on the primary
- The primary database at
<release>-postgresql-primaryis still used for all write operations
The PostgreSQL credentials are stored in a Kubernetes secret named postgresql-credentials. This secret is marked with helm.sh/resource-policy: keep to ensure the credentials persist across Helm upgrades.
2. Using an External Database
To use an external database, disable the built-in PostgreSQL and provide your database URLs:
postgresql:
enabled: false
global:
database:
primaryUrl: "postgresql://user:password@your-db-host:5432/saleor"
replicaUrl: "postgresql://user:password@your-read-replica:5432/saleor" # Optional
maxConnections: 150
connectionTimeout: 5
When configuring external databases:
- The
primaryUrlis required and will be used for all operations if no replica is configured - The
replicaUrlis optional - when provided, Saleor will use it for read operations to reduce load on the primary - Only a single read replica is supported
Managing Database Credentials
If you're using the built-in PostgreSQL, you have two options for managing credentials:
- Auto-generated passwords: If you don't provide passwords, they will be automatically generated during installation
- Manual secret management: Create the secret before installation:
kubectl create secret generic postgresql-credentials \ --from-literal=password=user-password \ --from-literal=postgresql-password=admin-password \ --from-literal=replication-password=replication-password # Only needed for replication
Important notes about database passwords:
- Generated passwords are preserved across Helm upgrades via the
helm.sh/resource-policy: keepannotation - To rotate passwords:
- Delete the existing
postgresql-credentialssecret - Either let the chart generate new passwords or provide new ones in your values
- Upgrade the release
- Delete the existing
Redis Configuration
The chart offers several options for configuring Redis:
1. Using the Built-in Redis
By default, the chart will deploy a Redis instance using the Bitnami Redis chart:
redis:
enabled: true
architecture: standalone
auth:
enabled: true
# Optional: Provide a specific password
password: "your-password" # If not set, a random password will be generated
master:
persistence:
size: 8Gi
resources:
requests:
cpu: 100m
memory: 128Mi
The Redis password is stored in a Kubernetes secret and will be preserved across Helm upgrades.
2. Using an External Redis
To use an external Redis instance, disable the built-in Redis and configure the external connection:
redis:
enabled: false
external:
host: "my-redis.example.com"
port: 6379
database: 0
username: "redis-user" # Optional, for Redis ACLs
password: "redis-password"
tls:
enabled: false # Set to true for TLS/SSL connections
3. Using a Global Redis URL
For complete control over the Redis URL, you can provide it directly:
global:
redisUrl: "redis://user:[email protected]:6379/0"
# Or with TLS:
# redisUrl: "rediss://user:[email protected]:6379/0"
Important Notes About Redis Configuration
- If using built-in Redis without a specified password, a random one will be generated during first installation
- The generated password will be preserved across Helm upgrades
- Redis URL format:
redis[s]://[username][:password]@host:port/database- Use
redis://for standard connections - Use
rediss://for TLS/SSL connections - Username is optional and only needed for Redis ACLs
- Database number is optional (defaults to 0)
- Use
- When using external Redis with TLS:
- Set
redis.external.tls.enabled: true - The connection will use the
rediss://protocol - You can optionally skip TLS verification with
redis.external.tls.insecureSkipVerify: true
- Set
API Configuration
api:
enabled: true
replicaCount: 1
image:
repository: ghcr.io/saleor/saleor
tag: "3.19.0"
resources:
requests:
cpu: 500m
memory: 1Gi
autoscaling:
enabled: true
minReplicas: 1
maxReplicas: 5
Dashboard Configuration
dashboard:
enabled: true
replicaCount: 1
image:
repository: ghcr.io/saleor/saleor-dashboard
tag: "3.19.0"
resources:
requests:
cpu: 100m
memory: 128Mi
Worker Configuration
worker:
enabled: true
replicaCount: 1
resources:
requests:
cpu: 200m
memory: 512Mi
autoscaling:
enabled: false
minReplicas: 1
maxReplicas: 3
Service Mesh Configuration
serviceMesh:
enabled: false
istio:
enabled: false
api:
circuitBreaker:
enabled: true
maxConnections: 100
timeout:
enabled: true
http: 10s
Storage Configuration
The chart supports both S3-compatible storage and Google Cloud Storage (GCS) for storing media and static files.
Amazon S3 Configuration
Enable S3 storage by configuring the following in your values file:
storage:
s3:
enabled: true
credentials:
accessKeyId: "your-access-key"
secretAccessKey: "your-secret-key"
config:
region: "us-east-1"
bucketName: "your-bucket-name"
# Optional configurations
staticBucketName: "your-static-bucket" # Separate bucket for static files
mediaBucketName: "your-media-bucket" # Separate bucket for media files
mediaPrivateBucketName: "private-bucket" # Separate bucket for private media
customDomain: "cdn.yourdomain.com" # Custom domain for serving files
defaultAcl: "public-read"
queryStringAuth: false
For more details on S3 configuration, see the official Saleor documentation.
Google Cloud Storage Configuration
To use Google Cloud Storage, configure the following:
storage:
gcs:
enabled: true
# When running on GKE with Workload Identity (recommended)
serviceAccount:
create: true
annotations:
iam.gke.io/gcp-service-account: saleor-gcs@YOUR_PROJECT_ID.iam.gserviceaccount.com
config:
bucketName: "your-bucket-name"
# Optional configurations
staticBucketName: "your-static-bucket"
mediaBucketName: "your-media-bucket"
mediaPrivateBucketName: "private-bucket"
customDomain: "cdn.yourdomain.com"
defaultAcl: "publicRead"
For more details on GCS configuration, see the official Saleor documentation.
Complete S3 Configuration Example
Here's a complete example of S3 configuration using CloudFront for content delivery:
storage:
s3:
enabled: true
credentials:
accessKeyId: "AKIAIOSFODNN7EXAMPLE"
secretAccessKey: "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY"
config:
region: "us-east-1"
# Using separate buckets for different types of content
staticBucketName: "my-shop-static" # Public bucket for static files
mediaBucketName: "my-shop-media" # Public bucket for uploaded media
mediaPrivateBucketName: "my-shop-priv" # Private bucket for sensitive data
# Using CloudFront distributions for content delivery
customDomain: "static.myshop.com" # CloudFront domain for static files
mediaCustomDomain: "media.myshop.com" # CloudFront domain for media files
# Access control
defaultAcl: "public-read" # Make files publicly readable
queryStringAuth: false # Disable signed URLs
queryStringExpire: 3600 # 1 hour expiration for signed URLs (if enabled)
Here's an example using MinIO or other S3-compatible storage:
storage:
s3:
enabled: true
credentials:
accessKeyId: "minio-access-key"
secretAccessKey: "minio-secret-key"
config:
region: "us-east-1" # Required but might not be used
# Using a single bucket with different prefixes
staticBucketName: "saleor"
mediaBucketName: "saleor"
mediaPrivateBucketName: "saleor-private"
# Using custom domains
customDomain: "storage.example.com" # Domain for static files
mediaCustomDomain: "storage.example.com" # Domain for media files
# Access control
defaultAcl: "public-read"
queryStringAuth: false
queryStringExpire: 3600
Note: When using CloudFront or another CDN:
- Configure CORS appropriately for your domains
- Set up proper cache behaviors for static vs media content
- For private media, ensure the bucket is not publicly accessible
Database Migrations
Django requires database migrations to be run after version upgrades. This chart provides two ways to handle migrations:
1. Automatic Migrations (Recommended)
By default, the chart will automatically run migrations after installation and upgrades using a Kubernetes Job:
migrations:
enabled: true # Enable automatic migrations
# Additional environment variables specific to migrations
extraEnv: [] # Add migration-specific env vars if needed
resources: # Configure resources for the migration job
requests:
cpu: 100m
memory: 256Mi
limits:
cpu: 200m
memory: 512Mi
The migration job:
- Runs after install/upgrade using Helm hooks
- Uses
Deploy saleor with OpenTenant
Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has saleor on a Hetzner server. Change the host, add apps from the marketplace, then copy the generated files. Providers and prices are samples, and nothing here is sent anywhere.
- Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
- Place the chartsaleor is pinned at v2.3.9 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
- ApplySave opentenant.yaml and main.tf from the console, then run the commands below.
# opentenant.yaml, main.tf and dns.tf come from the builder below opentenant validate opentenant.yaml terraform init && terraform apply