Makefile Commands
Quick reference for all available Make commands in SaleSpider.
Overview
The Makefile provides convenient shortcuts for common operations. All commands should be run from the project root directory.
Quick Reference
bash
make help # Show all available commands
make setup # Initial project setup
make deploy # Full deployment
make start # Start services
make stop # Stop services
make restart # Restart services
make status # Check service status
make logs # View logs
make backup # Create database backup
make restore # Restore databaseSetup Commands
Initial Setup
bash
# Complete initial setup
make setupSets up:
- File permissions
- Environment configuration
- SSL certificates
- Docker volumes
Permissions
bash
# Fix script permissions
make permsMakes all scripts executable.
Deployment Commands
Deploy
bash
# Full deployment
make deployPerforms:
- System checks
- SSL certificate generation
- Volume creation
- Service startup
- Database migrations
- Data seeding
Update
bash
# Update deployment
make updateUpdates:
- Pull latest code
- Rebuild containers
- Run migrations
- Restart services
Service Management
Start Services
bash
# Start all services
make start
# Or using Docker Compose
make docker-upStop Services
bash
# Stop all services
make stop
# Or using Docker Compose
make docker-downRestart Services
bash
# Restart all services
make restart
# Restart specific service
docker-compose restart appService Status
bash
# Check service status
make status
# Detailed status
docker-compose psLogging
View Logs
bash
# All services
make logs
# Specific service
make logs SERVICE=app
make logs SERVICE=postgres
make logs SERVICE=proxyFollow Logs
bash
# Follow logs in real-time
docker-compose logs -f
# Follow specific service
docker-compose logs -f appBackup & Restore
Create Backup
bash
# Create full backup
make backup
# View backup info
make backup-infoRestore Backup
bash
# Restore latest backup
make restore
# Point-in-time restore
make restore-pitr TIME="2024-11-20 14:30:00"Database Operations
Database Shell
bash
# PostgreSQL shell
make db-shell
# Or directly
docker-compose exec postgres psql -U postgres -d salespiderRun Migrations
bash
# Run database migrations
docker-compose exec app npx prisma migrate deploySeed Database
bash
# Seed with sample data
docker-compose exec app npm run seedDocker Commands
Build
bash
# Build containers
make docker-build
# Rebuild without cache
docker-compose build --no-cacheClean
bash
# Clean Docker resources
make docker-clean
# Remove volumes
docker-compose down -vLogs
bash
# View Docker logs
make docker-logs
# Follow logs
make docker-logs-followApplication Commands
Application Shell
bash
# Access application container
make app-shell
# Or directly
docker-compose exec app shRun Commands
bash
# Run npm commands
docker-compose exec app npm run <command>
# Examples
docker-compose exec app npm test
docker-compose exec app npm run lintHealth Checks
System Health
bash
# Check system health
make health
# Check specific service
docker-compose exec app curl http://localhost:3000/api/healthService Status
bash
# Check all services
make status
# Check specific service
docker-compose ps appMaintenance
Clean Up
bash
# Clean Docker system
docker system prune -a
# Clean volumes
docker volume prune
# Clean images
docker image prune -aUpdate Dependencies
bash
# Update npm packages
docker-compose exec app npm update
# Update Docker images
docker-compose pullDevelopment
Development Mode
bash
# Start in development mode
docker-compose up
# With logs
docker-compose up --buildRun Tests
bash
# Run tests
docker-compose exec app npm test
# Run with coverage
docker-compose exec app npm run test:coverageTroubleshooting
Reset Everything
bash
# Stop and remove everything
docker-compose down -v
# Rebuild and restart
make deployCheck Logs
bash
# Check for errors
make logs | grep -i error
# Check specific service
make logs SERVICE=app | grep -i errorVerify Configuration
bash
# Show Docker Compose config
docker-compose config
# Check environment variables
docker-compose exec app envCustom Commands
Add Custom Commands
Edit Makefile to add custom commands:
makefile
.PHONY: my-command
my-command:
@echo "Running my custom command"
docker-compose exec app npm run my-scriptUsage:
bash
make my-commandEnvironment-Specific
Development
bash
# Development setup
make setup
make deployProduction
bash
# Production deployment
NODE_ENV=production make deployTesting
bash
# Run tests
make test
# Run specific tests
docker-compose exec app npm test -- --grep "pattern"Common Workflows
Daily Operations
bash
# Check status
make status
# View logs
make logs
# Create backup
make backupDeployment
bash
# Initial deployment
make setup
make deploy
# Update deployment
git pull
make updateTroubleshooting
bash
# Check logs
make logs
# Restart services
make restart
# Check status
make statusTips
Command Aliases
Add to your shell profile:
bash
alias ss-start='make start'
alias ss-stop='make stop'
alias ss-logs='make logs'
alias ss-backup='make backup'Quick Access
bash
# Jump to project directory
cd ~/SaleSpider
# Run command
make status