Chinese Version : README_CN.md
Crater is a Kubernetes-based GPU cluster management system providing a comprehensive solution for GPU resource orchestration.
Before getting started with development, please ensure your environment has the following tools installed:
-
Go: Version
v1.22.1is recommended
📖 Go Installation Guide -
Kubectl: Version
v1.22.1is recommended
📖 Kubectl Installation Guide
This project uses golangci-lint to enforce Go code conventions and best practices. To avoid running it manually, we recommend setting up a Git pre-commit hook to automatically check the code before each commit.
After installation, you might need to add your GOPATH to the system PATH so that golangci-lint can be used in the terminal. For example, on Linux:
# Check your GOPATH
go env GOPATH
# /Users/your-username/go
# Add the path to .bashrc or .zshrc
export PATH="/Users/your-username/go/bin:$PATH"
# Reload the shell and verify
golangci-lint --version
# golangci-lint has version 1.61.0Copy the .githook/pre-commit script to your Git hooks directory and make it executable:
Linux/macOS:
cp .githook/pre-commit .git/hooks/pre-commit
chmod +x .git/hooks/pre-commitWindows:
-
Copy the script to .git/hooks/pre-commit
-
Modify the script to replace golangci-lint with golangci-lint.exe if needed, or adapt it into a .bat file.
With the hook in place, golangci-lint will automatically run on staged files before each commit.
The project uses GORM Gen to generate boilerplate code for database CRUD operations.
Generation scripts and documentation can be found in: gorm_gen
Please regenerate the code after modifying database models or schema definitions, while CI pipeline will automatically make database migrations.
Install dependencies and plugins:
go mod downloadSure! Here's the English version of the "Running the Code" section for your README.md, divided into two parts: Local Development and Kubernetes Deployment, with a recommendation for the latter.
This project supports two ways to run: Local Development and Deployment on a Kubernetes Cluster. We recommend using the Kubernetes deployment for full functionality and behavior closer to production.
Suitable for quick testing and development phases.
Make sure you have a config.yaml file with the correct database settings.
Create a .env file at the root directory to customize local ports. This file is ignored by Git:
PORT=xxxx
ROOTDIR="/crater"Create a folder named crater in the project root directory to simulate file handling behavior.
Alternatively, you can modify the ROOTDIR in the .env file and use it as the root directory for your testing.
mkdir craterThis directory will act as the root for file processing.
make runThe service will start and listen on localhost:port by default.
- Docker
- Access to a Kubernetes cluster (
kubectl) - A PVC named
crater-rw-storagealready created (for persistent file storage)
docker build -t your-registry/crater-webdav:latest .
docker push your-registry/crater-webdav:latestReplace
your-registrywith your actual container registry.
Make sure the following files exist in your current directory:
Dockerfiledeployment.yamlservice.yaml(if applicable)
You can find these files in https://github.com/raids-lab/crater/tree/main/charts/crater/templates/storage-server
Apply the manifests:
kubectl apply -f deployment.yaml
kubectl apply -f service.yamlEnsure that the
deployment.yamlcorrectly references the image and mounts the PVCcrater-rw-storage.
To deploy Crater Project in a production environment, we provide a Helm Chart available at: Crater Helm Chart.
Please refer to the main documentation for detailed deployment instructions.