Skip to content

Commit 1b740a4

Browse files
committed
Simplify installation: use needlectl only, install to ~/.needle
- Remove shell scripts (start-needle.sh, stop-needle.sh, status-needle.sh) - Update install.sh to only use needlectl for service management - Update uninstall.sh to only target ~/.needle installation - Update needlectl to default to ~/.needle if NEEDLE_HOME not set - Update Makefile to use needlectl commands - Update documentation
1 parent 525f749 commit 1b740a4

9 files changed

Lines changed: 126 additions & 907 deletions

File tree

Makefile

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ dev:
1010
@echo "Starting backend in development mode..."
1111
@cd backend && source venv/bin/activate && uvicorn main:app --host 0.0.0.0 --port 8000 --reload
1212

13-
# Install Needle (unified setup)
13+
# Install Needle (for development - use one-liner for production)
1414
install:
1515
@chmod +x scripts/install.sh
1616
@./scripts/install.sh
@@ -28,22 +28,19 @@ install-accurate:
2828
@chmod +x scripts/install.sh
2929
@./scripts/install.sh accurate
3030

31-
# Uninstall Needle
31+
# Uninstall Needle (only removes ~/.needle installation)
3232
uninstall:
3333
@chmod +x scripts/uninstall.sh
3434
@./scripts/uninstall.sh
3535

36-
# Start all services
36+
# Start all services using needlectl
3737
start:
38-
@chmod +x start-needle.sh
39-
@./start-needle.sh
38+
@needlectl service start
4039

41-
# Stop all services
40+
# Stop all services using needlectl
4241
stop:
43-
@chmod +x stop-needle.sh
44-
@./stop-needle.sh
42+
@needlectl service stop
4543

46-
# Check service status
44+
# Check service status using needlectl
4745
status:
48-
@chmod +x status-needle.sh
49-
@./status-needle.sh
46+
@needlectl service status

docs/src/getting-started.md

Lines changed: 25 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -36,46 +36,16 @@ curl -fsSL https://raw.githubusercontent.com/UIC-InDeXLab/Needle/main/scripts/in
3636
curl -fsSL https://raw.githubusercontent.com/UIC-InDeXLab/Needle/main/scripts/install-oneliner.sh | bash -s accurate
3737
```
3838

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-
45-
### Manual Installation
46-
47-
If you prefer to install manually or need more control over the process:
48-
49-
1. **Clone the repository:**
50-
51-
```bash
52-
git clone --recursive https://github.com/UIC-InDeXLab/Needle.git
53-
cd Needle
54-
```
55-
56-
2. **Run the installation script:**
57-
58-
```bash
59-
./scripts/install.sh
60-
```
39+
This installs Needle to `~/.needle` and adds the `needlectl` command-line tool.
6140

6241
### Configuration Options
6342

64-
During the installation process, you will be prompted to choose the performance configuration. The available options are:
43+
Choose your performance configuration:
6544

6645
- **Fast (Default):** Single CLIP model, fastest indexing and retrieval - best for getting started quickly
6746
- **Balanced:** 4 models with balanced performance and accuracy
6847
- **Accurate:** 6 models with highest accuracy but slower performance
6948

70-
You can also specify the configuration directly:
71-
72-
```bash
73-
# Install with specific configuration
74-
./scripts/install.sh fast
75-
./scripts/install.sh balanced
76-
./scripts/install.sh accurate
77-
```
78-
7949
> **Warning:** Once the configuration mode is set, it cannot be changed without uninstalling and reinstalling Needle, which will result in data loss.
8050
8151
> **Note:** Needle automatically checks for GPU accessibility and will use the GPU if available to optimize performance.
@@ -88,7 +58,6 @@ The installation process sets up:
8858
- **Docker Infrastructure:** PostgreSQL, Milvus, MinIO, and etcd services via Docker Compose
8959
- **Configuration Files:** Performance-optimized settings based on your chosen mode
9060
- **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
9261

9362
## Starting the Needle Service
9463

@@ -98,12 +67,6 @@ Once installed, start the Needle service by running:
9867
needlectl service start
9968
```
10069

101-
Or if you installed manually:
102-
103-
```bash
104-
./start-needle.sh
105-
```
106-
10770
This command will start all the necessary infrastructure services (PostgreSQL, Milvus, etc.) and the Needle backend.
10871

10972
To verify that everything is running as expected, check the service status:
@@ -126,6 +89,29 @@ After starting services, you can access:
12689
- **API Documentation:** http://localhost:8000/docs
12790
- **Image Generator:** http://localhost:8010
12891

92+
## Managing Services
93+
94+
Use `needlectl` to manage all services:
95+
96+
```bash
97+
# Start all services
98+
needlectl service start
99+
100+
# Stop all services
101+
needlectl service stop
102+
103+
# Check status
104+
needlectl service status
105+
106+
# View logs
107+
needlectl service log backend
108+
needlectl service log image-generator-hub
109+
needlectl service log infrastructure
110+
111+
# Restart services
112+
needlectl service restart
113+
```
114+
129115
## About needlectl
130116

131117
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.

needlectl/utils.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,12 @@
77
def get_storage_dir():
88
needle_home_path = os.getenv("NEEDLE_HOME")
99
if not needle_home_path:
10-
typer.echo("Error: NEEDLE_HOME not set.")
11-
raise typer.Exit(code=1)
10+
# Default to ~/.needle for one-liner installations
11+
needle_home_path = os.path.expanduser("~/.needle")
12+
if not os.path.exists(needle_home_path):
13+
typer.echo(f"Error: Needle installation not found at {needle_home_path}")
14+
typer.echo("Please set NEEDLE_HOME environment variable or install Needle first.")
15+
raise typer.Exit(code=1)
1216
return needle_home_path
1317

1418

scripts/install-oneliner.sh

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -179,21 +179,18 @@ cd "$INSTALL_DIR"
179179

180180
print_success "🎉 Installation complete!"
181181
echo ""
182-
echo "📋 Next steps:"
183-
echo "1. Start services: cd $INSTALL_DIR && ./start-needle.sh"
184-
echo "2. Check status: ./status-needle.sh"
185-
echo "3. Stop services: ./stop-needle.sh"
182+
echo "📋 Usage:"
183+
echo " needlectl service start - Start all services"
184+
echo " needlectl service stop - Stop all services"
185+
echo " needlectl service status - Check service status"
186+
echo " needlectl service log - View logs"
186187
echo ""
187-
echo "🛠️ Using needlectl:"
188-
echo " - Start services: needlectl service start"
189-
echo " - Stop services: needlectl service stop"
190-
echo " - Check status: needlectl service status"
191-
echo " - View logs: needlectl service log [backend|image-generator-hub|infrastructure]"
192-
echo ""
193-
echo "🌐 Access Points:"
188+
echo "🌐 Access Points (after starting services):"
194189
echo " - Backend API: http://localhost:8000"
195190
echo " - Image Generator: http://localhost:8010"
196191
echo " - API Documentation: http://localhost:8000/docs"
197192
echo ""
198193
echo "📊 Configuration: ${CONFIG_MODE}"
199-
print_warning "Run 'cd $INSTALL_DIR && ./start-needle.sh' or 'needlectl service start' to start all services."
194+
echo "📁 Installation: $INSTALL_DIR"
195+
echo ""
196+
print_warning "Run 'needlectl service start' to start all services."

0 commit comments

Comments
 (0)