Skip to content

Curl Installer Deployment Guide โ€‹

The shell script installer for OpenPets, accessible via curl.

๐Ÿš€ Quick Install Command โ€‹

bash
curl -fsSL https://pets.raggle.co/install | bash

Or with explicit GitHub URL:

bash
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 โ€‹

  1. Checks dependencies (Node.js 18+, npm)
  2. Downloads package from npm registry (openpets)
  3. Installs to ~/.openpets/
  4. Creates binaries in ~/.openpets/bin/
    • pets - Main CLI
    • pets-mcp - MCP server
  5. Updates PATH in shell config
  6. 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:

bash
PACKAGE_NAME="openpets"

Why no @ scope?

  • Simpler for global installs
  • Matches CLI command name
  • Easier for users to remember

Install Location โ€‹

bash
INSTALL_DIR="$HOME/.openpets"
BIN_DIR="$INSTALL_DIR/bin"
LIB_DIR="$INSTALL_DIR/lib"

Binary Wrappers โ€‹

~/.openpets/bin/pets:

javascript
#!/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 200

Netlify (netlify.toml):

toml
[[redirects]]
  from = "/install"
  to = "https://raw.githubusercontent.com/raggle-ai/raggle-repo/main/core/openpets/install.sh"
  status = 200
  force = true

Vercel (vercel.json):

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:

bash
# 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.sh

Then users can:

bash
curl -fsSL https://pets.raggle.co/install.sh | bash

๐Ÿงช Testing โ€‹

Test Script Locally โ€‹

bash
# 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.sh

Test Installation โ€‹

bash
# 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 ~/.bashrc

ShellCheck Validation โ€‹

bash
shellcheck install.sh

๐Ÿ”ง Customization โ€‹

Install Specific Version โ€‹

bash
VERSION=1.0.3 curl -fsSL https://pets.raggle.co/install | bash

Silent Installation โ€‹

bash
curl -fsSL https://pets.raggle.co/install | bash -s -- --silent

Custom Install Directory โ€‹

Modify install.sh:

bash
# Allow override via environment variable
INSTALL_DIR="${OPENPETS_INSTALL_DIR:-$HOME/.openpets}"

Then:

bash
OPENPETS_INSTALL_DIR=/usr/local/openpets curl -fsSL https://pets.raggle.co/install | bash

๐ŸŽจ Installer Features โ€‹

Dependency Checking โ€‹

bash
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 โ€‹

bash
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:

bash
# 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:

bash
# Send anonymous analytics
curl -s "https://analytics.pets.raggle.co/install?version=$VERSION&os=$os&arch=$arch" > /dev/null 2>&1 || true

Count via GitHub โ€‹

GitHub tracks raw file requests:

  • Insights โ†’ Traffic โ†’ Popular content

๐Ÿ”„ Updating Installer โ€‹

After npm Publish โ€‹

The installer automatically uses the latest npm version:

bash
npm install "$PACKAGE_NAME$version_arg" --no-save

No changes needed unless:

  • Package name changes
  • Installation structure changes
  • New features added

Testing Changes โ€‹

bash
# 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"

bash
# Restart shell or source config
source ~/.zshrc  # or ~/.bashrc

"Node.js not found"

bash
# 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"

bash
# 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:

markdown
### Quick Install

Install OpenPets with a single command:

```bash
curl -fsSL https://pets.raggle.co/install | bash

After installation:

  • pets --help - Show help
  • pets list - List installed pets
  • pets-mcp - Start MCP server

Uninstall โ€‹

bash
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

๐Ÿ†˜ Support โ€‹