Skip to content

Commit

Permalink
feat: open-source module
Browse files Browse the repository at this point in the history
  • Loading branch information
Telemaco019 committed Oct 8, 2024
0 parents commit bb47b61
Show file tree
Hide file tree
Showing 23 changed files with 2,152 additions and 0 deletions.
50 changes: 50 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: CI Pipeline

on:
workflow_dispatch:
push:
branches:
- "main"
paths-ignore:
- ".github/**"
- "*.md"
- "docs/**"
- "!README.md"

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
CI:
env:
TF_VAR_credentials: ${{ secrets.GOOGLE_CREDENTIALS }}
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v4

- uses: hashicorp/setup-terraform@v3
with:
terraform_version: "1.9.6"

- name: Check is doc is update to date
run: |
make doc
if ! git diff --exit-code; then
echo "Documentation not up to date. Please run \"make doc\" and commit changes!" >&2
exit 1
fi
- uses: terraform-linters/setup-tflint@v4
name: Setup TFLint

- name: Init TFLint
run: tflint --init
env:
# https://github.com/terraform-linters/tflint/blob/master/docs/user-guide/plugins.md#avoiding-rate-limiting
GITHUB_TOKEN: ${{ github.token }}

- run: terraform init

- run: make check
44 changes: 44 additions & 0 deletions .github/workflows/pull-requests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Pull Request Pipeline

on:
workflow_dispatch:
pull_request:
branches:
- "main"
paths-ignore:
- ".github/**"
- "*.md"
- "docs/**"
- "!README.md"

jobs:
CI:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v4

- uses: hashicorp/setup-terraform@v3
with:
terraform_version: "1.9.3"

- name: Check is doc is update to date
run: |
make doc
if ! git diff --exit-code; then
echo "Documentation not up to date. Please run \"make doc\" and commit changes!" >&2
exit 1
fi
- uses: terraform-linters/setup-tflint@v4
name: Setup TFLint

- name: Init TFLint
run: tflint --init
env:
# https://github.com/terraform-linters/tflint/blob/master/docs/user-guide/plugins.md#avoiding-rate-limiting
GITHUB_TOKEN: ${{ github.token }}

- run: terraform init

- run: make check-no-tests
7 changes: 7 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
**/.terraform/
*.secrets.auto.tfvars
secrets.auto.tfvars
.idea/
backend.tfvars
.terraform.lock.hcl
credentials.json
229 changes: 229 additions & 0 deletions .terraform-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,229 @@
formatter: "markdown" # this is required

version: ""

header-from: main.tf
footer-from: ""

recursive:
enabled: false
path: modules

sections:
hide: []
show: []

content: |-
# Nebuly Platform (GCP)
Terraform module for provisioning Nebuly Platform resources on GCP.
Available on [Terraform Registry](https://registry.terraform.io/modules/nebuly-ai/nebuly-platform/gcp/latest).
## Prerequisites
### Nebuly Credentials
Before using this Terraform module, ensure that you have your Nebuly credentials ready.
These credentials are necessary to activate your installation and should be provided as input via the `nebuly_credentials` input.
### Required GCP APIs
Before using this Terraform module, ensure that the following GCP APIs are enabled in your Google Cloud project:
- [sqladmin.googleapis.com](https://cloud.google.com/sql/docs/mysql/admin-api)
- [servicenetworking.googleapis.com](https://cloud.google.com/service-infrastructure/docs/service-networking/getting-started)
- [cloudresourcemanager.googleapis.com](https://cloud.google.com/resource-manager/reference/rest)
- [container.googleapis.com](https://cloud.google.com/kubernetes-engine/docs/reference/rest)
- [secretmanager.googleapis.com](https://cloud.google.com/secret-manager/docs/reference/rest)
You can enable the APIs using either the GCP Console or the gcloud CLI, as explained in the [GCP Documentation](https://cloud.google.com/endpoints/docs/openapi/enable-api#gcloud).
### Required GCP Quotas
Ensure that your GCP project has the necessary quotas for the following resources over the regions you plan to deploy Nebuly:
- **Name**: GPUs (all regions)
**Min Value**: 2
- **Name**: NVIDIA L4 GPUs
**Min Value**: 1
- **Name**: NVIDIA T4 GPUs
**Min Value**: 1
For more information on how to check and increase quotas, refer to the [GCP Documentation](https://cloud.google.com/docs/quotas/view-manage).
## Quickstart
To get started with Nebuly installation on GCP, you can follow the steps below.
These instructions will guide you through the installation using Nebuly's default standard configuration with the Nebuly Helm Chart.
For specific configurations or assistance, reach out to the Nebuly Slack channel or email [[email protected]](mailto:[email protected]).
### 1. Terraform setup
Import Nebuly into your Terraform root module, provide the necessary variables, and apply the changes.
For configuration examples, you can refer to the [Examples](#examples).
Once the Terraform changes are applied, proceed with the next steps to deploy Nebuly on the provisioned Google Kubernetes Engine (GKE) cluster.
### 2. Connect to the GKE Cluster
For connecting to the created GKE cluster, you can follow the steps below. For more information,
refer to the [GKE Documentation](https://cloud.google.com/kubernetes-engine/docs/how-to/cluster-access-for-kubectl).
* Install the [GCloud CLI](https://cloud.google.com/sdk/docs/install-sdk).
* Install [kubectl](https://kubernetes.io/docs/reference/kubectl/):
```shell
gcloud components install kubectl
```
* Install the Install the gke-gcloud-auth-plugin:
```shell
gcloud components install gke-gcloud-auth-plugin
```
* Fetch the command for retrieving the credentials from the module outputs:
```shell
terraform output gke_cluster_get_credentials
```
* Run the command you got from the previous step
### 3. Create image pull secret
The auto-generated Helm values use the name defined in the k8s_image_pull_secret_name input variable for the Image Pull Secret. If you prefer a custom name, update either the Terraform variable or your Helm values accordingly.
Create a Kubernetes [Image Pull Secret](https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/) for
authenticating with your Docker registry and pulling the Nebuly Docker images.
### 4. Bootstrap GKE cluster
Retrieve the auto-generated values from the Terraform outputs and save them to a file named `values-bootstrap.yaml`:
```shell
terraform output helm_values_bootstrap
```
Install the bootstrap Helm chart to set up all the dependencies required for installing the Nebuly Platform Helm chart on GKE.
Refer to the [chart documentation](https://github.com/nebuly-ai/helm-charts/tree/main/bootstrap-gcp) for all the configuration details.
```shell
helm install oci://ghcr.io/nebuly-ai/helm-charts/bootstrap-gcp \
--namespace nebuly-bootstrap \
--generate-name \
--create-namespace \
-f values-bootstrap.yaml
```
### 5. Create Secret Provider Class
Create a Secret Provider Class to allow GKE to fetch credentials from the provisioned Key Vault.
* Get the Secret Provider Class YAML definition from the Terraform module outputs:
```shell
terraform output secret_provider_class
```
* Copy the output of the command into a file named secret-provider-class.yaml.
* Run the following commands to install Nebuly in the Kubernetes namespace nebuly:
```shell
kubectl create ns nebuly
kubectl apply --server-side -f secret-provider-class.yaml
```
### 6. Install nebuly-platform chart
Retrieve the auto-generated values from the Terraform outputs and save them to a file named `values.yaml`:
```shell
terraform output helm_values
```
Install the Nebuly Platform Helm chart.
Refer to the [chart documentation](https://github.com/nebuly-ai/helm-charts/tree/main/nebuly-platform) for detailed configuration options.
```shell
helm install oci://ghcr.io/nebuly-ai/helm-charts/nebuly-platform \
--namespace nebuly \
-f values.yaml \
--timeout 16m \
<your-release-name>
```
> ℹ️ During the initial installation of the chart, all required Nebuly LLMs are uploaded to your model registry.
> This process can take approximately 5 minutes. If the helm install command appears to be stuck, don't worry: it's simply waiting for the upload to finish.
### 7. Access Nebuly
Retrieve the external Load Balancer IP address to access the Nebuly Platform:
```shell
kubectl get svc -n nebuly-bootstrap -o jsonpath='{range .items[?(@.status.loadBalancer.ingress)]}{.status.loadBalancer.ingress[0].ip}{"\n"}{end}'
```
You can then register a DNS A record pointing to the Load Balancer IP address to access Nebuly via the custom domain you provided
in the input variable `platform_domain`.
## Examples
You can find examples of code that uses this Terraform module in the [examples](./examples) directory.
{{ .Header }}
{{ .Providers }}
{{ .Outputs }}
{{ .Inputs }}
## Resources
{{ range .Module.Resources }}
- {{ .GetMode }}.{{ .Spec }} ({{ .Position.Filename }}#{{ .Position.Line }})
{{- end }}
output:
file: ""
mode: inject
template: |-
<!-- BEGIN_TF_DOCS -->
{{ .Content }}
<!-- END_TF_DOCS -->
output-values:
enabled: false
from: ""

sort:
enabled: true
by: name

settings:
anchor: true
color: true
default: true
description: false
escape: true
hide-empty: false
html: true
indent: 2
lockfile: false
read-comments: true
required: true
sensitive: true
type: true
Loading

0 comments on commit bb47b61

Please sign in to comment.