-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtypesense-docker.sh
More file actions
37 lines (31 loc) · 1.08 KB
/
typesense-docker.sh
File metadata and controls
37 lines (31 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/usr/bin/env bash
set -e
source "$HELPERS_DIR/shell-ui.sh"
# Set workspace folder to current folder if not already defined
WORKSPACE_FOLDER=${WORKSPACE_FOLDER:-$(pwd)}
# Path to docker-compose file
COMPOSE_FILE="$WORKSPACE_FOLDER/scripts/docker-compose.typesense.yml"
# 1. Check if docker-compose.yml exists
if [ ! -f "$COMPOSE_FILE" ]; then
error "File $COMPOSE_FILE not found. Please create it first."
exit 1
fi
# 2. Check if docker is available
if ! command -v docker &>/dev/null; then
error "Docker is not installed or not in PATH. Please install Docker."
exit 1
fi
# 3. Check if data folder is available
if [ ! -d "$WORKSPACE_FOLDER/typesense-data" ]; then
echo "Creating data directory: $WORKSPACE_FOLDER/typesense-data"
mkdir -p "$WORKSPACE_FOLDER/typesense-data"
fi
# 4. Run Typesense container
echo "Docker is available. Running Typesense container..."
docker compose -f "$COMPOSE_FILE" up -d
# Confirm result
if [ $? -eq 0 ]; then
success "Typesense is now running (check http://localhost:8108)."
else
warning "Failed to start Typesense. Check Docker logs."
fi