Curl Installer Deployment Guide โ
The shell script installer for OpenPets, accessible via curl.
๐ Quick Install Command โ
curl -fsSL https://pets.raggle.co/install | bashOr with explicit GitHub URL:
curl -fsSL https://raw.githubusercontent.com/raggle-ai/raggle-repo/main/core/openpets/install.sh | bash๐ Installer Details โ
Script Location: install.shPackage: openpets (from npm) Install Directory: ~/.openpets
๐ ๏ธ How It Works โ
Installation Process โ
- Checks dependencies (Node.js 18+, npm)
- Downloads package from npm registry (
openpets) - Installs to
~/.openpets/ - Creates binaries in
~/.openpets/bin/pets- Main CLIpets-mcp- MCP server
- Updates PATH in shell config
- Verifies installation
Directory Structure โ
~/.openpets/
โโโ bin/
โ โโโ pets # CLI wrapper
โ โโโ pets-mcp # MCP server wrapper
โโโ lib/
โโโ node_modules/
โโโ openpets/ # npm packageโ๏ธ Configuration โ
Package Name โ
In install.sh:
PACKAGE_NAME="openpets"Why no @ scope?
- Simpler for global installs
- Matches CLI command name
- Easier for users to remember
Install Location โ
INSTALL_DIR="$HOME/.openpets"
BIN_DIR="$INSTALL_DIR/bin"
LIB_DIR="$INSTALL_DIR/lib"Binary Wrappers โ
~/.openpets/bin/pets:
#!/usr/bin/env node
const path = require('path');
const fs = require('fs');
const libDir = path.join(__dirname, '..', 'lib', 'node_modules', 'openpets');
const cliPath = path.join(libDir, 'cli.ts');
if (fs.existsSync(cliPath)) {
require('tsx/cli').main([cliPath, ...process.argv.slice(2)]);
} else {
const jsPath = path.join(libDir, 'cli.js');
if (fs.existsSync(jsPath)) {
require(jsPath);
} else {
console.error('Error: CLI entry point not found');
process.exit(1);
}
}~/.openpets/bin/pets-mcp: Similar wrapper for MCP server.
๐ Domain Setup โ
Option 1: Custom Domain with Redirect โ
Configure redirect for https://pets.raggle.co/install:
Cloudflare Pages (_redirects):
/install.sh https://raw.githubusercontent.com/raggle-ai/raggle-repo/main/core/openpets/install.sh 200
/install /install 200Netlify (netlify.toml):
[[redirects]]
from = "/install"
to = "https://raw.githubusercontent.com/raggle-ai/raggle-repo/main/core/openpets/install.sh"
status = 200
force = trueVercel (vercel.json):
{
"redirects": [
{
"source": "/install",
"destination": "https://raw.githubusercontent.com/raggle-ai/raggle-repo/main/core/openpets/install.sh",
"permanent": false
}
]
}Option 2: Host Script Directly โ
Upload install.sh to your web server:
# Copy to web root
cp install.sh /var/www/pets.raggle.co/install
# Or to another static hosting provider
cp install.sh /path/to/static-site/install.shThen users can:
curl -fsSL https://pets.raggle.co/install.sh | bash๐งช Testing โ
Test Script Locally โ
# Download and inspect
curl -fsSL https://pets.raggle.co/install -o test-install.sh
cat test-install.sh
# Run locally
bash test-install.sh
# Or with specific version
VERSION=1.0.4 bash test-install.shTest Installation โ
# Install
curl -fsSL https://pets.raggle.co/install | bash
# Verify
pets --version
pets list
pets-mcp --help
# Cleanup
rm -rf ~/.openpets
# Remove PATH entry from ~/.zshrc or ~/.bashrcShellCheck Validation โ
shellcheck install.sh๐ง Customization โ
Install Specific Version โ
VERSION=1.0.3 curl -fsSL https://pets.raggle.co/install | bashSilent Installation โ
curl -fsSL https://pets.raggle.co/install | bash -s -- --silentCustom Install Directory โ
Modify install.sh:
# Allow override via environment variable
INSTALL_DIR="${OPENPETS_INSTALL_DIR:-$HOME/.openpets}"Then:
OPENPETS_INSTALL_DIR=/usr/local/openpets curl -fsSL https://pets.raggle.co/install | bash๐จ Installer Features โ
Dependency Checking โ
check_dependencies() {
if ! command -v node >/dev/null 2>&1; then
echo "Error: Node.js is required but not installed."
exit 1
fi
local node_version=$(node --version | sed 's/v//' | cut -d'.' -f1)
if [ "$node_version" -lt 18 ]; then
echo "Warning: Node.js 18+ recommended."
fi
}Version Detection โ
check_version() {
if command -v pets >/dev/null 2>&1; then
local installed_version=$(npm list -g --depth=0 | grep "openpets" | sed 's/.*@//')
echo "Version $installed_version already installed"
fi
}Shell Configuration โ
Automatically adds to PATH:
# For zsh
echo 'export PATH="$HOME/.openpets/bin:$PATH"' >> ~/.zshrc
# For bash
echo 'export PATH="$HOME/.openpets/bin:$PATH"' >> ~/.bashrc
# For fish
echo 'fish_add_path $HOME/.openpets/bin' >> ~/.config/fish/config.fish๐ Analytics (Optional) โ
Track Installations โ
Add to install.sh:
# Send anonymous analytics
curl -s "https://analytics.pets.raggle.co/install?version=$VERSION&os=$os&arch=$arch" > /dev/null 2>&1 || trueCount via GitHub โ
GitHub tracks raw file requests:
- Insights โ Traffic โ Popular content
๐ Updating Installer โ
After npm Publish โ
The installer automatically uses the latest npm version:
npm install "$PACKAGE_NAME$version_arg" --no-saveNo changes needed unless:
- Package name changes
- Installation structure changes
- New features added
Testing Changes โ
# Test locally
bash install.sh
# Test from GitHub
bash <(curl -fsSL https://raw.githubusercontent.com/raggle-ai/raggle-repo/main/core/openpets/install.sh)๐ Troubleshooting โ
Common Issues โ
"Command not found: pets"
# Restart shell or source config
source ~/.zshrc # or ~/.bashrc"Node.js not found"
# Install Node.js
# macOS
brew install node
# Ubuntu/Debian
curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash -
sudo apt-get install -y nodejs"Permission denied"
# Ensure install directory is writable
mkdir -p ~/.openpets
chmod 755 ~/.openpets"npm WARN deprecated"
- This is normal for dependency warnings
- Installer continues despite warnings
๐ User Documentation โ
Installation Instructions โ
Include in README:
### Quick Install
Install OpenPets with a single command:
```bash
curl -fsSL https://pets.raggle.co/install | bashAfter installation:
pets --help- Show helppets list- List installed petspets-mcp- Start MCP server
Uninstall โ
rm -rf ~/.openpets
# Remove PATH entry from shell config๐ฏ Best Practices โ
Security โ
โ DO:
- Use
https://URLs - Include integrity checks
- Show what will be installed
- Allow inspection before running
โ DON'T:
- Run as root/sudo
- Install to system directories
- Skip dependency checks
User Experience โ
โ DO:
- Show progress indicators
- Provide clear error messages
- Auto-detect shell
- Support common shells (bash, zsh, fish)
โ DON'T:
- Require manual PATH setup
- Show excessive output
- Fail silently
๐ Deployment Checklist โ
- [ ] Script tested locally
- [ ] ShellCheck passes
- [ ] Works on macOS
- [ ] Works on Linux
- [ ] Domain redirect configured
- [ ] Installation page updated
- [ ] Documentation updated
- [ ] Version detection works
- [ ] PATH auto-setup works
- [ ] Uninstall instructions provided