### Installing Distr with Helm (Shell) Source: https://github.com/glasskube/distr/blob/main/deploy/charts/distr/README.md This command installs or upgrades the Distr Helm chart from the ghcr.io OCI registry. It waits for the installation to complete, creates the 'distr' namespace if it doesn't exist, and enables the bundled PostgreSQL and MinIO dependencies. Requires Helm to be installed. ```Shell helm upgrade --install --wait --namespace distr --create-namespace \ distr oci://ghcr.io/glasskube/charts/distr --version 1.0.0 \ --set postgresql.enabled=true --set minio.enabled=true ``` -------------------------------- ### Installing Distr SDK with npm Source: https://github.com/glasskube/distr/blob/main/sdk/js/README.md This command installs the Distr SDK package from npmjs.org and adds it as a dependency to your project's package.json file. ```Shell npm install --save @glasskube/distr-sdk ``` -------------------------------- ### Installing Distr Hub with Helm Chart (Shell) Source: https://github.com/glasskube/distr/blob/main/README.md Provides a shell command using Helm to install the Distr Hub chart from ghcr.io into a Kubernetes cluster, enabling PostgreSQL and MinIO for a quick testing setup. ```shell helm upgrade --install --wait --namespace distr --create-namespace \ distr oci://ghcr.io/glasskube/charts/distr \ --set postgresql.enabled=true --set minio.enabled=true ``` -------------------------------- ### Running Distr Hub Locally (Shell) Source: https://github.com/glasskube/distr/blob/main/README.md Commands to start the necessary services (database, mock SMTP) using Docker Compose and then run the Distr Hub application using Make for local development. ```Shell # Start the database and a mock SMTP server docker-compose up -d # Start Distr Hub make run ``` -------------------------------- ### Installing Distr SDK for JavaScript (Shell) Source: https://github.com/glasskube/distr/blob/main/README.md Command to install the official Distr SDK for JavaScript applications using the npm package manager. The SDK is published on npmjs.org. ```Shell npm install --save @glasskube/distr-sdk ``` -------------------------------- ### Getting Applications (TypeScript) Source: https://github.com/glasskube/distr/blob/main/sdk/js/docs/classes/Client.md Retrieves a list of all applications. This method takes no parameters and returns a promise resolving to an array of Application objects. ```TypeScript getApplications(): Promise ``` -------------------------------- ### Getting Deployment Targets (TypeScript) Source: https://github.com/glasskube/distr/blob/main/sdk/js/docs/classes/Client.md Retrieves a list of all deployment targets. This method takes no parameters and returns a promise resolving to an array of DeploymentTarget objects. ```TypeScript getDeploymentTargets(): Promise ``` -------------------------------- ### Get Application URL via NodePort (Shell) Source: https://github.com/glasskube/distr/blob/main/deploy/charts/distr/templates/NOTES.txt This snippet, used when the service type is NodePort, uses kubectl to find the assigned NodePort and a node's IP address, then constructs and prints the application URL. Requires kubectl access to the cluster. ```Shell {{- else if contains "NodePort" .Values.service.type }} export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "distr.fullname" . }}) export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") echo http://$NODE_IP:$NODE_PORT {{- end }} ``` -------------------------------- ### Getting Application (TypeScript) Source: https://github.com/glasskube/distr/blob/main/sdk/js/docs/classes/Client.md Retrieves a specific application by its ID. It takes the application ID as input and returns a promise resolving to the requested Application object. ```TypeScript getApplication(applicationId): Promise ``` -------------------------------- ### Get Application URL via LoadBalancer (Shell) Source: https://github.com/glasskube/distr/blob/main/deploy/charts/distr/templates/NOTES.txt For LoadBalancer services, this code retrieves the assigned external IP using kubectl and prints the application URL. Includes a note about potential delays in IP assignment. Requires kubectl access to the cluster. ```Shell {{- else if contains "LoadBalancer" .Values.service.type }} NOTE: It may take a few minutes for the LoadBalancer IP to be available. You can watch its status by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "distr.fullname" . }}' export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "distr.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}") echo http://$SERVICE_IP:{{ .Values.service.port }} {{- end }} ``` -------------------------------- ### Deploying Distr Hub with Docker Compose (Shell) Source: https://github.com/glasskube/distr/blob/main/README.md Provides shell commands to download the Docker Compose configuration for Distr Hub, make necessary environment variable changes, and start the services in detached mode. ```shell mkdir distr && cd distr && curl -fsSL https://github.com/glasskube/distr/releases/latest/download/deploy-docker.tar.bz2 | tar -jx # make necessary changes to the .env file docker-compose up -d ``` -------------------------------- ### Get Application URL via Ingress (Helm Template) Source: https://github.com/glasskube/distr/blob/main/deploy/charts/distr/templates/NOTES.txt This Helm template block generates potential application URLs based on the configured Ingress hosts and paths defined in the chart's values. It outputs HTTP or HTTPS URLs depending on the 'ingress.tls' setting. ```Helm Template {{- if .Values.ingress.enabled }} {{- range $host := .Values.ingress.hosts }} {{- range .paths }} http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ .path }} {{- end }} {{- end }} {{- end }} ``` -------------------------------- ### Getting Deployment Target (TypeScript) Source: https://github.com/glasskube/distr/blob/main/sdk/js/docs/classes/Client.md Retrieves a specific deployment target by its ID. It takes the deployment target ID as input and returns a promise resolving to the requested DeploymentTarget object. ```TypeScript getDeploymentTarget(deploymentTargetId): Promise ``` -------------------------------- ### Access Application via ClusterIP with Port Forwarding (Shell) Source: https://github.com/glasskube/distr/blob/main/deploy/charts/distr/templates/NOTES.txt When using a ClusterIP service, this snippet finds a running pod and its container port, then sets up local port-forwarding using kubectl to access the application via localhost. Requires kubectl access to the cluster. ```Shell {{- else if contains "ClusterIP" .Values.service.type }} export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "distr.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") export CONTAINER_PORT=$(kubectl get pod --namespace {{ .Release.Namespace }} $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}") echo "Visit http://127.0.0.1:8080 to use your application" kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:$CONTAINER_PORT {{- end }} ``` -------------------------------- ### Constructing Client (TypeScript) Source: https://github.com/glasskube/distr/blob/main/sdk/js/docs/classes/Client.md Initializes a new instance of the Client class. It requires a configuration object to set up the client, potentially including the API base URL. ```TypeScript new Client(config): Client ``` -------------------------------- ### Initializing DistrService Client in TypeScript Source: https://github.com/glasskube/distr/blob/main/sdk/js/README.md This snippet demonstrates how to import and create an instance of the high-level `DistrService`. It requires providing your Personal Access Token via the `apiKey` option. Optionally, you can specify a custom API base URL. ```TypeScript import {DistrService} from '@glasskube/distr-sdk'; const service = new DistrService({ // to use your selfhosted instance, set apiBase: 'https://selfhosted-instance.company/api/v1', apiKey: '' }); // do something with the service ``` -------------------------------- ### Creating Access for Deployment Target (TypeScript) Source: https://github.com/glasskube/distr/blob/main/sdk/js/docs/classes/Client.md Creates access credentials or information for a specific deployment target. It takes the deployment target's ID as input and returns a promise resolving to the access response. ```TypeScript createAccessForDeploymentTarget(deploymentTargetId): Promise ``` -------------------------------- ### Creating Application Version (TypeScript) Source: https://github.com/glasskube/distr/blob/main/sdk/js/docs/classes/Client.md Creates a new version for an existing application. It requires the application ID, the version details, and optionally files associated with the version, returning a promise for the created ApplicationVersion. ```TypeScript createApplicationVersion(applicationId, version, files?): Promise ``` -------------------------------- ### Creating Deployment Target (TypeScript) Source: https://github.com/glasskube/distr/blob/main/sdk/js/docs/classes/Client.md Creates a new deployment target resource. It takes a DeploymentTarget object as input and returns a promise resolving to the created DeploymentTarget object. ```TypeScript createDeploymentTarget(deploymentTarget): Promise ``` -------------------------------- ### Creating Application (TypeScript) Source: https://github.com/glasskube/distr/blob/main/sdk/js/docs/classes/Client.md Creates a new application resource via the API. It accepts an Application object as input and returns a promise resolving to the created Application object. ```TypeScript createApplication(application): Promise ``` -------------------------------- ### Building Distr Hub with Make (Shell) Source: https://github.com/glasskube/distr/blob/main/README.md Commands to build the Distr Hub control plane and its associated Docker images using the project's Makefile. Requires Go, NodeJS, and Docker. ```Shell # Build the control plane make build # Build all docker images make build-docker ``` -------------------------------- ### Creating or Updating Deployment (TypeScript) Source: https://github.com/glasskube/distr/blob/main/sdk/js/docs/classes/Client.md Creates a new deployment or updates an existing one based on the provided request. It accepts a DeploymentRequest object and returns a promise resolving to the processed DeploymentRequest. ```TypeScript createOrUpdateDeployment(deploymentRequest): Promise ``` -------------------------------- ### Updating Application (TypeScript) Source: https://github.com/glasskube/distr/blob/main/sdk/js/docs/classes/Client.md Updates an existing application resource. It accepts an Application object containing the updated details and returns a promise resolving to the updated Application object. ```TypeScript updateApplication(application): Promise ``` -------------------------------- ### Defining the DeploymentStatusType Alias in TypeScript Source: https://github.com/glasskube/distr/blob/main/sdk/js/docs/type-aliases/DeploymentStatusType.md This snippet defines the `DeploymentStatusType` as a union of string literals. It is used to represent the current status of a deployment, indicating whether it is successful ('ok'), still in progress ('progressing'), or has encountered an error ('error'). This type is part of the `@glasskube/distr-sdk` and is used in various SDK functions and interfaces related to deployment management. ```TypeScript DeploymentStatusType = "ok" | "progressing" | "error" ``` -------------------------------- ### Defining LatestVersionStrategy Type Alias (TypeScript) Source: https://github.com/glasskube/distr/blob/main/sdk/js/docs/type-aliases/LatestVersionStrategy.md Defines the `LatestVersionStrategy` type alias, which specifies how the latest version of an application is determined. It can be either 'semver' for semantic versioning or 'chronological' based on creation date. ```TypeScript LatestVersionStrategy = "semver" | "chronological" ``` -------------------------------- ### Defining UserRole Type Alias in TypeScript Source: https://github.com/glasskube/distr/blob/main/sdk/js/docs/type-aliases/UserRole.md This type alias restricts the possible string values for a user's role to either 'vendor' or 'customer'. It provides type safety by ensuring that only these specific strings are accepted where a UserRole is expected. ```TypeScript type UserRole = "vendor" | "customer"; ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.