Skip to content

Commit

Permalink
add crusoe cloud deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
nickpetrovic committed Jan 19, 2024
1 parent 2d726c1 commit 66474cd
Show file tree
Hide file tree
Showing 6 changed files with 102 additions and 1 deletion.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,8 @@ __pycache__
venv
.python-version
.DS_Store
.terraform*
terraform.tfstate*
terraform.tfvars
sdk/src/build
sdk/src/Beam.egg-info
sdk/src/Beam.egg-info
25 changes: 25 additions & 0 deletions deploy/crusoe/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Beam Arc on Crusoe Cloud

This will help you run a single instance of Beam Arc on [Crusoe Cloud](https://docs.crusoecloud.com/).

## Prereqs

1. Install terraform.
1. Configure your Crusoe config ([docs](https://docs.crusoecloud.com/quickstart/installing-the-cli/index.html#configure-the-cli)).


## Getting started

1. Find your project ID.
1. Make a new SSH key, or point to an existing one.
1. Create a `terraform.tfvars` file in this directory.
```
project_id = "<uuid of your project>"
instance_type = "a40.1x"
ssh_key_path = "~/.ssh/id_crusoecloud.pub"
```
1. Deploy the instance.

```sh
terraform apply
```
8 changes: 8 additions & 0 deletions deploy/crusoe/config.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
terraform {
required_providers {
crusoe = {
source = "registry.terraform.io/crusoecloud/crusoe"
version = "0.5.3"
}
}
}
42 changes: 42 additions & 0 deletions deploy/crusoe/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
locals {
name = "beam-arc"
ssh_key_content = file(var.ssh_key_path)
}

resource "crusoe_compute_instance" "this" {
name = local.name
image = "ubuntu20.04-nvidia-pcie-docker:latest"
type = var.instance_type
ssh_key = local.ssh_key_content
location = var.location
project_id = var.project_id

startup_script = <<-EOF
#!/bin/bash
mkdir /data
mkfs.ext4 /dev/vda
mount -t ext4 /dev/vda /data
# cd /data
# git clone https://github.com/beam-cloud/beam.git
# cd beam
# make setup
EOF

disks = [
{
id = crusoe_storage_disk.data.id
mode = "read-write"
attachment_type = "data"
}
]

depends_on = [crusoe_storage_disk.data]
}

resource "crusoe_storage_disk" "data" {
name = "${local.name}-data"
size = "400GiB"
location = var.location
project_id = var.project_id
}
3 changes: 3 additions & 0 deletions deploy/crusoe/outputs.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
output "public_ipv4" {
value = crusoe_compute_instance.this.network_interfaces[0].public_ipv4.address
}
20 changes: 20 additions & 0 deletions deploy/crusoe/variables.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
variable "project_id" {
description = "UUID of your project."
type = string
}

variable "ssh_key_path" {
description = "Path to your public SSH key."
type = string
}

variable "location" {
description = "Location to deploy your resources."
type = string
default = "us-northcentral1-a"
}

variable "instance_type" {
type = string
default = "a40.1x"
}

0 comments on commit 66474cd

Please sign in to comment.