Add one-line curl installer for Docker deployment

- Created install.sh for automated installation
- Checks prerequisites (Docker, Docker Compose)
- Clones repository or downloads files
- Auto-generates encryption key
- Builds and starts container automatically
- Supports both git and non-git environments
- Updated README.md with one-line install command
- Updated DEPLOYMENT.md with curl installation section
- Provides detailed success/error messages

Usage: curl -fsSL https://raw.githubusercontent.com/nmemmert/budget/master/install.sh | bash
This commit is contained in:
nmemmert committed 2026-01-13 15:52:03 -05:00
1 parent 97c47cde1c
commit d31eabed6b
3 files changed
+211 -3

No files matched your search

Executable
+172
View File
@@ -0,0 +1,172 @@
#!/bin/bash
# Capsule Budget - One-Line Installer for ZimaOS/Docker
# Usage: curl -fsSL https://raw.githubusercontent.com/nmemmert/budget/master/install.sh | bash
set -e
REPO_URL="https://github.com/nmemmert/budget.git"
INSTALL_DIR="capsule-budget"
echo "╔════════════════════════════════════════════════════════════╗"
echo "║ ║"
echo "║ 🌟 Capsule Budget Installer 🌟 ║"
echo "║ by NeCloud ║"
echo "║ ║"
echo "╚════════════════════════════════════════════════════════════╝"
echo ""
# Check for Docker
echo "🔍 Checking prerequisites..."
if ! command -v docker &> /dev/null; then
echo "❌ Docker is not installed"
echo "Please install Docker first: https://docs.docker.com/get-docker/"
exit 1
fi
echo "✅ Docker found"
# Check for Docker Compose
if ! command -v docker-compose &> /dev/null && ! docker compose version &> /dev/null; then
echo "❌ Docker Compose is not installed"
echo "Please install Docker Compose: https://docs.docker.com/compose/install/"
exit 1
fi
echo "✅ Docker Compose found"
# Check if git is available
if command -v git &> /dev/null; then
USE_GIT=true
echo "✅ Git found"
else
USE_GIT=false
echo "⚠️ Git not found, will download files directly"
fi
echo ""
echo "📦 Installing Capsule Budget..."
# Remove existing installation if present
if [ -d "$INSTALL_DIR" ]; then
echo "⚠️ Existing installation found"
read -p "Do you want to remove it and reinstall? (y/N): " -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]; then
echo "🗑️ Removing old installation..."
rm -rf "$INSTALL_DIR"
else
echo "❌ Installation cancelled"
exit 0
fi
fi
# Clone or download repository
if [ "$USE_GIT" = true ]; then
echo "📥 Cloning repository..."
git clone "$REPO_URL" "$INSTALL_DIR"
else
echo "📥 Downloading repository..."
mkdir -p "$INSTALL_DIR"
cd "$INSTALL_DIR"
# Download essential files
curl -fsSL "https://raw.githubusercontent.com/nmemmert/budget/master/docker-compose.yml" -o docker-compose.yml
curl -fsSL "https://raw.githubusercontent.com/nmemmert/budget/master/Dockerfile" -o Dockerfile
curl -fsSL "https://raw.githubusercontent.com/nmemmert/budget/master/.env.example" -o .env.example
curl -fsSL "https://raw.githubusercontent.com/nmemmert/budget/master/package.json" -o package.json
# Note: Full source code still needs to be downloaded
echo "⚠️ For full installation, Git is recommended"
echo "Downloading complete source archive..."
curl -fsSL "https://github.com/nmemmert/budget/archive/refs/heads/master.tar.gz" | tar -xz --strip-components=1
cd ..
fi
cd "$INSTALL_DIR"
# Setup environment
echo ""
echo "⚙️ Setting up environment..."
if [ ! -f .env ]; then
echo "📝 Creating .env file..."
cp .env.example .env
# Generate encryption key
if command -v openssl &> /dev/null; then
ENCRYPTION_KEY=$(openssl rand -base64 32)
# Update .env with generated key
if [[ "$OSTYPE" == "darwin"* ]]; then
sed -i '' "s/change-this-to-a-secure-random-key/$ENCRYPTION_KEY/" .env
else
sed -i "s/change-this-to-a-secure-random-key/$ENCRYPTION_KEY/" .env
fi
echo "✅ Generated secure encryption key"
else
echo "⚠️ OpenSSL not found. Please manually set ENCRYPTION_KEY in .env file"
fi
else
echo "ℹ️ .env file already exists, keeping existing configuration"
fi
# Create data directory
mkdir -p data
echo "✅ Data directory created"
# Build and start
echo ""
echo "🔨 Building Docker image..."
docker-compose build
echo ""
echo "🚀 Starting Capsule Budget..."
docker-compose up -d
# Wait for container
echo "⏳ Waiting for container to start..."
sleep 5
# Verify container is running
if docker-compose ps | grep -q "Up"; then
echo ""
echo "╔════════════════════════════════════════════════════════════╗"
echo "║ ║"
echo "║ ✅ Installation Complete! ✅ ║"
echo "║ ║"
echo "╚════════════════════════════════════════════════════════════╝"
echo ""
echo "📊 Capsule Budget is running!"
echo ""
echo "🌐 Access your budget app at:"
echo " • http://localhost:7654"
if command -v hostname &> /dev/null; then
LOCAL_IP=$(hostname -I 2>/dev/null | awk '{print $1}' || echo "your-device-ip")
echo " • http://$LOCAL_IP:7654"
fi
echo ""
echo "📁 Installation directory: $(pwd)"
echo "💾 Data storage: $(pwd)/data"
echo ""
echo "🔧 Useful commands (run from $(pwd)):"
echo " docker-compose logs -f # View logs"
echo " docker-compose stop # Stop Capsule"
echo " docker-compose restart # Restart Capsule"
echo " docker-compose down # Stop and remove"
echo ""
echo "📚 Documentation:"
echo " • README.md - Getting started guide"
echo " • DEPLOYMENT.md - Deployment details"
echo ""
echo "🎉 Happy budgeting with Capsule!"
echo ""
else
echo ""
echo "❌ Container failed to start"
echo ""
echo "Troubleshooting:"
echo "1. Check logs: docker-compose logs"
echo "2. Verify .env file has ENCRYPTION_KEY set"
echo "3. Check if port 7654 is available"
echo ""
exit 1
fi