charts icon indicating copy to clipboard operation
charts copied to clipboard

How do you specify your .env values?

Open asdbnasd2OPasd opened this issue 1 year ago • 2 comments

Sorry for probably missing something really obvious - but how do you do the setup the values?

I can see the avilable variables here: https://docs.soketi.app/app-management/array-driver

But when installing with helm, how do I pass SOKETI_DEFAULT_APP_ID, SOKETI_DEFAULT_APP_KEY, SOKETI_DEFAULT_APP_SECRET? Thanks

TIA

asdbnasd2OPasd avatar Oct 11 '23 12:10 asdbnasd2OPasd

The codebase is a web application that uses Soketi, a simple, fast and resilient open-source WebSockets server written in Typescript. It's built on top of uWebSockets.js, one of the most efficient WebSocket libraries. The application is deployed using Helm, a package manager for Kubernetes. The .env file is used to store environment variables that are used across the application. The user wants to know how to set the values for SOKETI_DEFAULT_APP_ID, SOKETI_DEFAULT_APP_KEY, and SOKETI_DEFAULT_APP_SECRET when installing with Helm.

Assistant's Solution

When installing with Helm, you can pass environment variables through the values.yaml file or directly through the command line.

Here's how you can do it:

  1. Using values.yaml file:

In your Helm chart, you should have a values.yaml file. You can specify your environment variables there. For example:

env:
  SOKETI_DEFAULT_APP_ID: your_app_id
  SOKETI_DEFAULT_APP_KEY: your_app_key
  SOKETI_DEFAULT_APP_SECRET: your_app_secret

Then, in your deployment.yaml file (which should be in the templates folder of your Helm chart), you can use these values:

spec:
  containers:
    - name: your_container_name
      image: your_image_name
      env:
        - name: SOKETI_DEFAULT_APP_ID
          value: {{ .Values.env.SOKETI_DEFAULT_APP_ID }}
        - name: SOKETI_DEFAULT_APP_KEY
          value: {{ .Values.env.SOKETI_DEFAULT_APP_KEY }}
        - name: SOKETI_DEFAULT_APP_SECRET
          value: {{ .Values.env.SOKETI_DEFAULT_APP_SECRET }}
  1. Directly through the command line:

You can also pass the environment variables directly through the command line when installing the Helm chart:

helm install your_chart_name . --set env.SOKETI_DEFAULT_APP_ID=your_app_id,env.SOKETI_DEFAULT_APP_KEY=your_app_key,env.SOKETI_DEFAULT_APP_SECRET=your_app_secret

Remember to replace your_app_id, your_app_key, and your_app_secret with your actual values.


Current plan usage: 10.92%


Have feedback or need help?

Discord Documentation [email protected]

codeautopilot[bot] avatar Oct 11 '23 12:10 codeautopilot[bot]

The helm cli example did not work for me as the deployment does not contain any setting for the env variabled.

Did this instead; I added it from a secret which I already created for my laravel app in k8s: values.yaml

app:
  extraEnv:
      - name: SOKETI_DEFAULT_APP_ID
        valueFrom:
          secretKeyRef:
            name: app-env-secrets
            key: PUSHER_APP_ID
      - name: SOKETI_DEFAULT_APP_KEY
        valueFrom:
          secretKeyRef:
            name: app-env-secrets
            key: PUSHER_APP_KEY
      - name: SOKETI_DEFAULT_APP_SECRET
        valueFrom:
          secretKeyRef:
            name: app-env-secrets
            key: PUSHER_APP_SECRET

maxvisser avatar Apr 02 '24 12:04 maxvisser