Skip to content

Commit

Permalink
adding uninstall and data deletion to quickstart script and docs
Browse files Browse the repository at this point in the history
  • Loading branch information
sanjay920 committed Feb 20, 2024
1 parent ed4532a commit 5dc8c89
Show file tree
Hide file tree
Showing 3 changed files with 110 additions and 5 deletions.
6 changes: 2 additions & 4 deletions docs/docs/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,8 @@ Our RAG pipeline uses an embedding model. If you're running in quickstart mode,

#### How do I force remove data?

If you need to remove all Rubra data, you can use the following commands:
If you need to [remove all Rubra data](/installation/uninstall), you can use the following command:

```bash
docker volume rm rubra_etcd
docker volume rm rubra_milvus
docker volume rm rubra_mongodb
curl -sfL https://get.rubra.ai | sh -s -- delete
```
22 changes: 22 additions & 0 deletions docs/docs/installation/uninstall.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
id: uninstall
title: Uninstall
sidebar_label: Delete Data & Uninstall
sidebar_position: 4
---

## Uninstall Rubra

This removes all Rubra data and configuration from your system.

```bash
curl -sfL https://get.rubra.ai | sh -s -- uninstall
```

## Delete Data only

This removes all Rubra data from your system, including Assistants, Threads, Messages, and Files. The local LLM is not deleted.

```bash
curl -sfL https://get.rubra.ai | sh -s -- delete
```
87 changes: 86 additions & 1 deletion quickstart.sh
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,83 @@ stop_rubra() {
fi
}

# --- delete everything in .rubra except for rubra.llamafile and delete specific docker volumes ---
delete_except_llamafile() {
info "Stopping Rubra before deletion..."
stop_rubra

RUBRA_DIR="$HOME/.rubra"
if [ ! -d "$RUBRA_DIR" ]; then
warn "Rubra directory at $RUBRA_DIR does not exist. Nothing to delete."
else
cd "$RUBRA_DIR" || fatal "Failed to navigate to Rubra directory at $RUBRA_DIR"
info "Deleting everything in $RUBRA_DIR except for rubra.llamafile"
find . -mindepth 1 ! -name 'rubra.llamafile' -exec rm -rf {} +
fi

info "Deleting Docker volumes: rubra_etcd, rubra_milvus, and rubra_mongodb"
# Check if Docker is running
if ! docker info >/dev/null 2>&1; then
warn "Docker is not running. Cannot delete Docker volumes."
else
# Attempt to delete each Docker volume
if docker volume ls | grep -q 'rubra_etcd'; then
docker volume rm rubra_etcd || warn "Failed to delete Docker volume rubra_etcd"
else
info "Docker volume rubra_etcd does not exist or already deleted."
fi
if docker volume ls | grep -q 'rubra_milvus'; then
docker volume rm rubra_milvus || warn "Failed to delete Docker volume rubra_milvus"
else
info "Docker volume rubra_milvus does not exist or already deleted."
fi
if docker volume ls | grep -q 'rubra_mongodb'; then
docker volume rm rubra_mongodb || warn "Failed to delete Docker volume rubra_mongodb"
else
info "Docker volume rubra_mongodb does not exist or already deleted."
fi
fi
}

# --- uninstall rubra by removing rubra.llamafile, cleaning .rubra directory, and deleting specified docker volumes ---
uninstall_rubra() {
info "Stopping Rubra before uninstalling..."
stop_rubra

RUBRA_DIR="$HOME/.rubra"
if [ ! -d "$RUBRA_DIR" ]; then
warn "Rubra directory at $RUBRA_DIR does not exist. Nothing to uninstall."
else
cd "$RUBRA_DIR" || fatal "Failed to navigate to Rubra directory at $RUBRA_DIR"
info "Uninstalling Rubra by cleaning up $RUBRA_DIR and deleting Docker volumes"

# Delete everything in the directory, including rubra.llamafile
rm -rf ./*
fi

# Delete Docker volumes
info "Deleting Docker volumes: rubra_etcd, rubra_milvus, and rubra_mongodb"
if ! docker info >/dev/null 2>&1; then
warn "Docker is not running. Cannot delete Docker volumes."
else
if docker volume ls | grep -q 'rubra_etcd'; then
docker volume rm rubra_etcd || warn "Failed to delete Docker volume rubra_etcd"
else
info "Docker volume rubra_etcd does not exist or already deleted."
fi
if docker volume ls | grep -q 'rubra_milvus'; then
docker volume rm rubra_milvus || warn "Failed to delete Docker volume rubra_milvus"
else
info "Docker volume rubra_milvus does not exist or already deleted."
fi
if docker volume ls | grep -q 'rubra_mongodb'; then
docker volume rm rubra_mongodb || warn "Failed to delete Docker volume rubra_mongodb"
else
info "Docker volume rubra_mongodb does not exist or already deleted."
fi
fi
}

# --- helper function to open URL in default browser ---
open_url_in_browser() {
URL=$1
Expand Down Expand Up @@ -315,8 +392,16 @@ main() {
stop_rubra
info "Rubra stopped successfully"
;;
delete)
delete_except_llamafile
info "Rubra environment cleaned, except for rubra.llamafile."
;;
uninstall)
uninstall_rubra
info "Rubra uninstalled successfully."
;;
*)
echo "Usage: $0 {start|stop}"
echo "Usage: $0 {start|stop|delete|uninstall}"
exit 1
;;
esac
Expand Down

0 comments on commit 5dc8c89

Please sign in to comment.