Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot disable autologin or create unique creds for superuser #5321

Open
syoung-gaia opened this issue Dec 17, 2024 · 4 comments
Open

Cannot disable autologin or create unique creds for superuser #5321

syoung-gaia opened this issue Dec 17, 2024 · 4 comments
Assignees
Labels
bug Something isn't working

Comments

@syoung-gaia
Copy link

Bug Description

Looking at the code, I should only need to uncomment and add values to these few lines within my own values.yaml file:

    # autoLogin: true|false
    # superuser: <superuser login>
    # superuserPassword: <superuser password>
    # secretKey: <encryption key, optional>
    # newUserIsActive: true|false
    autoLogin: false
    superuser: "admin"
    superuserPassword: "Testing123"
    secretKey: "tEsTMysEcrETkEy"
    newUserIsActive: true

However, this block never gets inserted into the rendered manifest. There must either be a bug with Helm, or this if-statement within the backend-statefulset.yaml file isn't correct:

{{- if and (hasKey .Values.langflow.backend "autoLogin") (eq .Values.langflow.backend.autoLogin false) }}

Certainly looks right. But it also never works. I've checked everything imaginable, like running yamllint against my values.yaml file, and running helm template to see if any errors are received. Sure would be nice if Helm's --debug flag actually printed the logic steps & results. Why does something so seemingly innocuous always turns out to be rather deadly?

Reproduction

  1. Configure build scripts for your K8s/OpenShift environment accordingly using default values where possible.
  2. Build a working instance of Langflow
  3. Uncomment & configure AutoLogin/Superuser values appropriately
  4. Build modified instance of Langflow
  5. Test for AutoLogin disabled

Expected behavior

I expect AutoLogin o be disabled. The superuser & superuserPassword should be required to login to Langflow The Admin panel within the UI should be enabled. New users can be added and granted access to Langflow.

Who can help?

No response

Operating System

OpenShift 4.16

Langflow Version

1.1.1

Python Version

3.12

Screenshot

No response

Flow File

No response

@syoung-gaia syoung-gaia added the bug Something isn't working label Dec 17, 2024
Copy link

dosubot bot commented Dec 17, 2024

Hey @syoung-gaia! I'm here to help you with any bugs, questions, or contributions you have in mind. Let's work together to solve this issue!

The issue you're experiencing with the autoLogin setting not being applied in the rendered manifest could be due to how the Helm chart processes the values.yaml file. Here are a few things to check:

  1. Path in values.yaml: Ensure that the path in your values.yaml file matches the expected structure in the Helm chart. The autoLogin and related parameters should be nested under the correct hierarchy, such as langflow.backend. For example:

    langflow:
      backend:
        autoLogin: false
        superuser: "admin"
        superuserPassword: "Testing123"
        secretKey: "tEsTMysEcrETkEy"
        newUserIsActive: true
  2. Helm Template Logic: The conditional logic in backend-statefulset.yaml seems correct, but ensure that the values.yaml file is correctly formatted and that there are no indentation issues. YAML is sensitive to spaces and indentation, which can affect how values are parsed.

  3. Helm Debugging: While Helm's --debug flag might not show logic steps, you can use helm template to render the templates locally and inspect the output. This can help identify if the values are being correctly substituted.

  4. Helm Version: Ensure you are using a compatible version of Helm that supports the features used in the chart. Sometimes, discrepancies in Helm versions can lead to unexpected behavior.

  5. Check for Overrides: Verify that there are no other Helm value files or command-line overrides that might be affecting the values you set in values.yaml.

If these steps don't resolve the issue, it might be helpful to review the Helm chart's documentation or source code to ensure there are no additional conditions or settings affecting the autoLogin parameter.

To continue talking to Dosu, mention @dosu.


Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Other

@syoung-gaia
Copy link
Author

@dosu I have previously done all those things you suggest. Otherwise, I would have solved the problem and not needed to submit this issue to GitHub. But thank you for trying anyway...

Copy link

dosubot bot commented Dec 17, 2024

This is a tough nut to crack, could really use your help on this, @ogabrielluiz.

To continue talking to Dosu, mention @dosu.


Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Other

@Cristhianzl
Copy link
Member

Cristhianzl commented Dec 23, 2024

Hi @syoung-gaia,
I've created a working deployment of Langflow on Kubernetes that fixes the autoLogin and superuser configuration. Here's the complete solution:

First, create this folder structure:

helm/
├── Chart.yaml
├── templates/
│ ├── deployment.yaml
│ └── service.yaml
└── values.yaml

Create Chart.yaml:

apiVersion: v2
name: langflow
description: A Helm chart for Langflow
version: 0.1.0
appVersion: "1.1.1"

Create values.yaml:

langflow:
  backend:
    autoLogin: false
    superuser: "admin"
    superuserPassword: "Testing123"
    secretKey: "tEsTMysEcrETkEy"
    newUserIsActive: true

Create templates/deployment.yaml:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: langflow
spec:
  replicas: 1
  selector:
    matchLabels:
      app: langflow
  template:
    metadata:
      labels:
        app: langflow
    spec:
      containers:
      - name: langflow
        image: langflowai/langflow:v1.1.1
        env:
        - name: CONFIG_DIR
          value: "/tmp"
        - name: LANGFLOW_PORT
          value: "7860"
        - name: LANGFLOW_HOST
          value: "0.0.0.0"
        - name: LANGFLOW_AUTO_LOGIN
          value: "false"
        - name: LANGFLOW_SUPERUSER
          value: "{{ .Values.langflow.backend.superuser }}"
        - name: LANGFLOW_SUPERUSER_PASSWORD
          value: "{{ .Values.langflow.backend.superuserPassword }}"
        - name: LANGFLOW_SECRET_KEY
          value: "{{ .Values.langflow.backend.secretKey }}"
        - name: LANGFLOW_NEW_USER_IS_ACTIVE
          value: "{{ .Values.langflow.backend.newUserIsActive }}"
        ports:
        - containerPort: 7860
          name: http
        livenessProbe:
          httpGet:
            path: /health
            port: 7860
          initialDelaySeconds: 30
          periodSeconds: 10
        readinessProbe:
          httpGet:
            path: /health
            port: 7860
          initialDelaySeconds: 30
          periodSeconds: 10

Create templates/service.yaml:

apiVersion: v1
kind: Service
metadata:
  name: langflow
spec:
  selector:
    app: langflow
  ports:
  - name: http
    port: 7860
    targetPort: 7860
  type: ClusterIP

To deploy:
Install the chart
helm install langflow . -f values.yaml -n langflow

Watch the pod status

kubectl get pods -n langflow -w

Key points addressed:

Fixed the port validation error by using proper environment variables
Configured autoLogin and superuser credentials correctly
Added health checks with appropriate timing
Set up proper service networking

The pod should now start successfully and you should be able to:

Access Langflow through the service
Login with the configured superuser credentials
Add new users as needed

You can download the full code here: helm.zip

Let me know if you need any clarification or run into other issues!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants