Skip to content

Commit 8ecef3a

Browse files
committed
Enhance installation and uninstallation scripts with improved error handling and user prompts
- Update install.sh to detect OS type and handle needlectl installation more robustly. - Add interactive and non-interactive modes for uninstall.sh, allowing users to choose what to remove. - Improve documentation for uninstallation and installation processes, including new options and commands. - Update getting-started and uninstallation documentation for clarity and completeness.
1 parent a9a5882 commit 8ecef3a

5 files changed

Lines changed: 464 additions & 239 deletions

File tree

docs/src/getting-started.md

Lines changed: 58 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Before installing Needle, ensure that you have the following prerequisites insta
1010
- **Docker Compose:** This tool is required to orchestrate the multi-container setup.
1111
[Install Docker Compose](https://docs.docker.com/compose/install/)
1212

13-
- **Python 3.8+:** Required for the backend and image generator services.
13+
- **Python 3.8+:** Required for the backend and image generator services (Python 3.12+ recommended).
1414
[Install Python](https://www.python.org/downloads/)
1515

1616
- **Git:** Required for cloning the repository and managing updates.
@@ -24,36 +24,59 @@ Before installing Needle, ensure that you have the following prerequisites insta
2424

2525
### Quick Install (Recommended)
2626

27-
To install Needle, run the following one-liner in your terminal:
27+
Install Needle with a single command - no cloning required:
2828

2929
```bash
30-
curl -fsSL https://raw.githubusercontent.com/UIC-InDeXLab/Needle/main/scripts/install.sh -o install.sh && bash install.sh && rm install.sh
30+
# Default installation (fast mode - recommended for getting started)
31+
curl -fsSL https://raw.githubusercontent.com/UIC-InDeXLab/Needle/main/scripts/install-oneliner.sh | bash
32+
33+
# Or with a specific configuration mode
34+
curl -fsSL https://raw.githubusercontent.com/UIC-InDeXLab/Needle/main/scripts/install-oneliner.sh | bash -s fast
35+
curl -fsSL https://raw.githubusercontent.com/UIC-InDeXLab/Needle/main/scripts/install-oneliner.sh | bash -s balanced
36+
curl -fsSL https://raw.githubusercontent.com/UIC-InDeXLab/Needle/main/scripts/install-oneliner.sh | bash -s accurate
3137
```
3238

39+
The one-liner installer will:
40+
1. Clone the Needle repository to `~/.needle`
41+
2. Set up virtual environments for backend and image generator services
42+
3. Install the `needlectl` CLI tool
43+
4. Configure Docker infrastructure services
44+
3345
### Manual Installation
3446

3547
If you prefer to install manually or need more control over the process:
3648

3749
1. **Clone the repository:**
38-
```bash
39-
git clone https://github.com/UIC-IndexLab/Needle.git
40-
cd Needle
41-
```
50+
51+
```bash
52+
git clone --recursive https://github.com/UIC-InDeXLab/Needle.git
53+
cd Needle
54+
```
4255

4356
2. **Run the installation script:**
44-
```bash
45-
./scripts/install.sh
46-
```
57+
58+
```bash
59+
./scripts/install.sh
60+
```
4761

4862
### Configuration Options
4963

50-
During the installation process, you will be prompted to choose the database mode. The available options are:
64+
During the installation process, you will be prompted to choose the performance configuration. The available options are:
65+
66+
- **Fast (Default):** Single CLIP model, fastest indexing and retrieval - best for getting started quickly
67+
- **Balanced:** 4 models with balanced performance and accuracy
68+
- **Accurate:** 6 models with highest accuracy but slower performance
5169

52-
- **Fast:** Offers quick responses and indexing with lower accuracy.
53-
- **Balanced:** Provides a compromise between speed and accuracy.
54-
- **Accurate:** Prioritizes high accuracy, which may come at the cost of slower performance.
70+
You can also specify the configuration directly:
5571

56-
> **Warning:** Once the database mode is set, it cannot be changed without uninstalling and reinstalling Needle, which will result in data loss.
72+
```bash
73+
# Install with specific configuration
74+
./scripts/install.sh fast
75+
./scripts/install.sh balanced
76+
./scripts/install.sh accurate
77+
```
78+
79+
> **Warning:** Once the configuration mode is set, it cannot be changed without uninstalling and reinstalling Needle, which will result in data loss.
5780
5881
> **Note:** Needle automatically checks for GPU accessibility and will use the GPU if available to optimize performance.
5982
@@ -62,12 +85,10 @@ During the installation process, you will be prompted to choose the database mod
6285
The installation process sets up:
6386

6487
- **Virtual Environments:** Separate Python environments for backend and image generator services
65-
- **Docker Infrastructure:** PostgreSQL, Milvus, and Redis services via Docker Compose
88+
- **Docker Infrastructure:** PostgreSQL, Milvus, MinIO, and etcd services via Docker Compose
6689
- **Configuration Files:** Performance-optimized settings based on your chosen mode
67-
- **needlectl CLI:** Command-line interface for managing Needle
68-
- **Web UI:** Optional web interface for easier interaction
69-
70-
After the installation completes, please close and reopen your terminal session (or source your shell configuration file) to ensure that all environment variables are correctly set.
90+
- **needlectl CLI:** Command-line interface for managing Needle (installed to `/usr/local/bin/needlectl`)
91+
- **Service Scripts:** `start-needle.sh`, `stop-needle.sh`, `status-needle.sh` for service management
7192

7293
## Starting the Needle Service
7394

@@ -77,19 +98,34 @@ Once installed, start the Needle service by running:
7798
needlectl service start
7899
```
79100

80-
This command will download the required model weights and initiate all the necessary services.
101+
Or if you installed manually:
102+
103+
```bash
104+
./start-needle.sh
105+
```
106+
107+
This command will start all the necessary infrastructure services (PostgreSQL, Milvus, etc.) and the Needle backend.
81108

82-
To verify that everything is running as expected, you can check the service status with:
109+
To verify that everything is running as expected, check the service status:
83110

84111
```bash
85112
needlectl service status
86113
```
87114

88115
And confirm the installed version using:
116+
89117
```bash
90118
needlectl --version
91119
```
92120

121+
### Access Points
122+
123+
After starting services, you can access:
124+
125+
- **Backend API:** http://localhost:8000
126+
- **API Documentation:** http://localhost:8000/docs
127+
- **Image Generator:** http://localhost:8010
128+
93129
## About needlectl
94130

95131
The `needlectl` command-line tool is the primary interface for interacting with Needle. It will be discussed in detail in the subsequent sections, where you'll learn how to leverage its full capabilities.

docs/src/uninstallation.md

Lines changed: 85 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,92 @@
11
# Uninstallation
22

3-
If you decide to remove Needle from your system, you can do so quickly by running the following one-liner command in your terminal:
3+
If you decide to remove Needle from your system, you have several options depending on how you installed it.
4+
5+
## Quick Uninstall (One-Liner)
6+
7+
For installations done via the one-liner (located at `~/.needle`):
48

59
```bash
610
curl -fsSL https://raw.githubusercontent.com/UIC-InDeXLab/Needle/main/scripts/uninstall.sh | bash
711
```
812

9-
> **Note:** This uninstallation command will remove Needle's services, data and configurations. However, it will not remove any cached Docker images. If you need to free up additional disk space, please consider manually removing those images.
13+
> **Note:** When run non-interactively (piped from curl), the uninstall script will preserve your data (Docker volumes, ImageGeneratorsHub directory). To fully remove all data, run the uninstall script interactively.
14+
15+
## Interactive Uninstall (Recommended)
16+
17+
For more control over what gets removed, download and run the script interactively:
18+
19+
```bash
20+
# For one-liner installations
21+
cd ~/.needle
22+
./scripts/uninstall.sh
23+
24+
# For manual installations
25+
cd /path/to/Needle
26+
./scripts/uninstall.sh
27+
```
28+
29+
The interactive uninstall will prompt you to:
30+
- Remove the ImageGeneratorsHub directory
31+
- Remove Docker volumes (contains your indexed data)
32+
- Remove the entire Needle directory (for one-liner installations)
33+
34+
## Using Make
35+
36+
If you installed manually and have the Makefile available:
37+
38+
```bash
39+
cd /path/to/Needle
40+
make uninstall
41+
```
42+
43+
## What Gets Removed
44+
45+
The uninstallation process removes:
46+
47+
- **Virtual Environments:** Backend (`backend/venv`) and ImageGeneratorsHub (`.venv`) environments
48+
- **Service Management Scripts:** `start-needle.sh`, `stop-needle.sh`, `status-needle.sh`
49+
- **needlectl Binary:** Removes `/usr/local/bin/needlectl`
50+
- **Log Files:** All log files in the `logs/` directory
51+
- **PID Files:** Process ID files used for service management
52+
53+
## What Gets Preserved (By Default)
54+
55+
Unless you explicitly choose to remove them:
56+
57+
- **Source Code:** The Needle repository files remain intact
58+
- **Docker Images:** Cached Docker images are preserved (saves time on reinstall)
59+
- **Docker Volumes:** Your indexed data is preserved
60+
- **ImageGeneratorsHub Directory:** The image generator models are preserved
61+
62+
## Complete Cleanup
63+
64+
To completely remove all Needle-related data:
65+
66+
1. **Run the uninstall script interactively and select "yes" for all prompts**
67+
68+
2. **Remove Docker images:**
69+
70+
```bash
71+
docker system prune -a
72+
```
73+
74+
3. **Remove any remaining Docker volumes:**
75+
76+
```bash
77+
docker volume prune
78+
```
79+
80+
## Reinstallation
81+
82+
After uninstalling, you can reinstall Needle at any time:
83+
84+
```bash
85+
# One-liner installation
86+
curl -fsSL https://raw.githubusercontent.com/UIC-InDeXLab/Needle/main/scripts/install-oneliner.sh | bash
87+
88+
# Or manual installation
89+
git clone --recursive https://github.com/UIC-InDeXLab/Needle.git
90+
cd Needle
91+
./scripts/install.sh
92+
```

scripts/install-oneliner.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
# Needle One-Liner Installation Script
44
# This script can be run directly with curl without cloning the repository
55
# Usage:
6-
# curl -fsSL https://raw.githubusercontent.com/UIC-InDeXLab/Needle/main/install-oneliner.sh | bash
7-
# curl -fsSL https://raw.githubusercontent.com/UIC-InDeXLab/Needle/main/install-oneliner.sh | bash -s fast
8-
# curl -fsSL https://raw.githubusercontent.com/UIC-InDeXLab/Needle/main/install-oneliner.sh | bash -s balanced
9-
# curl -fsSL https://raw.githubusercontent.com/UIC-InDeXLab/Needle/main/install-oneliner.sh | bash -s accurate
6+
# curl -fsSL https://raw.githubusercontent.com/UIC-InDeXLab/Needle/main/scripts/install-oneliner.sh | bash
7+
# curl -fsSL https://raw.githubusercontent.com/UIC-InDeXLab/Needle/main/scripts/install-oneliner.sh | bash -s fast
8+
# curl -fsSL https://raw.githubusercontent.com/UIC-InDeXLab/Needle/main/scripts/install-oneliner.sh | bash -s balanced
9+
# curl -fsSL https://raw.githubusercontent.com/UIC-InDeXLab/Needle/main/scripts/install-oneliner.sh | bash -s accurate
1010

1111
set -euo pipefail
1212

0 commit comments

Comments
 (0)