-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.sh
More file actions
executable file
·105 lines (87 loc) · 2.74 KB
/
setup.sh
File metadata and controls
executable file
·105 lines (87 loc) · 2.74 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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
#!/bin/bash
# Amor -- Cloud Server Setup Script
# Usage: ssh root@your-server 'bash -s' < setup.sh
#
# Installs Amor on any Ubuntu 22+ VPS and sets up a systemd service
# that runs 24/7. Tested on Hetzner CX22, DigitalOcean, AWS Lightsail.
set -e
echo "=== Amor Setup ==="
# 1. Install Python 3.10+ if not present
if ! command -v python3 &>/dev/null || python3 -c "import sys; sys.exit(0 if sys.version_info >= (3,10) else 1)" 2>/dev/null; then
echo "Python 3.10+ found"
else
echo "Installing Python..."
apt-get update -qq
apt-get install -y python3 python3-pip python3-venv
fi
# 2. Install Node.js (required for Claude Code CLI)
if ! command -v node &>/dev/null; then
echo "Installing Node.js..."
curl -fsSL https://deb.nodesource.com/setup_20.x | bash -
apt-get install -y nodejs
fi
# 3. Install Claude Code CLI
if ! command -v claude &>/dev/null; then
echo "Installing Claude Code CLI..."
npm install -g @anthropic-ai/claude-code
fi
# 4. Install Amor
echo "Installing Amor..."
pip3 install --break-system-packages amor 2>/dev/null || pip3 install amor
# 5. Set up project directory
read -p "Enter your project's git clone URL: " REPO_URL
read -p "Enter install directory [/opt/product]: " INSTALL_DIR
INSTALL_DIR=${INSTALL_DIR:-/opt/product}
if [ ! -d "$INSTALL_DIR" ]; then
git clone "$REPO_URL" "$INSTALL_DIR"
fi
cd "$INSTALL_DIR"
# 6. Initialize Amor
if [ ! -f "amor.yaml" ]; then
amor init
fi
# 7. Create .env if not exists
if [ ! -f ".env" ]; then
cat > .env << 'ENVEOF'
# Required
GITHUB_TOKEN=ghp_your_token_here
TELEGRAM_BOT_TOKEN=your_telegram_bot_token
TELEGRAM_CHAT_ID=your_chat_id
GEMINI_API_KEY=your_gemini_key
# Optional
POSTHOG_API_KEY=
POSTHOG_PROJECT_ID=
ENVEOF
echo ""
echo ">>> Edit .env with your API keys: nano $INSTALL_DIR/.env"
fi
# 8. Set git identity
git config --global user.name "$(git log -1 --format='%an' 2>/dev/null || echo 'Your Name')"
git config --global user.email "$(git log -1 --format='%ae' 2>/dev/null || echo 'you@example.com')"
# 9. Create systemd service
cat > /etc/systemd/system/amor.service << EOF
[Unit]
Description=Amor Autonomous Product Builder
After=network.target
[Service]
WorkingDirectory=$INSTALL_DIR
EnvironmentFile=$INSTALL_DIR/.env
ExecStart=$(which amor || echo /usr/local/bin/amor) start
Restart=always
RestartSec=30
StandardOutput=journal
StandardError=journal
[Install]
WantedBy=multi-user.target
EOF
systemctl daemon-reload
systemctl enable amor
echo ""
echo "=== Setup Complete ==="
echo ""
echo "Next steps:"
echo " 1. Edit .env: nano $INSTALL_DIR/.env"
echo " 2. Edit config: nano $INSTALL_DIR/amor.yaml"
echo " 3. Start: systemctl start amor"
echo " 4. Monitor: journalctl -u amor -f"
echo " 5. Telegram: message your bot /status"