diff --git a/docs/docs/faq.md b/docs/docs/faq.md index 4924ddb..e9fb959 100644 --- a/docs/docs/faq.md +++ b/docs/docs/faq.md @@ -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 ``` diff --git a/docs/docs/installation/uninstall.md b/docs/docs/installation/uninstall.md new file mode 100644 index 0000000..ece6c31 --- /dev/null +++ b/docs/docs/installation/uninstall.md @@ -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 +``` \ No newline at end of file diff --git a/quickstart.sh b/quickstart.sh index da2468b..a2ba3cf 100644 --- a/quickstart.sh +++ b/quickstart.sh @@ -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 @@ -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