Compare commits

...

2 Commits

Author SHA1 Message Date
1050b96d2a fix: make systemd service portable across machines
- Add start-proxy.sh wrapper that handles nvm/fnm/volta/asdf
- Add install-service.sh for one-command installation
- Remove hardcoded node version paths from service file
2026-02-01 20:12:56 +01:00
5deb0b0754 a service file 2026-02-01 17:01:58 +01:00
3 changed files with 114 additions and 0 deletions

View File

@@ -0,0 +1,31 @@
# Antigravity Claude Proxy - systemd user service
#
# Installation:
# 1. Copy this file to ~/.config/systemd/user/antigravity-claude-proxy.service
# 2. Copy start-proxy.sh to a permanent location (e.g., ~/.local/bin/)
# 3. Update PROXY_SCRIPT below to point to start-proxy.sh
# 4. Run: systemctl --user daemon-reload
# 5. Run: systemctl --user enable --now antigravity-claude-proxy
#
# Management:
# systemctl --user status antigravity-claude-proxy
# systemctl --user restart antigravity-claude-proxy
# journalctl --user -u antigravity-claude-proxy -f
[Unit]
Description=Antigravity Claude Proxy Server
Documentation=https://github.com/badri-s2001/antigravity-claude-proxy
After=network.target
[Service]
Type=simple
# Customize the port as needed
Environment=PORT=3001
# Path to the wrapper script - update this to match your installation
# The wrapper script handles nvm/fnm/volta/asdf automatically
ExecStart=%h/.local/bin/start-proxy.sh start
Restart=on-failure
RestartSec=5
[Install]
WantedBy=default.target

34
docs/install-service.sh Executable file
View File

@@ -0,0 +1,34 @@
#!/bin/bash
# Install antigravity-claude-proxy as a systemd user service
# Run from anywhere - automatically detects paths
set -e
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
LOCAL_BIN="$HOME/.local/bin"
SYSTEMD_USER_DIR="$HOME/.config/systemd/user"
echo "Installing antigravity-claude-proxy systemd service..."
# Create directories if needed
mkdir -p "$LOCAL_BIN"
mkdir -p "$SYSTEMD_USER_DIR"
# Copy wrapper script
cp "$SCRIPT_DIR/start-proxy.sh" "$LOCAL_BIN/"
chmod +x "$LOCAL_BIN/start-proxy.sh"
echo " Installed: $LOCAL_BIN/start-proxy.sh"
# Copy service file
cp "$SCRIPT_DIR/antigravity-claude-proxy.service" "$SYSTEMD_USER_DIR/"
echo " Installed: $SYSTEMD_USER_DIR/antigravity-claude-proxy.service"
# Reload systemd
systemctl --user daemon-reload
echo " Reloaded systemd user daemon"
echo ""
echo "Installation complete. Commands:"
echo " systemctl --user enable --now antigravity-claude-proxy # Start and enable on boot"
echo " systemctl --user status antigravity-claude-proxy # Check status"
echo " journalctl --user -u antigravity-claude-proxy -f # View logs"

49
docs/start-proxy.sh Executable file
View File

@@ -0,0 +1,49 @@
#!/bin/bash
# Wrapper script for antigravity-claude-proxy that handles various Node.js version managers
# Used by the systemd service to ensure node is available in PATH
set -e
# Try nvm
if [ -z "$NVM_DIR" ]; then
export NVM_DIR="$HOME/.nvm"
fi
if [ -s "$NVM_DIR/nvm.sh" ]; then
source "$NVM_DIR/nvm.sh"
fi
# Try fnm
if command -v fnm &> /dev/null; then
eval "$(fnm env)"
elif [ -d "$HOME/.fnm" ]; then
export PATH="$HOME/.fnm:$PATH"
eval "$(fnm env 2>/dev/null)" || true
fi
# Try volta
if [ -d "$HOME/.volta" ]; then
export VOLTA_HOME="$HOME/.volta"
export PATH="$VOLTA_HOME/bin:$PATH"
fi
# Try asdf
if [ -s "$HOME/.asdf/asdf.sh" ]; then
source "$HOME/.asdf/asdf.sh"
fi
# Verify node is available
if ! command -v node &> /dev/null; then
echo "Error: node not found in PATH after sourcing version managers" >&2
echo "PATH: $PATH" >&2
exit 1
fi
# Verify antigravity-claude-proxy is available
if ! command -v antigravity-claude-proxy &> /dev/null; then
echo "Error: antigravity-claude-proxy not found in PATH" >&2
echo "Install with: npm install -g antigravity-claude-proxy" >&2
echo "PATH: $PATH" >&2
exit 1
fi
exec antigravity-claude-proxy "$@"