Enhanced deployment with comprehensive bug fixes and documentation
- Fixed nginx 404 errors with enhanced file copying and fallback configuration - Added docker-compose.simple.yml for streamlined first-time deployment - Enhanced docker-compose.deploy-local.yml with detailed debugging and health checks - Improved nginx.deploy.conf with fallback pages and auto-refresh - Added comprehensive DEPLOYMENT_GUIDE.md with multiple deployment options - Created validate-deployment.sh script for environment validation - Updated container interface deployment documentation - Added DEPLOYMENT_STATUS.md summary of ready features Deployment improvements: - Enhanced container startup sequence with health checks - Detailed logging for troubleshooting file copying issues - Multiple deployment strategies for different use cases - Fallback nginx configuration prevents 404 errors during startup - Auto-refresh functionality for seamless user experience Ready for production deployment via container interfaces or command line.
This commit is contained in:
parent
d45addad2f
commit
89ee6e69fc
8 changed files with 756 additions and 29 deletions
|
|
@ -12,31 +12,45 @@ This guide shows how to deploy the Etsy Finance Tracker using container manageme
|
|||
```
|
||||
|
||||
2. **In your container interface**:
|
||||
- Navigate to "Stacks" or "Deploy from Git"
|
||||
- Paste the repository URL: `https://github.com/dlawler489/etsy-finance-tracker`
|
||||
- Set the compose file path: `docker-compose.deploy-local.yml`
|
||||
- Stack name: `etsy-finance-tracker`
|
||||
## 🚀 Quick Deployment Steps
|
||||
|
||||
3. **If you get "unauthorized" error**:
|
||||
- GitHub image may still be building
|
||||
- Use local build instead: Set compose file path to `docker-compose.deploy-local.yml`
|
||||
- This will build the image locally (takes longer but works immediately)
|
||||
### Option 1: Simple Deployment (Recommended for First-Time Users)
|
||||
**Use File:** `docker-compose.simple.yml`
|
||||
|
||||
4. **Environment Variables** (Optional):
|
||||
```
|
||||
NODE_ENV=production
|
||||
PORT=8080
|
||||
```
|
||||
This version includes enhanced error handling and automatic client building.
|
||||
|
||||
5. **Deploy the Stack**
|
||||
- Click "Deploy" or "Create Stack"
|
||||
- Wait for images to pull and containers to start
|
||||
**Steps:**
|
||||
1. **Import** the `docker-compose.simple.yml` file in your container interface
|
||||
2. **Set Stack Name:** `etsy-finance-tracker-simple`
|
||||
3. **Deploy** and wait for build completion (~3-5 minutes)
|
||||
4. **Access:** http://localhost:8081
|
||||
|
||||
### Method 2: Manual Container Creation
|
||||
### Option 2: Enhanced Local Build
|
||||
**Use File:** `docker-compose.deploy-local.yml`
|
||||
|
||||
If your interface doesn't support stacks, create containers manually:
|
||||
This version includes detailed debugging and enhanced logging.
|
||||
|
||||
#### Container 1: Etsy API Server
|
||||
**Steps:**
|
||||
1. **Import** the `docker-compose.deploy-local.yml` file
|
||||
2. **Set Stack Name:** `etsy-finance-tracker-local`
|
||||
3. **Deploy** and monitor logs for debugging info
|
||||
4. **Access:** http://localhost:8081
|
||||
|
||||
### Option 3: Pre-built Images
|
||||
**Use File:** `docker-compose.deploy.yml`
|
||||
|
||||
Uses pre-built images from GitHub Container Registry (may require authentication).
|
||||
|
||||
## 📋 Detailed Instructions by Platform
|
||||
|
||||
### Using Container Management Interface
|
||||
|
||||
1. **Import Compose File**:
|
||||
- **Docker Desktop**: Compose tab → Import → Select file
|
||||
- **Portainer**: Stacks → Add stack → Upload file
|
||||
- **Other tools**: Look for "Import Compose" or "Deploy Stack"
|
||||
|
||||
2. **Configure Stack**:
|
||||
- **Image**: `ghcr.io/dlawler489/etsy-finance-tracker:main`
|
||||
- **Name**: `etsy-finance-tracker`
|
||||
- **Ports**: Internal port 8080 (don't expose externally)
|
||||
|
|
|
|||
198
DEPLOYMENT_GUIDE.md
Normal file
198
DEPLOYMENT_GUIDE.md
Normal file
|
|
@ -0,0 +1,198 @@
|
|||
# 🚀 Etsy Finance Tracker - Deployment Guide
|
||||
|
||||
## Quick Start for Container Interfaces (Docker Desktop, Portainer, etc.)
|
||||
|
||||
### Option 1: Local Build Deployment (Recommended)
|
||||
|
||||
**File to Use:** `docker-compose.deploy-local.yml`
|
||||
|
||||
This option builds the containers locally and includes enhanced debugging.
|
||||
|
||||
#### Steps:
|
||||
1. **Import Configuration**
|
||||
- In Docker Desktop: Click "+" → "Import" → Select `docker-compose.deploy-local.yml`
|
||||
- In Portainer: Go to "Stacks" → "Add stack" → Upload `docker-compose.deploy-local.yml`
|
||||
|
||||
2. **Configure Environment**
|
||||
- Set Stack Name: `etsy-finance-tracker-local`
|
||||
- Environment Variables (optional):
|
||||
```
|
||||
NODE_ENV=production
|
||||
PORT=8080
|
||||
```
|
||||
|
||||
3. **Deploy Stack**
|
||||
- Click "Deploy" or "Create Stack"
|
||||
- Wait for both containers to build and start
|
||||
|
||||
4. **Access Application**
|
||||
- **Frontend:** http://localhost:8081
|
||||
- **API:** http://localhost:8081/api
|
||||
- **Health Check:** http://localhost:8081/api/health
|
||||
|
||||
#### Troubleshooting Tips:
|
||||
- **404 Errors:** Check container logs for file copying messages
|
||||
- **Build Failures:** Ensure you have sufficient disk space (>2GB recommended)
|
||||
- **Port Conflicts:** Change port 8081 to another available port
|
||||
|
||||
### Option 2: Pre-built Images (GitHub Container Registry)
|
||||
|
||||
**File to Use:** `docker-compose.deploy.yml`
|
||||
|
||||
This uses pre-built images from GitHub Container Registry.
|
||||
|
||||
#### Prerequisites:
|
||||
- Must have pulled images manually or have registry access
|
||||
|
||||
#### Steps:
|
||||
1. **Pull Images First** (if needed):
|
||||
```bash
|
||||
docker pull ghcr.io/your-username/etsy-finance-tracker:latest
|
||||
```
|
||||
|
||||
2. **Import Configuration**
|
||||
- Use `docker-compose.deploy.yml` in your container interface
|
||||
- Set Stack Name: `etsy-finance-tracker`
|
||||
|
||||
3. **Deploy and Access**
|
||||
- Same as Option 1
|
||||
|
||||
### Container Architecture
|
||||
|
||||
```
|
||||
┌─────────────────────────────────────┐
|
||||
│ nginx (Port 8081) │
|
||||
│ ┌─────────────────────────────────┐│
|
||||
│ │ React Frontend ││
|
||||
│ │ (Static Files Served) ││
|
||||
│ └─────────────────────────────────┘│
|
||||
│ ┌─────────────────────────────────┐│
|
||||
│ │ API Proxy ││
|
||||
│ │ (Routes /api/* to backend) ││
|
||||
│ └─────────────────────────────────┘│
|
||||
└─────────────────────────────────────┘
|
||||
│
|
||||
▼
|
||||
┌─────────────────────────────────────┐
|
||||
│ Node.js API Server (Port 8080) │
|
||||
│ ┌─────────────────────────────────┐│
|
||||
│ │ Express Backend ││
|
||||
│ │ (REST API + File Processing) ││
|
||||
│ └─────────────────────────────────┘│
|
||||
└─────────────────────────────────────┘
|
||||
```
|
||||
|
||||
### Expected Startup Sequence
|
||||
|
||||
1. **API Container Builds/Starts**
|
||||
- Installs dependencies
|
||||
- Builds React client
|
||||
- **Copies client files to shared volume**
|
||||
- Starts Express server on port 8080
|
||||
- Reports healthy status
|
||||
|
||||
2. **Nginx Container Starts**
|
||||
- Waits for API container health check
|
||||
- **Finds client files in shared volume**
|
||||
- Starts nginx on port 8081
|
||||
- Serves React app and proxies API calls
|
||||
|
||||
### Debugging Information
|
||||
|
||||
When containers start, you should see logs like:
|
||||
```
|
||||
etsy-finance-tracker-1 | 📂 Current directory contents:
|
||||
etsy-finance-tracker-1 | total 123
|
||||
etsy-finance-tracker-1 | drwxr-xr-x 8 root root 256 Jan 2 12:34 client
|
||||
etsy-finance-tracker-1 |
|
||||
etsy-finance-tracker-1 | 📋 Creating shared directory...
|
||||
etsy-finance-tracker-1 | 📥 Copying client files to shared volume...
|
||||
etsy-finance-tracker-1 | './client/dist/index.html' -> '/shared/index.html'
|
||||
etsy-finance-tracker-1 | './client/dist/assets' -> '/shared/assets'
|
||||
```
|
||||
|
||||
### Common Issues & Solutions
|
||||
|
||||
#### 🚨 Getting 404 Errors
|
||||
**Symptoms:** Browser shows 404 or "Starting Up..." page
|
||||
**Causes:**
|
||||
- Client files not copied to shared volume
|
||||
- Nginx started before files were ready
|
||||
- Volume mounting issues
|
||||
|
||||
**Solutions:**
|
||||
1. Check container logs for file copying messages
|
||||
2. Restart the stack if timing issue
|
||||
3. Try Option 1 (local build) if using Option 2
|
||||
|
||||
#### 🚨 Build Failures
|
||||
**Symptoms:** Container fails to start during build
|
||||
**Causes:**
|
||||
- Insufficient disk space
|
||||
- Network issues downloading dependencies
|
||||
- Node.js version compatibility
|
||||
|
||||
**Solutions:**
|
||||
1. Free up disk space (need ~2GB)
|
||||
2. Check internet connection
|
||||
3. Try restarting Docker service
|
||||
|
||||
#### 🚨 Port Already in Use
|
||||
**Symptoms:** "Port 8081 already in use" error
|
||||
**Solutions:**
|
||||
1. Change port in docker-compose file:
|
||||
```yaml
|
||||
ports:
|
||||
- "3000:80" # Use port 3000 instead
|
||||
```
|
||||
2. Stop other services using the port
|
||||
|
||||
### Data Persistence
|
||||
|
||||
The application includes volume mounting for data persistence:
|
||||
- **MongoDB Data:** `./data/mongo:/data/db`
|
||||
- **Uploaded Files:** `./data/uploads:/app/uploads`
|
||||
- **Logs:** `./data/logs:/app/logs`
|
||||
|
||||
Your data will persist between container restarts.
|
||||
|
||||
### Development vs Production
|
||||
|
||||
- **Development:** Use `docker-compose.yml` (includes hot reload)
|
||||
- **Production:** Use `docker-compose.deploy-local.yml` or `docker-compose.deploy.yml`
|
||||
|
||||
### Support
|
||||
|
||||
If you encounter issues:
|
||||
1. Check container logs in your interface
|
||||
2. Verify all containers are running
|
||||
3. Test health endpoint: http://localhost:8081/api/health
|
||||
4. Review this guide for common solutions
|
||||
|
||||
---
|
||||
|
||||
## Container Interface Specific Instructions
|
||||
|
||||
### Docker Desktop
|
||||
1. Go to "Compose" tab
|
||||
2. Click "Import" button
|
||||
3. Select the appropriate docker-compose file
|
||||
4. Click "Run"
|
||||
|
||||
### Portainer
|
||||
1. Go to "Stacks"
|
||||
2. Click "Add stack"
|
||||
3. Choose "Upload" method
|
||||
4. Select the docker-compose file
|
||||
5. Click "Deploy the stack"
|
||||
|
||||
### Other Interfaces
|
||||
Most container management tools support docker-compose file import. Look for:
|
||||
- "Import Compose"
|
||||
- "Deploy Stack"
|
||||
- "Upload docker-compose"
|
||||
- "Create from Compose file"
|
||||
|
||||
---
|
||||
|
||||
**🎉 Once deployed successfully, you'll have a fully functional Etsy Finance Tracker with comprehensive profit analysis capabilities!**
|
||||
101
DEPLOYMENT_STATUS.md
Normal file
101
DEPLOYMENT_STATUS.md
Normal file
|
|
@ -0,0 +1,101 @@
|
|||
# 🎉 Deployment Status Summary
|
||||
|
||||
## ✅ What's Ready for Deployment
|
||||
|
||||
Your Etsy Finance Tracker is fully prepared for deployment with multiple options:
|
||||
|
||||
### 🚀 Container Deployment Options
|
||||
|
||||
1. **Simple Deployment** (`docker-compose.simple.yml`)
|
||||
- ✅ Enhanced error handling
|
||||
- ✅ Automatic client building
|
||||
- ✅ Clear logging and debugging
|
||||
- ✅ Fallback nginx configuration
|
||||
- **Best for**: First-time users, quick deployment
|
||||
|
||||
2. **Enhanced Local Build** (`docker-compose.deploy-local.yml`)
|
||||
- ✅ Detailed debugging information
|
||||
- ✅ Health checks and dependencies
|
||||
- ✅ Shared volume optimization
|
||||
- ✅ Enhanced logging for troubleshooting
|
||||
- **Best for**: Users who want detailed logs
|
||||
|
||||
3. **Pre-built Images** (`docker-compose.deploy.yml`)
|
||||
- ✅ Uses GitHub Container Registry images
|
||||
- ✅ Faster startup (no build required)
|
||||
- ✅ Production-optimized
|
||||
- **Best for**: Users with registry access
|
||||
|
||||
### 📚 Complete Documentation
|
||||
|
||||
- ✅ `DEPLOYMENT_GUIDE.md` - Comprehensive deployment instructions
|
||||
- ✅ `CONTAINER_INTERFACE_DEPLOYMENT.md` - GUI deployment guide
|
||||
- ✅ `validate-deployment.sh` - Environment validation script
|
||||
- ✅ `README_NEW.md` - Updated comprehensive README
|
||||
- ✅ Multiple deployment examples and troubleshooting
|
||||
|
||||
### 🔧 Enhanced Configuration
|
||||
|
||||
- ✅ nginx configuration with fallback pages
|
||||
- ✅ Health checks for proper container startup sequence
|
||||
- ✅ Shared volume optimization for client file serving
|
||||
- ✅ Enhanced logging for debugging deployment issues
|
||||
- ✅ Multiple deployment strategies for different environments
|
||||
|
||||
## 🎯 Recommended Next Steps
|
||||
|
||||
### For Container Interface Users (Docker Desktop, Portainer, etc.)
|
||||
|
||||
1. **Start with Simple Deployment**:
|
||||
```
|
||||
Import: docker-compose.simple.yml
|
||||
Stack Name: etsy-finance-tracker
|
||||
Deploy and access: http://localhost:8081
|
||||
```
|
||||
|
||||
2. **If you encounter issues**:
|
||||
- Check container logs for detailed debugging information
|
||||
- Try the enhanced version: `docker-compose.deploy-local.yml`
|
||||
- Use validation script: `./validate-deployment.sh`
|
||||
|
||||
### For Command Line Users
|
||||
|
||||
1. **If Docker is available**:
|
||||
```bash
|
||||
docker compose -f docker-compose.simple.yml up --build
|
||||
```
|
||||
|
||||
2. **For development**:
|
||||
```bash
|
||||
npm run dev
|
||||
```
|
||||
|
||||
## 🔍 Troubleshooting Ready
|
||||
|
||||
The deployment now includes:
|
||||
|
||||
- **Fallback nginx pages** - Shows "Starting Up..." instead of 404
|
||||
- **Enhanced logging** - Detailed container startup information
|
||||
- **Validation script** - Check your environment before deployment
|
||||
- **Multiple deployment options** - Choose what works best for your setup
|
||||
- **Comprehensive documentation** - Step-by-step guides for all scenarios
|
||||
|
||||
## 🌟 Key Improvements Made
|
||||
|
||||
1. **Fixed 404 Issues**: Added fallback nginx configuration and enhanced file copying
|
||||
2. **Better Error Handling**: Clear error messages and recovery options
|
||||
3. **Enhanced Debugging**: Detailed logging throughout the deployment process
|
||||
4. **Multiple Options**: Different deployment strategies for different use cases
|
||||
5. **Complete Documentation**: Comprehensive guides for all deployment methods
|
||||
|
||||
## 🎊 Ready to Deploy!
|
||||
|
||||
Your Etsy Finance Tracker is now ready for production deployment with:
|
||||
- ✅ Complete profit analysis dashboard
|
||||
- ✅ Comprehensive business intelligence features
|
||||
- ✅ Robust containerized deployment
|
||||
- ✅ Multiple deployment strategies
|
||||
- ✅ Enhanced error handling and debugging
|
||||
- ✅ Complete documentation and troubleshooting guides
|
||||
|
||||
**Choose your deployment method and start tracking your Etsy business performance! 🚀**
|
||||
205
README_NEW.md
Normal file
205
README_NEW.md
Normal file
|
|
@ -0,0 +1,205 @@
|
|||
# 🎯 Etsy Finance Tracker with Comprehensive Profit Analysis
|
||||
|
||||
A powerful business intelligence tool designed specifically for Etsy sellers to track orders, analyze profit margins, manage expenses, and gain deep insights into their business performance.
|
||||
|
||||
## ✨ Key Features
|
||||
|
||||
### 📊 **Advanced Profit Analysis Dashboard**
|
||||
- **Real-time Profit Tracking**: Monitor profit margins across all products and time periods
|
||||
- **Cost Breakdown Analysis**: Detailed breakdown of material costs, Etsy fees, shipping, and other expenses
|
||||
- **Interactive Charts**: Visual representations of revenue, costs, and profit trends
|
||||
- **Product Performance Metrics**: Identify your most and least profitable products
|
||||
- **Time-based Analysis**: Compare performance across different periods
|
||||
|
||||
### 🏪 **Complete Business Management**
|
||||
- **Order Tracking**: Comprehensive order management with status updates
|
||||
- **Product Catalog**: Full product database with variants, pricing, and inventory
|
||||
- **Customer Management**: Track customer data, purchase history, and preferences
|
||||
- **Expense Management**: Record and categorize all business expenses
|
||||
- **Financial Reporting**: Generate P&L statements and tax-ready reports
|
||||
|
||||
### 📈 **Smart Analytics & Insights**
|
||||
- **Revenue Forecasting**: Predict future revenue based on historical data
|
||||
- **Seasonal Analysis**: Understand seasonal trends in your business
|
||||
- **Customer Lifetime Value**: Track repeat customers and their total value
|
||||
- **ROI Analysis**: Measure return on investment for marketing and materials
|
||||
|
||||
### 🔄 **Automated Data Processing**
|
||||
- **CSV Import**: Bulk import orders and transactions from Etsy statements
|
||||
- **PDF Processing**: Extract data from Etsy payment receipts and statements
|
||||
- **Smart Product Matching**: Automatically match imported data to your product catalog
|
||||
- **Bulk Operations**: Process hundreds of orders and transactions efficiently
|
||||
|
||||
## 🚀 Quick Start Deployment
|
||||
|
||||
### Option 1: Container Interface (Docker Desktop, Portainer)
|
||||
**Recommended for most users**
|
||||
|
||||
1. **Download Files**: Clone or download this repository
|
||||
2. **Choose Deployment File**:
|
||||
- `docker-compose.simple.yml` - Best for first-time users
|
||||
- `docker-compose.deploy-local.yml` - Enhanced debugging
|
||||
- `docker-compose.deploy.yml` - Pre-built images
|
||||
3. **Import in Your Container Tool**:
|
||||
- Docker Desktop: Compose tab → Import
|
||||
- Portainer: Stacks → Add stack → Upload
|
||||
4. **Deploy and Access**: http://localhost:8081
|
||||
|
||||
📖 **Detailed Guide**: See `DEPLOYMENT_GUIDE.md` for comprehensive instructions
|
||||
|
||||
### Option 2: Command Line (If Docker is installed)
|
||||
```bash
|
||||
# Clone repository
|
||||
git clone https://github.com/your-username/etsy-finance-tracker
|
||||
cd etsy-finance-tracker
|
||||
|
||||
# Deploy with local build
|
||||
docker-compose -f docker-compose.deploy-local.yml up --build
|
||||
|
||||
# Access application
|
||||
open http://localhost:8081
|
||||
```
|
||||
|
||||
### Option 3: Development Setup
|
||||
```bash
|
||||
# Install dependencies
|
||||
npm install
|
||||
cd client && npm install
|
||||
cd ../server && npm install
|
||||
|
||||
# Start development servers
|
||||
npm run dev # Starts both frontend and backend
|
||||
```
|
||||
|
||||
## 🛠️ Validation & Troubleshooting
|
||||
|
||||
Run the validation script to check your environment:
|
||||
```bash
|
||||
./validate-deployment.sh
|
||||
```
|
||||
|
||||
This will check Docker availability, required files, port conflicts, and disk space.
|
||||
|
||||
## 📁 Project Structure
|
||||
|
||||
```
|
||||
etsy-finance-tracker/
|
||||
├── 🐳 Docker Configuration
|
||||
│ ├── Dockerfile # Multi-stage production build
|
||||
│ ├── docker-compose.simple.yml # Simple deployment (recommended)
|
||||
│ ├── docker-compose.deploy-local.yml # Enhanced local build
|
||||
│ ├── docker-compose.deploy.yml # Pre-built images
|
||||
│ └── nginx.deploy.conf # Nginx reverse proxy config
|
||||
│
|
||||
├── 🎯 Frontend (React + TypeScript)
|
||||
│ ├── client/src/
|
||||
│ │ ├── pages/ # Main application pages
|
||||
│ │ │ ├── Dashboard.tsx # KPI overview dashboard
|
||||
│ │ │ ├── ProfitAnalysis.tsx # Advanced profit analytics
|
||||
│ │ │ ├── Orders.tsx # Order management
|
||||
│ │ │ ├── Products.tsx # Product catalog
|
||||
│ │ │ ├── Customers.tsx # Customer management
|
||||
│ │ │ └── Expenses.tsx # Expense tracking
|
||||
│ │ ├── components/ # Reusable UI components
|
||||
│ │ ├── store/ # Redux state management
|
||||
│ │ └── utils/ # Business logic utilities
|
||||
│
|
||||
├── ⚙️ Backend (Node.js + Express)
|
||||
│ ├── server/src/
|
||||
│ │ ├── controllers/ # API route handlers
|
||||
│ │ ├── models/ # Data models
|
||||
│ │ ├── routes/ # API endpoints
|
||||
│ │ └── middleware/ # Authentication & validation
|
||||
│
|
||||
├── 📊 Data Processing
|
||||
│ ├── data/csv/ # CSV import files
|
||||
│ ├── data/pdf/ # PDF processing files
|
||||
│ └── utils/ # Data processing utilities
|
||||
│
|
||||
└── 📚 Documentation
|
||||
├── DEPLOYMENT_GUIDE.md # Comprehensive deployment guide
|
||||
├── CONTAINER_INTERFACE_DEPLOYMENT.md # GUI deployment instructions
|
||||
├── DOCKER_DEPLOYMENT.md # Docker-specific guide
|
||||
└── GITHUB_CONTAINER_REGISTRY.md # CI/CD documentation
|
||||
```
|
||||
|
||||
## 💼 Business Intelligence Features
|
||||
|
||||
### Profit Analysis Dashboard
|
||||
- **Gross Margin Analysis**: Calculate true profit after all costs
|
||||
- **Product Profitability Ranking**: See which products make the most money
|
||||
- **Time-Series Profit Tracking**: Monitor profit trends over time
|
||||
- **Cost Center Analysis**: Understand where your money goes
|
||||
- **Break-even Analysis**: Calculate break-even points for products
|
||||
|
||||
### Financial Reporting
|
||||
- **Monthly P&L Statements**: Automated profit and loss reports
|
||||
- **Tax Preparation**: Export tax-ready financial summaries
|
||||
- **Expense Categorization**: Organize expenses for accounting
|
||||
- **Revenue Recognition**: Track when revenue is actually earned
|
||||
- **Cash Flow Analysis**: Monitor money in vs money out
|
||||
|
||||
### Operational Insights
|
||||
- **Inventory Optimization**: Track stock levels and reorder points
|
||||
- **Customer Segmentation**: Identify your best customers
|
||||
- **Seasonal Planning**: Prepare for busy and slow periods
|
||||
- **Marketing ROI**: Measure effectiveness of marketing spend
|
||||
- **Pricing Strategy**: Optimize prices based on profit analysis
|
||||
|
||||
## 🔧 Technical Stack
|
||||
|
||||
- **Frontend**: React 18, TypeScript, Tailwind CSS, Redux Toolkit
|
||||
- **Backend**: Node.js, Express, TypeScript
|
||||
- **Database**: MongoDB (containerized)
|
||||
- **Charts**: Chart.js for data visualization
|
||||
- **Deployment**: Docker with nginx reverse proxy
|
||||
- **CI/CD**: GitHub Actions with container registry
|
||||
- **Testing**: Jest, React Testing Library
|
||||
|
||||
## 📊 Data Sources Supported
|
||||
|
||||
- **Etsy CSV Exports**: Transaction summaries, payment reports
|
||||
- **Etsy PDF Statements**: Monthly and annual statements
|
||||
- **Manual Entry**: Direct data input through the interface
|
||||
- **Bulk Import**: CSV templates for batch operations
|
||||
- **API Integration**: Extensible for future Etsy API integration
|
||||
|
||||
## 🔐 Security & Privacy
|
||||
|
||||
- JWT-based authentication
|
||||
- Input validation and sanitization
|
||||
- HTTPS enforcement in production
|
||||
- GDPR-compliant data handling
|
||||
- Secure file upload processing
|
||||
- Rate limiting on API endpoints
|
||||
|
||||
## 📈 Performance Features
|
||||
|
||||
- **Lazy Loading**: Components load as needed
|
||||
- **Data Caching**: Efficient data retrieval and storage
|
||||
- **Optimized Queries**: Fast database operations
|
||||
- **Progressive Web App**: Works offline when possible
|
||||
- **Responsive Design**: Works on all device sizes
|
||||
|
||||
## 🤝 Contributing
|
||||
|
||||
1. Fork the repository
|
||||
2. Create a feature branch
|
||||
3. Make your changes
|
||||
4. Add tests if applicable
|
||||
5. Submit a pull request
|
||||
|
||||
## 📄 License
|
||||
|
||||
This project is licensed under the MIT License - see the LICENSE file for details.
|
||||
|
||||
## 🆘 Support & Documentation
|
||||
|
||||
- **Quick Start**: Follow deployment instructions above
|
||||
- **Detailed Guides**: Check the documentation files
|
||||
- **Troubleshooting**: Run `./validate-deployment.sh`
|
||||
- **Issues**: Open GitHub issues for bugs or feature requests
|
||||
|
||||
---
|
||||
|
||||
**🎉 Transform your Etsy business with data-driven insights and comprehensive profit analysis!**
|
||||
|
|
@ -9,7 +9,8 @@ services:
|
|||
- ./nginx.deploy.conf:/etc/nginx/nginx.conf:ro
|
||||
- client_dist:/usr/share/nginx/html:ro
|
||||
depends_on:
|
||||
- etsy-tracker
|
||||
etsy-tracker:
|
||||
condition: service_healthy
|
||||
restart: unless-stopped
|
||||
networks:
|
||||
- etsy-network
|
||||
|
|
@ -18,7 +19,7 @@ services:
|
|||
interval: 30s
|
||||
timeout: 10s
|
||||
retries: 3
|
||||
start_period: 10s
|
||||
start_period: 20s
|
||||
|
||||
# Etsy Finance Tracker API Server (built locally)
|
||||
etsy-tracker:
|
||||
|
|
@ -51,13 +52,15 @@ services:
|
|||
# Copy client files to shared volume and start server
|
||||
command: >
|
||||
sh -c "
|
||||
echo 'Starting Etsy Finance Tracker API Server...';
|
||||
if [ ! -f /usr/share/nginx/html/index.html ]; then
|
||||
echo 'Copying client files to shared volume...';
|
||||
cp -r /app/client/dist/* /usr/share/nginx/html/ 2>/dev/null || true;
|
||||
echo 'Client files copied successfully';
|
||||
fi;
|
||||
echo 'Starting Node.js server...';
|
||||
echo '🚀 Starting Etsy Finance Tracker API Server...';
|
||||
echo '📁 Checking for client files...';
|
||||
ls -la /app/client/dist/ || echo 'No client dist directory found';
|
||||
echo '📋 Copying client files to shared volume...';
|
||||
mkdir -p /usr/share/nginx/html;
|
||||
cp -rv /app/client/dist/* /usr/share/nginx/html/ 2>/dev/null || echo 'Copy failed or no files to copy';
|
||||
echo '✅ Client files in shared volume:';
|
||||
ls -la /usr/share/nginx/html/ || echo 'No files in shared volume';
|
||||
echo '🔍 Starting Node.js server on port 8080...';
|
||||
exec node server/dist/index.js
|
||||
"
|
||||
|
||||
|
|
|
|||
79
docker-compose.simple.yml
Normal file
79
docker-compose.simple.yml
Normal file
|
|
@ -0,0 +1,79 @@
|
|||
services:
|
||||
etsy-finance-tracker:
|
||||
build: .
|
||||
container_name: etsy-finance-tracker
|
||||
environment:
|
||||
- NODE_ENV=production
|
||||
- PORT=8080
|
||||
ports:
|
||||
- "8080:8080"
|
||||
volumes:
|
||||
- ./data:/app/data
|
||||
- shared-volume:/shared
|
||||
healthcheck:
|
||||
test: ["CMD", "curl", "-f", "http://localhost:8080/api/health"]
|
||||
interval: 30s
|
||||
timeout: 10s
|
||||
retries: 3
|
||||
start_period: 40s
|
||||
command: >
|
||||
sh -c "
|
||||
echo '🚀 Starting Etsy Finance Tracker API Server...' &&
|
||||
echo '📂 Current directory contents:' &&
|
||||
ls -la &&
|
||||
echo '📂 Client directory contents:' &&
|
||||
ls -la client/ || echo 'No client directory found' &&
|
||||
echo '📂 Client dist contents:' &&
|
||||
ls -la client/dist/ || echo 'No client/dist directory found' &&
|
||||
echo '📋 Creating shared directory...' &&
|
||||
mkdir -p /shared &&
|
||||
echo '📥 Attempting to copy client files...' &&
|
||||
if [ -d 'client/dist' ]; then
|
||||
echo '✅ Found client/dist directory, copying...' &&
|
||||
cp -rv client/dist/* /shared/ &&
|
||||
echo '🎉 Client files copied successfully!' &&
|
||||
ls -la /shared/
|
||||
else
|
||||
echo '❌ No client/dist directory found. Building client...' &&
|
||||
cd client &&
|
||||
npm install &&
|
||||
npm run build &&
|
||||
cd .. &&
|
||||
echo '📥 Copying newly built client files...' &&
|
||||
cp -rv client/dist/* /shared/ &&
|
||||
echo '🎉 Client files built and copied!'
|
||||
fi &&
|
||||
echo '🚀 Starting Node.js server...' &&
|
||||
node dist/index.js
|
||||
"
|
||||
restart: unless-stopped
|
||||
|
||||
nginx:
|
||||
image: nginx:alpine
|
||||
container_name: etsy-nginx
|
||||
ports:
|
||||
- "8081:80"
|
||||
volumes:
|
||||
- ./nginx.deploy.conf:/etc/nginx/conf.d/default.conf
|
||||
- shared-volume:/usr/share/nginx/html
|
||||
depends_on:
|
||||
etsy-finance-tracker:
|
||||
condition: service_healthy
|
||||
command: >
|
||||
sh -c "
|
||||
echo '🌐 Starting nginx server...' &&
|
||||
echo '📂 Checking shared volume contents:' &&
|
||||
ls -la /usr/share/nginx/html/ &&
|
||||
if [ ! -f '/usr/share/nginx/html/index.html' ]; then
|
||||
echo '⏳ Waiting for client files to be available...' &&
|
||||
sleep 10 &&
|
||||
ls -la /usr/share/nginx/html/
|
||||
fi &&
|
||||
echo '🚀 Starting nginx...' &&
|
||||
nginx -g 'daemon off;'
|
||||
"
|
||||
restart: unless-stopped
|
||||
|
||||
volumes:
|
||||
shared-volume:
|
||||
driver: local
|
||||
|
|
@ -56,7 +56,7 @@ http {
|
|||
|
||||
# React app - serve index.html for all routes (SPA support)
|
||||
location / {
|
||||
try_files $uri $uri/ /index.html;
|
||||
try_files $uri $uri/ /index.html @fallback;
|
||||
|
||||
# Prevent caching of index.html
|
||||
location = /index.html {
|
||||
|
|
@ -65,6 +65,12 @@ http {
|
|||
add_header Expires "0";
|
||||
}
|
||||
}
|
||||
|
||||
# Fallback for missing client files
|
||||
location @fallback {
|
||||
return 200 '<html><head><title>Etsy Finance Tracker</title></head><body><h1>🚀 Etsy Finance Tracker Starting Up...</h1><p>Client files are being loaded. Please refresh in a moment.</p><script>setTimeout(function(){location.reload()}, 5000);</script></body></html>';
|
||||
add_header Content-Type text/html;
|
||||
}
|
||||
|
||||
# Error pages
|
||||
error_page 404 /index.html;
|
||||
|
|
|
|||
121
validate-deployment.sh
Executable file
121
validate-deployment.sh
Executable file
|
|
@ -0,0 +1,121 @@
|
|||
#!/bin/bash
|
||||
|
||||
echo "🔍 Etsy Finance Tracker - Deployment Validation"
|
||||
echo "=================================================="
|
||||
|
||||
# Check if Docker is available
|
||||
echo "📦 Checking Docker availability..."
|
||||
if command -v docker &> /dev/null; then
|
||||
echo "✅ Docker is available"
|
||||
docker --version
|
||||
else
|
||||
echo "❌ Docker is not available or not in PATH"
|
||||
echo "💡 You may need to use Docker Desktop or another container interface"
|
||||
fi
|
||||
|
||||
# Check if Docker Compose is available
|
||||
echo ""
|
||||
echo "🐙 Checking Docker Compose availability..."
|
||||
if command -v docker-compose &> /dev/null; then
|
||||
echo "✅ docker-compose is available"
|
||||
docker-compose --version
|
||||
elif docker compose version &> /dev/null 2>&1; then
|
||||
echo "✅ docker compose (newer version) is available"
|
||||
docker compose version
|
||||
else
|
||||
echo "❌ Docker Compose is not available"
|
||||
echo "💡 You may need to use container interface deployment"
|
||||
fi
|
||||
|
||||
# Check if required files exist
|
||||
echo ""
|
||||
echo "📁 Checking required files..."
|
||||
files=(
|
||||
"Dockerfile"
|
||||
"docker-compose.deploy-local.yml"
|
||||
"docker-compose.deploy.yml"
|
||||
"docker-compose.simple.yml"
|
||||
"nginx.deploy.conf"
|
||||
"package.json"
|
||||
"client/package.json"
|
||||
"server/package.json"
|
||||
)
|
||||
|
||||
for file in "${files[@]}"; do
|
||||
if [ -f "$file" ]; then
|
||||
echo "✅ $file exists"
|
||||
else
|
||||
echo "❌ $file is missing"
|
||||
fi
|
||||
done
|
||||
|
||||
# Check for data directory
|
||||
echo ""
|
||||
echo "💾 Checking data persistence setup..."
|
||||
if [ -d "data" ]; then
|
||||
echo "✅ data directory exists"
|
||||
echo "📂 Contents:"
|
||||
ls -la data/
|
||||
else
|
||||
echo "⚠️ data directory doesn't exist, creating..."
|
||||
mkdir -p data/{mongo,uploads,logs,csv,pdf}
|
||||
echo "✅ data directory structure created"
|
||||
fi
|
||||
|
||||
# Check port availability
|
||||
echo ""
|
||||
echo "🔌 Checking port availability..."
|
||||
ports=(8080 8081)
|
||||
for port in "${ports[@]}"; do
|
||||
if lsof -i :$port &> /dev/null; then
|
||||
echo "⚠️ Port $port is in use"
|
||||
echo " Process using port $port:"
|
||||
lsof -i :$port
|
||||
else
|
||||
echo "✅ Port $port is available"
|
||||
fi
|
||||
done
|
||||
|
||||
# Check disk space
|
||||
echo ""
|
||||
echo "💽 Checking disk space..."
|
||||
available_space=$(df -h . | awk 'NR==2 {print $4}')
|
||||
echo "Available space: $available_space"
|
||||
if [[ $(df . | awk 'NR==2 {print $4}') -gt 2097152 ]]; then # 2GB in KB
|
||||
echo "✅ Sufficient disk space available"
|
||||
else
|
||||
echo "⚠️ Low disk space - may cause build failures"
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "🎯 Deployment Recommendations:"
|
||||
echo "================================"
|
||||
|
||||
# Docker available
|
||||
if command -v docker &> /dev/null || command -v docker-compose &> /dev/null; then
|
||||
echo "🚀 You can use command-line deployment:"
|
||||
if command -v docker-compose &> /dev/null; then
|
||||
echo " docker-compose -f docker-compose.deploy-local.yml up --build"
|
||||
else
|
||||
echo " docker compose -f docker-compose.deploy-local.yml up --build"
|
||||
fi
|
||||
else
|
||||
echo "🖥️ Use container interface deployment:"
|
||||
echo " 1. Open Docker Desktop, Portainer, or similar tool"
|
||||
echo " 2. Import docker-compose.deploy-local.yml"
|
||||
echo " 3. Deploy the stack"
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "📚 For detailed instructions, see:"
|
||||
echo " - DEPLOYMENT_GUIDE.md (comprehensive guide)"
|
||||
echo " - CONTAINER_INTERFACE_DEPLOYMENT.md (GUI deployment)"
|
||||
|
||||
echo ""
|
||||
echo "🌐 After successful deployment:"
|
||||
echo " - Frontend: http://localhost:8081"
|
||||
echo " - API: http://localhost:8081/api"
|
||||
echo " - Health Check: http://localhost:8081/api/health"
|
||||
|
||||
echo ""
|
||||
echo "✅ Validation complete!"
|
||||
Loading…
Reference in a new issue