Skip to content

Commit

Permalink
Merge pull request #13 from langchain-ai/infra/connection_url_postgres
Browse files Browse the repository at this point in the history
Add support for using a connection url so we can specify connection p…
  • Loading branch information
langchain-infra authored Oct 26, 2023
2 parents b14f754 + dfda91e commit c5258db
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 63 deletions.
2 changes: 1 addition & 1 deletion charts/langsmith/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ maintainers:
email: [email protected]
description: Helm chart to deploy the langsmith application and all services it depends on.
type: application
version: 0.1.1
version: 0.1.2
appVersion: "0.1.0"
31 changes: 16 additions & 15 deletions charts/langsmith/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# langsmith

![Version: 0.1.1](https://img.shields.io/badge/Version-0.1.1-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 0.1.0](https://img.shields.io/badge/AppVersion-0.1.0-informational?style=flat-square)
![Version: 0.1.2](https://img.shields.io/badge/Version-0.1.2-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 0.1.0](https://img.shields.io/badge/AppVersion-0.1.0-informational?style=flat-square)

Helm chart to deploy the langsmith application and all services it depends on.

Expand Down Expand Up @@ -202,23 +202,23 @@ We typically validate deployment using the following Jupyter notebook:
| commonAnnotations | object | `{}` | Annotations that will be applied to all resources created by the chart |
| commonLabels | object | `{}` | Labels that will be applied to all resources created by the chart |
| fullnameOverride | string | `""` | String to fully override `"langsmith.fullname"` |
| images.backendImage.pullPolicy | string | `"Always"` | |
| images.backendImage.pullPolicy | string | `"IfNotPresent"` | |
| images.backendImage.repository | string | `"docker.io/langchain/langchainplus-backend"` | |
| images.backendImage.tag | string | `"latest"` | |
| images.frontendImage.pullPolicy | string | `"Always"` | |
| images.backendImage.tag | string | `"99d8f59"` | |
| images.frontendImage.pullPolicy | string | `"IfNotPresent"` | |
| images.frontendImage.repository | string | `"docker.io/langchain/langchainplus-frontend-dynamic"` | |
| images.frontendImage.tag | string | `"latest"` | |
| images.hubBackendImage.pullPolicy | string | `"Always"` | |
| images.frontendImage.tag | string | `"99d8f59"` | |
| images.hubBackendImage.pullPolicy | string | `"IfNotPresent"` | |
| images.hubBackendImage.repository | string | `"docker.io/langchain/langchainhub-backend"` | |
| images.hubBackendImage.tag | string | `"latest"` | |
| images.hubBackendImage.tag | string | `"99d8f59"` | |
| images.imagePullSecrets | list | `[]` | Secrets with credentials to pull images from a private registry. Specified as name: value. |
| images.playgroundImage.pullPolicy | string | `"Always"` | |
| images.playgroundImage.pullPolicy | string | `"IfNotPresent"` | |
| images.playgroundImage.repository | string | `"docker.io/langchain/langchainplus-playground"` | |
| images.playgroundImage.tag | string | `"latest"` | |
| images.postgresImage.pullPolicy | string | `"Always"` | |
| images.playgroundImage.tag | string | `"99d8f59"` | |
| images.postgresImage.pullPolicy | string | `"IfNotPresent"` | |
| images.postgresImage.repository | string | `"docker.io/postgres"` | |
| images.postgresImage.tag | string | `"14.7"` | |
| images.redisImage.pullPolicy | string | `"Always"` | |
| images.redisImage.pullPolicy | string | `"IfNotPresent"` | |
| images.redisImage.repository | string | `"docker.io/redis"` | |
| images.redisImage.tag | string | `"7"` | |
| ingress.annotations | object | `{}` | |
Expand Down Expand Up @@ -352,13 +352,14 @@ We typically validate deployment using the following Jupyter notebook:
| Key | Type | Default | Description |
|-----|------|---------|-------------|
| postgres.containerPort | int | `5432` | |
| postgres.external.database | string | `""` | |
| postgres.external.connectionUrl | string | `""` | |
| postgres.external.database | string | `"postgres"` | |
| postgres.external.enabled | bool | `false` | |
| postgres.external.existingSecretName | string | `""` | |
| postgres.external.host | string | `""` | |
| postgres.external.password | string | `""` | |
| postgres.external.port | int | `5432` | |
| postgres.external.user | string | `""` | |
| postgres.external.password | string | `"postgres"` | |
| postgres.external.port | string | `"5432"` | |
| postgres.external.user | string | `"postgres"` | |
| postgres.name | string | `"postgres"` | |
| postgres.service.annotations | object | `{}` | |
| postgres.service.labels | object | `{}` | |
Expand Down
24 changes: 2 additions & 22 deletions charts/langsmith/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -108,31 +108,11 @@ the user or some other secret provisioning mechanism
Template containing common environment variables that are used by several services.
*/}}
{{- define "langsmith.commonEnv" -}}
- name: POSTGRES_PORT
- name: POSTGRES_DATABASE_URI
valueFrom:
secretKeyRef:
name: {{ include "langsmith.postgresSecretsName" . }}
key: port
- name: POSTGRES_HOST
valueFrom:
secretKeyRef:
name: {{ include "langsmith.postgresSecretsName" . }}
key: host
- name: POSTGRES_USER
valueFrom:
secretKeyRef:
name: {{ include "langsmith.postgresSecretsName" . }}
key: user
- name: POSTGRES_PASSWORD
valueFrom:
secretKeyRef:
name: {{ include "langsmith.postgresSecretsName" . }}
key: password
- name: POSTGRES_DB
valueFrom:
secretKeyRef:
name: {{ include "langsmith.postgresSecretsName" . }}
key: database
key: connection_url
- name: REDIS_DATABASE_URI
valueFrom:
secretKeyRef:
Expand Down
2 changes: 1 addition & 1 deletion charts/langsmith/templates/playground/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ spec:
{{- end }}
selector:
matchLabels:
{{- include "langsmith.labels" . | nindent 6 }}
{{- include "langsmith.selectorLabels" . | nindent 6 }}
app.kubernetes.io/name: {{ include "langsmith.fullname" . }}-{{ .Values.playground.name }}
template:
metadata:
Expand Down
16 changes: 6 additions & 10 deletions charts/langsmith/templates/postgres/secrets.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,12 @@ metadata:
{{- include "langsmith.annotations" . | nindent 4 }}
data:
{{- if .Values.postgres.external.enabled }}
user: {{ .Values.postgres.external.user | b64enc }}
password: {{ .Values.postgres.external.password | b64enc }}
database: {{ .Values.postgres.external.database | b64enc }}
host: {{ .Values.postgres.external.host | b64enc }}
port: {{ .Values.postgres.external.port | b64enc }}
{{- if .Values.postgres.external.connectionUrl }}
connection_url: {{ .Values.postgres.external.connectionUrl | b64enc }}
{{- else }}
user: {{ "postgres" | b64enc }}
password: {{ "postgres" | b64enc }}
database: {{ "postgres" | b64enc }}
host: {{ printf "%s-%s" (include "langsmith.fullname" .) .Values.postgres.name | b64enc }}
port: {{ "5432" | b64enc }}
connection_url: {{ printf "%s:%s@%s:%s/%s" .Values.postgres.external.user .Values.postgres.external.password .Values.postgres.external.host (toString .Values.postgres.external.port) .Values.postgres.external.database | b64enc }}
{{- end }}
{{- else }}
connection_url: {{ printf "postgres:postgres@%s-%s:%s/postgres" (include "langsmith.fullname" .) .Values.postgres.name (toString .Values.postgres.service.port) | b64enc }}
{{- end}}
{{- end }}
31 changes: 17 additions & 14 deletions charts/langsmith/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,27 +14,27 @@ images:
imagePullSecrets: []
backendImage:
repository: "docker.io/langchain/langchainplus-backend"
pullPolicy: Always
tag: "latest"
pullPolicy: IfNotPresent
tag: "99d8f59"
frontendImage:
repository: "docker.io/langchain/langchainplus-frontend-dynamic"
pullPolicy: Always
tag: "latest"
pullPolicy: IfNotPresent
tag: "99d8f59"
hubBackendImage:
repository: "docker.io/langchain/langchainhub-backend"
pullPolicy: Always
tag: "latest"
pullPolicy: IfNotPresent
tag: "99d8f59"
playgroundImage:
repository: "docker.io/langchain/langchainplus-playground"
pullPolicy: Always
tag: "latest"
pullPolicy: IfNotPresent
tag: "99d8f59"
postgresImage:
repository: "docker.io/postgres"
pullPolicy: Always
pullPolicy: IfNotPresent
tag: "14.7"
redisImage:
repository: "docker.io/redis"
pullPolicy: Always
pullPolicy: IfNotPresent
tag: "7"

ingress:
Expand Down Expand Up @@ -192,10 +192,13 @@ postgres:
# creation of a postgres stateful-set and service.
enabled: false
host: ""
port: 5432
user: ""
password: ""
database: ""
port: "5432"
user: "postgres"
password: "postgres"
database: "postgres"
# If connection string is specified, we will ignore all above values and use the connection string instead.
# Do not include the driver name(something like "postgres://" in the connection string.
connectionUrl: ""
existingSecretName: ""
containerPort: 5432
statefulSet:
Expand Down

0 comments on commit c5258db

Please sign in to comment.