- stock_tracker.py: Portfolio tracking with P&L calculations - Jenkinsfile: Full CI/CD with linting, testing, deployment - test_requirements.txt: Testing dependencies - .pylintrc: Linting configuration - requirements.txt: Production dependencies Features: - Stock & crypto portfolio tracking - Investment guideline checks - Unit tests & linting pipeline - Integration tests for Oracle/Telegram/Gitea - Staging & Production deployment stages
63 lines
1.6 KiB
Bash
63 lines
1.6 KiB
Bash
#!/bin/bash
|
|
# Deploy Habit & Diet Bot to Ubuntu
|
|
# Run on 192.168.0.147
|
|
|
|
set -e
|
|
|
|
APP_DIR="/home/joungmin/habit_bot"
|
|
VENV_DIR="$APP_DIR/venv"
|
|
|
|
echo "🔮 Deploying Habit & Diet Bot..."
|
|
|
|
# Create directory
|
|
mkdir -p $APP_DIR
|
|
cd $APP_DIR
|
|
|
|
# Copy files
|
|
echo "Copying files..."
|
|
# Copy from Mac mini (run this on Mac):
|
|
# scp -r habit_bot.py habit_bot_requirements.txt deploy_habit_bot.sh joungmin@192.168.0.147:$APP_DIR/
|
|
|
|
# Create virtual environment
|
|
if [ ! -d "$VENV_DIR" ]; then
|
|
python3 -m venv $VENV_DIR
|
|
fi
|
|
|
|
# Install dependencies
|
|
source $VENV_DIR/bin/activate
|
|
pip install -q -r $APP_DIR/habit_bot_requirements.txt
|
|
|
|
# Create systemd service
|
|
cat > /tmp/habit-bot.service << 'EOF'
|
|
[Unit]
|
|
Description=Habit & Diet Telegram Bot
|
|
After=network.target
|
|
|
|
[Service]
|
|
Type=simple
|
|
User=joungmin
|
|
WorkingDirectory=/home/joungmin/habit_bot
|
|
Environment="PATH=/home/joungmin/habit_bot/venv/bin"
|
|
Environment="TELEGRAM_BOT_TOKEN=your_token_here"
|
|
Environment="OBSIDIAN_PATH=/Users/joungmin/Documents/Obsidian Vault"
|
|
Environment="ORACLE_DSN=h8i4i0g8cxtd2lpf_high"
|
|
Environment="ORACLE_USER=admin"
|
|
Environment="ORACLE_PASSWORD=your_password"
|
|
Environment="ORACLE_WALLET=/path/to/wallet"
|
|
ExecStart=/home/joungmin/habit_bot/venv/bin/python3 /home/joungmin/habit_bot/habit_bot.py
|
|
Restart=always
|
|
|
|
[Install]
|
|
WantedBy=multi-user.target
|
|
EOF
|
|
|
|
echo "✅ Deployment complete!"
|
|
echo ""
|
|
echo "To start:"
|
|
echo " 1. Set TELEGRAM_BOT_TOKEN in /tmp/habit-bot.service"
|
|
echo " 2. sudo cp /tmp/habit-bot.service /etc/systemd/system/"
|
|
echo " 3. sudo systemctl daemon-reload"
|
|
echo " 4. sudo systemctl start habit-bot"
|
|
echo ""
|
|
echo "Bot URL: http://localhost:3000/joungmin/openclaw-workspace"
|