Skip to content

Commit db3b824

Browse files
authored
Install Daft on existing Kubernetes cluster and submit jobs using daft-launcher (#44)
* Instructions to install Ray and Daft on an existing Kubernetes cluster, and support BYOC k8s clusters in daft-launcher Added docs for kuberay + daft installation, fixed minor linter issue * Addressed PR comments, command groups, provisioned and byoc instead of aws and k8s * switched to DaftProvider enum * Addressed PR comments * Commented out tests --------- Co-authored-by: Jessie Young <[email protected]>
1 parent 8fd7a17 commit db3b824

14 files changed

+1508
-675
lines changed

Cargo.lock

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ toml = "0.8"
1515
comfy-table = "7.1"
1616
regex = "1.11"
1717
open = "5.3"
18+
semver = "1.0"
1819

1920
[dependencies.anyhow]
2021
version = "1.0"

README.md

+186-47
Original file line numberDiff line numberDiff line change
@@ -10,45 +10,124 @@
1010
[![Latest](https://img.shields.io/github/v/tag/Eventual-Inc/daft-launcher?label=latest&logo=GitHub)](https://github.com/Eventual-Inc/daft-launcher/tags)
1111
[![License](https://img.shields.io/badge/daft_launcher-docs-red.svg)](https://eventual-inc.github.io/daft-launcher)
1212

13-
# Daft Launcher
13+
# Daft Launcher CLI Tool
1414

1515
`daft-launcher` is a simple launcher for spinning up and managing Ray clusters for [`daft`](https://github.com/Eventual-Inc/Daft).
16-
It abstracts away all the complexities of dealing with Ray yourself, allowing you to focus on running `daft` in a distributed manner.
1716

18-
## Capabilities
17+
## Goal
18+
19+
Getting started with Daft in a local environment is easy.
20+
However, getting started with Daft in a cloud environment is substantially more difficult.
21+
So much more difficult, in fact, that users end up spending more time setting up their environment than actually playing with our query engine.
1922

20-
1. Spinning up clusters.
21-
2. Listing all available clusters (as well as their statuses).
22-
3. Submitting jobs to a cluster.
23-
4. Connecting to the cluster (to view the Ray dashboard and submit jobs using the Ray protocol).
24-
5. Spinning down clusters.
25-
6. Creating configuration files.
26-
7. Running raw SQL statements using Daft's SQL API.
23+
Daft Launcher aims to solve this problem by providing a simple CLI tool to remove all of this unnecessary heavy-lifting.
2724

28-
## Currently supported cloud providers
25+
## Capabilities
2926

30-
- [x] AWS
31-
- [ ] GCP
32-
- [ ] Azure
27+
What Daft Launcher is capable of:
28+
1. Spinning up clusters (Provisioned mode only)
29+
2. Listing all available clusters as well as their statuses (Provisioned mode only)
30+
3. Submitting jobs to a cluster (Both Provisioned and BYOC modes)
31+
4. Connecting to the cluster (Provisioned mode only)
32+
5. Spinning down clusters (Provisioned mode only)
33+
6. Creating configuration files (Both modes)
34+
7. Running raw SQL statements (BYOC mode only)
35+
36+
## Operation Modes
37+
38+
Daft Launcher supports two modes of operation:
39+
- **Provisioned**: Automatically provisions and manages Ray clusters in AWS
40+
- **BYOC (Bring Your Own Cluster)**: Connects to existing Ray clusters in Kubernetes
41+
42+
### Command Groups and Support Matrix
43+
44+
| Command Group | Command | Provisioned | BYOC |
45+
|--------------|---------|-------------|------|
46+
| cluster | up |||
47+
| | down |||
48+
| | kill |||
49+
| | list |||
50+
| | connect |||
51+
| | ssh |||
52+
| job | submit |||
53+
| | sql |||
54+
| | status |||
55+
| | logs |||
56+
| config | init |||
57+
| | check |||
58+
| | export |||
3359

3460
## Usage
3561

36-
You'll need a python package manager installed.
37-
We highly recommend using [`uv`](https://astral.sh/blog/uv) for all things python!
62+
### Pre-requisites
3863

39-
### AWS
64+
You'll need some python package manager installed.
65+
We recommend using [`uv`](https://astral.sh/blog/uv) for all things python.
4066

41-
If you're using AWS, you'll need:
67+
#### For Provisioned Mode (AWS)
4268
1. A valid AWS account with the necessary IAM role to spin up EC2 instances.
43-
This IAM role can either be created by you (assuming you have the appropriate permissions).
44-
Or this IAM role will need to be created by your administrator.
45-
2. The [AWS CLI](https://aws.amazon.com/cli) installed and configured on your machine.
46-
3. To login using the AWS CLI.
47-
For full instructions, please look [here](https://google.com).
48-
49-
## Installation
50-
51-
Using `uv` (recommended):
69+
This IAM role can either be created by you (assuming you have the appropriate permissions)
70+
or will need to be created by your administrator.
71+
2. The [AWS CLI](https://aws.amazon.com/cli/) installed and configured on your machine.
72+
3. Login using the AWS CLI.
73+
74+
#### For BYOC Mode (Kubernetes)
75+
1. A Kubernetes cluster with Ray already deployed
76+
- Can be local (minikube/kind), cloud-managed (EKS/GKE/AKS), or on-premise.
77+
- See our [BYOC setup guides](./docs/byoc/README.md) for detailed instructions
78+
2. Ray cluster running in your Kubernetes cluster
79+
- Must be installed and configured using Helm
80+
- See provider-specific guides for installation steps
81+
3. Daft installed on the Ray cluster
82+
4. `kubectl` installed and configured with the correct context
83+
5. Appropriate permissions to access the namespace where Ray is deployed
84+
85+
### SSH Key Setup for Provisioned Mode
86+
87+
To enable SSH access and port forwarding for provisioned clusters, you need to:
88+
89+
1. Create an SSH key pair (if you don't already have one):
90+
```bash
91+
# Generate a new key pair
92+
ssh-keygen -t rsa -b 2048 -f ~/.ssh/daft-key
93+
94+
# This will create:
95+
# ~/.ssh/daft-key (private key)
96+
# ~/.ssh/daft-key.pub (public key)
97+
```
98+
99+
2. Import the public key to AWS:
100+
```bash
101+
# Import the public key to AWS
102+
aws ec2 import-key-pair \
103+
--key-name "daft-key" \
104+
--public-key-material fileb://~/.ssh/daft-key.pub
105+
```
106+
107+
3. Set proper permissions on your private key:
108+
```bash
109+
chmod 600 ~/.ssh/daft-key
110+
```
111+
112+
4. Update your daft configuration to use this key:
113+
```toml
114+
[setup.provisioned]
115+
# ... other config ...
116+
ssh-private-key = "~/.ssh/daft-key" # Path to your private key
117+
ssh-user = "ubuntu" # User depends on the AMI (ubuntu for Ubuntu AMIs)
118+
```
119+
120+
Notes:
121+
- The key name in AWS must match the name of your key file (without the extension)
122+
- The private key must be readable only by you (hence the chmod 600)
123+
- Different AMIs use different default users:
124+
- Ubuntu AMIs: use "ubuntu"
125+
- Amazon Linux AMIs: use "ec2-user"
126+
- Make sure this matches your `ssh-user` configuration
127+
128+
### Installation
129+
130+
Using `uv`:
52131

53132
```bash
54133
# create project
@@ -64,32 +143,92 @@ source .venv/bin/activate
64143
uv pip install daft-launcher
65144
```
66145

67-
## Example
146+
### Example Usage
147+
148+
All interactions with Daft Launcher are primarily communicated via a configuration file.
149+
By default, Daft Launcher will look inside your `$CWD` for a file named `.daft.toml`.
150+
You can override this behaviour by specifying a custom configuration file.
151+
152+
#### Provisioned Mode (AWS)
68153

69-
```sh
70-
# create a new configuration file
71-
daft init
154+
```bash
155+
# Initialize a new provisioned mode configuration
156+
daft config init --provider provisioned
157+
# or use the default provider (provisioned)
158+
daft config init
159+
160+
# Cluster management
161+
daft provisioned up
162+
daft provisioned list
163+
daft provisioned connect
164+
daft provisioned ssh
165+
daft provisioned down
166+
daft provisioned kill
167+
168+
# Job management (works in both modes)
169+
daft job submit example-job
170+
daft job status example-job
171+
daft job logs example-job
172+
173+
# Configuration management
174+
daft config check
175+
daft config export
72176
```
73-
That should create a configuration file for you.
74-
Feel free to modify some of the configuration values.
75-
If you have any confusions on a value, you can always run `daft check` to check the syntax and schema of your configuration file.
76177

77-
Once you're content with your configuration file, go back to your terminal and run the following:
178+
#### BYOC Mode (Kubernetes)
78179

79-
```sh
80-
# spin your cluster up
81-
daft up
180+
```bash
181+
# Initialize a new BYOC mode configuration
182+
daft config init --provider byoc
183+
```
82184

83-
# list all the active clusters
84-
daft list
185+
### Configuration Files
85186

86-
# submit a directory and command to run on the cluster
87-
# (where `my-job-name` should be an entry in your .daft.toml file)
88-
daft submit my-job-name
187+
You can specify a custom configuration file path with the `-c` flag:
188+
```bash
189+
daft -c my-config.toml job submit example-job
190+
```
89191

90-
# run a direct SQL query on daft
91-
daft sql "SELECT * FROM my_table WHERE column = 'value'"
192+
Example Provisioned mode configuration:
193+
```toml
194+
[setup]
195+
name = "my-daft-cluster"
196+
version = "0.1.0"
197+
provider = "provisioned"
198+
dependencies = [] # Optional additional Python packages to install
199+
200+
[setup.provisioned]
201+
region = "us-west-2"
202+
number-of-workers = 4
203+
ssh-user = "ubuntu"
204+
ssh-private-key = "~/.ssh/daft-key"
205+
instance-type = "i3.2xlarge"
206+
image-id = "ami-04dd23e62ed049936"
207+
iam-instance-profile-name = "YourInstanceProfileName" # Optional
208+
209+
[run]
210+
pre-setup-commands = []
211+
post-setup-commands = []
212+
213+
[[job]]
214+
name = "example-job"
215+
command = "python my_script.py"
216+
working-dir = "~/my_project"
217+
```
92218

93-
# finally, once you're done, spin the cluster down
94-
daft down
219+
Example BYOC mode configuration:
220+
```toml
221+
[setup]
222+
name = "my-daft-cluster"
223+
version = "0.1.0"
224+
provider = "byoc"
225+
dependencies = [] # Optional additional Python packages to install
226+
227+
[setup.byoc]
228+
namespace = "default" # Optional, defaults to "default"
229+
230+
[[job]]
231+
name = "example-job"
232+
command = "python my_script.py"
233+
working-dir = "~/my_project"
95234
```

docs/byoc/README.md

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# BYOC (Bring Your Own Cluster) Mode Setup for Daft
2+
3+
This directory contains guides for setting up Ray and Daft on various Kubernetes environments for BYOC mode:
4+
5+
- [Local Development](./local.md) - Setting up a local Kubernetes cluster for development
6+
- [Cloud Providers](./cloud.md) - Instructions for EKS, GKE, and AKS setups
7+
- [On-Premises](./on-prem.md) - Guide for on-premises Kubernetes deployments
8+
9+
## Prerequisites
10+
11+
Before using `daft-launcher` in BYOC mode with Kubernetes, you must:
12+
1. Have a running Kubernetes cluster (local, cloud-managed, or on-premise)
13+
2. Install and configure Ray on your Kubernetes cluster
14+
3. Install Daft on your cluster
15+
16+
Please follow the appropriate guide above for your environment.

docs/byoc/cloud.md

+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# Cloud Provider Kubernetes Setup
2+
3+
This guide covers using Ray and Daft with managed Kubernetes services from major cloud providers.
4+
5+
## Prerequisites
6+
7+
### General Requirements
8+
- `kubectl` installed and configured
9+
- `helm` installed
10+
- A running Kubernetes cluster in one of the following cloud providers:
11+
- Amazon Elastic Kubernetes Service (EKS)
12+
- Google Kubernetes Engine (GKE)
13+
- Azure Kubernetes Service (AKS)
14+
15+
### Cloud-Specific Requirements
16+
17+
#### For AWS EKS
18+
- AWS CLI installed and configured
19+
- Access to an existing EKS cluster
20+
- `kubectl` configured for your EKS cluster:
21+
```bash
22+
aws eks update-kubeconfig --name your-cluster-name --region your-region
23+
```
24+
25+
#### For Google GKE
26+
- Google Cloud SDK installed
27+
- Access to an existing GKE cluster
28+
- `kubectl` configured for your GKE cluster:
29+
```bash
30+
gcloud container clusters get-credentials your-cluster-name --zone your-zone
31+
```
32+
33+
#### For Azure AKS
34+
- Azure CLI installed
35+
- Access to an existing AKS cluster
36+
- `kubectl` configured for your AKS cluster:
37+
```bash
38+
az aks get-credentials --resource-group your-resource-group --name your-cluster-name
39+
```
40+
41+
## Installing Ray and Daft
42+
43+
Once your cloud Kubernetes cluster is running and `kubectl` is configured, follow the [Ray Installation Guide](./ray-installation.md) to:
44+
1. Install KubeRay Operator
45+
2. Deploy Ray cluster
46+
3. Install Daft
47+
4. Set up port forwarding
48+
5. Submit test jobs
49+
50+
> **Note**: For cloud providers, you'll typically use x86/AMD64 images unless you're specifically using ARM-based instances (like AWS Graviton).

0 commit comments

Comments
 (0)