Last active
September 26, 2024 01:24
-
-
Save aledalgrande/82c4664ec73733ad974ec9c43be50899 to your computer and use it in GitHub Desktop.
Quick Perplexica setup on Mac
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# /etc/hosts | |
127.0.0.1 search.local |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/zsh | |
# This script installs and starts the Perplexica app on macOS using Docker and Ollama. | |
# I found the uncensored Llama model is way smarter and less annoying. Groq with Llama3.1 70B is also a beast. | |
# Tested on M1 Max. | |
set -euo pipefail | |
# Function to clean up background processes | |
cleanup() { | |
echo "🧹 Cleaning up..." | |
echo "🛑 Stopping Ollama server..." | |
pkill -9 ollama Ollama | |
echo "🛑 Stopping Docker-compose..." | |
cd ~/Perplexica | |
docker compose down | |
exit 0 | |
} | |
# Set up trap to catch Ctrl+C | |
trap cleanup INT | |
# Check for ollama | |
if ! command -v ollama &>/dev/null; then | |
echo "🛠️ Ollama not found. Downloading and installing..." | |
curl https://ollama.ai/install.sh | sh | |
else | |
echo "✅ Ollama is already installed." | |
fi | |
# Check for llama3.1 model | |
if ! ollama list | grep -q "rolandroland/llama3.1-uncensored"; then | |
echo "🛠️ Llama 3.1 8B uncensored model not found. Downloading..." | |
ollama pull rolandroland/llama3.1-uncensored | |
else | |
echo "✅ Llama 3.1 8B uncensored model is already available." | |
fi | |
# Check for Perplexica directory | |
if [ ! -d ~/Perplexica ]; then | |
echo "🛠️ Perplexica not found. Cloning from GitHub..." | |
git clone https://github.com/ItzCrazyKns/Perplexica.git ~/Perplexica | |
else | |
echo "✅ Perplexica directory already exists." | |
fi | |
# Run ollama serve in background | |
echo "🧠 Starting Ollama server..." | |
ollama serve & | |
while ! lsof -i :11434 >/dev/null 2>&1; do | |
sleep 1 | |
done | |
echo "🧠 Ollama server started" | |
# Change directory to Perplexica | |
cd ~/Perplexica | |
# Run docker compose | |
docker compose up -d & | |
echo "📡 Docker-compose started" | |
echo "✨ Perplexica available at: http://localhost:3000" | |
echo "Press Ctrl+C to stop all processes" | |
# Keep the script running until interrupted | |
while true; do | |
sleep 1 | |
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# /opt/homebrew/etc/nginx/servers/search.local.conf | |
# run brew services restart nginx after adding this, then you can use `search.local` in your browser! | |
server { | |
listen 80; | |
server_name search.local; | |
location / { | |
proxy_pass http://localhost:3000; | |
proxy_set_header Host $host; | |
proxy_set_header X-Real-IP $remote_addr; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You will need to set up your configuration file manually for Perplexica, see their docs.