Environment Variables and Configuration

Introduction

This document outlines the Environment Variables and Configuration for HelixML, a powerful machine learning platform. Environment variables play a crucial role in configuring HelixML, enabling flexible customization and adaptation to different deployment scenarios. This document provides a comprehensive overview of environment variables, their usage, and their impact on HelixML’s behavior.

Environment Variables

HelixML relies on environment variables to manage critical configuration parameters. These variables are set within the .env file, located at the root of the project.

Environment Variables for HelixML

The following table lists key environment variables used in HelixML and their purposes.

Variable Name Description Default Value Example
APPLICATION_NAME The name of the application. “helix” APPLICATION_NAME=my-helix-app
APPLICATION_VERSION The version of the application. “0.0.1” APPLICATION_VERSION=1.2.3
ENVIRONMENT The environment the application is running in (e.g., “development”, “production”). “development” ENVIRONMENT=production
DATABASE_URL The URL to the database. postgres://user:password@host:port/database DATABASE_URL=postgres://myuser:mypassword@localhost:5432/mydatabase
KEYCLOAK_URL The URL to the Keycloak server. http://localhost:8080/auth KEYCLOAK_URL=https://my-keycloak.example.com/auth
KEYCLOAK_REALM The Keycloak realm name. “helix” KEYCLOAK_REALM=my-helix-realm
KEYCLOAK_CLIENT_ID The Keycloak client ID. “helix-client” KEYCLOAK_CLIENT_ID=my-helix-client
KEYCLOAK_CLIENT_SECRET The Keycloak client secret. “secret” KEYCLOAK_CLIENT_SECRET=my-client-secret
REDIS_URL The URL to the Redis server. redis://localhost:6379 REDIS_URL=redis://myredis.example.com:6379
ELASTICSEARCH_URL The URL to the Elasticsearch server. http://localhost:9200 ELASTICSEARCH_URL=https://my-elasticsearch.example.com:9200
LOG_LEVEL The logging level. “info” LOG_LEVEL=debug
PORT The port the application listens on. “8080” PORT=8081
JWT_SECRET The secret key for JWT authentication. “secret” JWT_SECRET=my-secret-key
CORS_ALLOWED_ORIGINS A comma-separated list of allowed origins for CORS. ”*” CORS_ALLOWED_ORIGINS=http://localhost:3000,https://my-app.example.com

Creating and Editing the .env File

The .env file is a standard way to manage environment variables in a project. It can be created using a text editor and should be placed at the root of the project.

Important: The .env file should be added to .gitignore to prevent sensitive information from being committed to the repository.

Updating Keycloak Realm Settings

The KEYCLOAK_URL, KEYCLOAK_REALM, KEYCLOAK_CLIENT_ID, and KEYCLOAK_CLIENT_SECRET variables are used to configure the Keycloak integration in HelixML. These settings should be adjusted to match your specific Keycloak installation.

Steps:

  1. Access the Keycloak Administration Console: Log in to your Keycloak server.
  2. Navigate to the helix realm: Select the “helix” realm (or your chosen realm name).
  3. Create a client: Click “Clients” and create a new client.
  4. Configure client details: Set the client ID and secret.
  5. Update environment variables: Update the relevant environment variables in the .env file.

Additional Notes

  • It is important to never commit the .env file to version control (e.g., Git).
  • Environment variables are crucial for ensuring a secure and flexible deployment strategy.
  • Different deployment environments (development, staging, production) might require different configurations.
  • Always consult the relevant documentation for specific environment variables.

Source: https://github.com/helixml/helix/

This outline is a starting point, and you might need to adapt it based on the specific needs and details of your project.