Features: - Multi-stage Dockerfile for optimized production builds - Docker Compose configuration with health checks - Health check endpoint for container monitoring - Production environment configuration template - Comprehensive deployment guide for Mac Mini - Docker ignore file for efficient build context - Security: Non-root user, proper signal handling - Persistence: Data directory volume mounting - Performance: Alpine Linux base, optimized layers - Future-ready: MongoDB service configuration (commented) Deployment: - Simple 'docker-compose up' deployment - Automatic health monitoring and restart policies - Persistent data storage with volume mounts - Port configuration and environment customization - Complete troubleshooting and management guide
3.9 KiB
3.9 KiB
Docker Deployment Guide for Mac Mini
This guide will help you deploy the Etsy Finance Tracker on your Mac Mini using Docker.
Prerequisites
-
Install Docker Desktop on your Mac Mini:
# Option 1: Download from Docker website # Go to https://docs.docker.com/desktop/mac/install/ # Option 2: Install with Homebrew (if available) brew install --cask docker -
Install Git (if not already installed):
brew install git
Deployment Steps
1. Clone the Repository
git clone https://github.com/dlawler489/etsy-finance-tracker.git
cd etsy-finance-tracker
2. Prepare Your Data
# Create the data directory structure
mkdir -p data/{csv,pdf,spreadsheets}
# Copy your business files to the data directory
# Example:
# cp ~/Documents/BusinessData/*.csv data/csv/
# cp ~/Documents/BusinessData/*.pdf data/pdf/
# cp ~/Documents/BusinessData/*.xlsx data/spreadsheets/
3. Configure Environment (Optional)
# Copy the production environment template
cp server/.env.production server/.env
# Edit the environment file if needed
nano server/.env
4. Build and Run with Docker Compose
# Build and start the application
docker-compose up --build -d
# View logs
docker-compose logs -f
# Check status
docker-compose ps
5. Access Your Application
- Web Interface: http://localhost:3000
- API Health Check: http://localhost:3000/health
Management Commands
Start/Stop the Application
# Start
docker-compose up -d
# Stop
docker-compose down
# Restart
docker-compose restart
View Logs
# All services
docker-compose logs -f
# Specific service
docker-compose logs -f etsy-tracker
Update the Application
# Pull latest code
git pull origin main
# Rebuild and restart
docker-compose down
docker-compose up --build -d
Backup Your Data
# Your business data in the data/ directory is automatically persisted
# To backup:
tar -czf etsy-tracker-backup-$(date +%Y%m%d).tar.gz data/
Troubleshooting
Check Application Health
# Test the health endpoint
curl http://localhost:3000/health
# Check container logs
docker-compose logs etsy-tracker
Common Issues
-
Port Already in Use:
# Change port in docker-compose.yml ports: - "3001:3000" # Change 3000 to 3001 -
Permission Issues:
# Fix data directory permissions sudo chown -R $(whoami):$(whoami) data/ -
Memory Issues:
# Add memory limits to docker-compose.yml deploy: resources: limits: memory: 512M
File Structure
Your deployment will look like this:
etsy-finance-tracker/
├── data/ # Your business data (persistent)
│ ├── csv/ # CSV files
│ ├── pdf/ # PDF documents
│ └── spreadsheets/ # Excel files
├── docker-compose.yml # Container orchestration
├── Dockerfile # Container configuration
└── ... (application code)
Security Notes
- The
data/directory contains your sensitive business files - This directory is mounted as a volume and persists between container restarts
- Never commit the
data/directory to git - Change default passwords in
.envfile for production use
Performance Optimization
For better performance on Mac Mini:
-
Allocate more resources to Docker Desktop:
- Open Docker Desktop preferences
- Go to Resources → Advanced
- Increase Memory to at least 4GB
- Increase CPU to at least 2 cores
-
Enable BuildKit for faster builds:
export DOCKER_BUILDKIT=1
Support
If you encounter issues:
- Check the logs:
docker-compose logs - Verify Docker is running:
docker version - Check port availability:
lsof -i :3000 - Review the troubleshooting section above