From d31eabed6bddbbe08b48cfac1e969f12aa18529f Mon Sep 17 00:00:00 2001 From: nmemmert Date: Tue, 13 Jan 2026 15:52:03 -0500 Subject: [PATCH] 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 --- DEPLOYMENT.md | 21 ++++++ README.md | 21 +++++- install.sh | 172 ++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 211 insertions(+), 3 deletions(-) create mode 100755 install.sh diff --git a/DEPLOYMENT.md b/DEPLOYMENT.md index fb66f90..1fa8a34 100644 --- a/DEPLOYMENT.md +++ b/DEPLOYMENT.md @@ -1,5 +1,26 @@ # Capsule Budget - ZimaOS Deployment Guide +## One-Line Installation (Easiest) + +Run this single command on your ZimaOS device: + +```bash +curl -fsSL https://raw.githubusercontent.com/nmemmert/budget/master/install.sh | bash +``` + +**What it does:** +1. ✅ Checks for Docker and Docker Compose +2. ✅ Downloads Capsule Budget +3. ✅ Generates secure encryption key +4. ✅ Creates data directory +5. ✅ Builds Docker image +6. ✅ Starts the container +7. ✅ Shows access URLs + +**Then access at:** `http://your-zima-ip:7654` + +--- + ## Quick Deploy 1. **Clone or upload this repository to your ZimaOS device** diff --git a/README.md b/README.md index 0871b77..afe59f8 100644 --- a/README.md +++ b/README.md @@ -59,11 +59,26 @@ A modern, privacy-focused envelope budgeting application built with Next.js, Typ ## Getting Started -### Prerequisites +### One-Line Installation (Docker - Recommended) -- Node.js 18+ and npm +For ZimaOS or any system with Docker: -### Installation +```bash +curl -fsSL https://raw.githubusercontent.com/nmemmert/budget/master/install.sh | bash +``` + +This will automatically: +- Check for Docker and Docker Compose +- Download Capsule Budget +- Generate a secure encryption key +- Build and start the container +- Set up data persistence + +**Access at:** `http://localhost:7654` or `http://your-device-ip:7654` + +### Manual Installation (Development) + +If you want to run from source: 1. Clone the repository: ```bash diff --git a/install.sh b/install.sh new file mode 100755 index 0000000..b2dcee9 --- /dev/null +++ b/install.sh @@ -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