This comprehensive reference covers all automation scripts available in the HostingCo system, providing detailed usage instructions, examples, and best practices.
The HostingCo project includes a complete suite of automation scripts that handle every aspect of the development lifecycle, from initial setup to deployment and maintenance.
| Category | Scripts | Purpose |
|---|---|---|
| Database | db-migrate.sh, db-seed.sh, db-reset.sh |
Database operations and management |
| Development | dev.sh, dev-backend.sh, dev-frontend.sh |
Development server management |
| Build & Deploy | build.sh, deploy.sh |
Application building and deployment |
| Testing | test.sh, test-watch.sh, test-coverage.sh |
Test execution and coverage analysis |
| Docker | docker-build.sh, docker-up.sh, docker-down.sh |
Docker container management |
| Maintenance | clean.sh, setup.sh, health-check.sh |
System maintenance and monitoring |
Run database migrations for specific environments with safety checks and rollback capabilities.
./scripts/db-migrate.sh [environment]
development (default)stagingproduction# Migrate development database
./scripts/db-migrate.sh development
# Migrate production database
./scripts/db-migrate.sh production
Seed database with test data for development and testing environments.
./scripts/db-seed.sh [environment] [seed-type]
all (default) - All seed datausers - User accounts and roleshosting - Hosting plans and serversbilling - Billing and invoice datasupport - Support tickets and categories# Seed all test data
./scripts/db-seed.sh development
# Seed only users
./scripts/db-seed.sh development users
# Seed hosting data for staging
./scripts/db-seed.sh staging hosting
Reset database to clean state with automatic backup creation.
./scripts/db-reset.sh [environment] [--force]
--force - Skip confirmation prompts# Reset development database
./scripts/db-reset.sh development
# Force reset without confirmation
./scripts/db-reset.sh development --force
Unified development server startup with intelligent port management and service monitoring.
./scripts/dev.sh [options]
--backend-only - Start only backend server--frontend-only - Start only frontend server--no-logs - Suppress detailed logs--port-backend PORT - Set backend port (default: 3003)--port-frontend PORT - Set frontend port (default: 3000)# Start both servers
./scripts/dev.sh
# Start with custom ports
./scripts/dev.sh --port-backend 3004 --port-frontend 3001
# Start only backend with debug mode
./scripts/dev.sh --backend-only --port-backend 3004
Backend development server with advanced debugging and configuration options.
./scripts/dev-backend.sh [options]
--port PORT - Set backend port (default: 3003)--no-logs - Suppress detailed logs--debug - Enable debug mode--no-watch - Disable file watching# Start backend with default settings
./scripts/dev-backend.sh
# Start with debug and custom port
./scripts/dev-backend.sh --debug --port 3004
Frontend development server with React/Vite optimization and browser integration.
./scripts/dev-frontend.sh [options]
--port PORT - Set frontend port (default: 3000)--host HOST - Set frontend host (default: localhost)--no-logs - Suppress detailed logs--open - Open browser automatically# Start frontend with browser
./scripts/dev-frontend.sh --open
# Start on different host
./scripts/dev-frontend.sh --host 0.0.0.0
Comprehensive build system with multi-environment support and detailed reporting.
./scripts/build.sh [environment] [options]
development - Development buildstaging - Staging buildproduction (default) - Production build--skip-tests - Skip running tests--skip-lint - Skip running linters--verbose - Show detailed build output--analyze - Analyze bundle size--report - Generate build report# Build for production
./scripts/build.sh production
# Build with analysis and verbose output
./scripts/build.sh production --analyze --verbose
# Build without tests
./scripts/build.sh staging --skip-tests
Safe deployment system with backup creation, health checks, and rollback capabilities.
./scripts/deploy.sh [environment] [options]
staging - Staging deploymentproduction - Production deployment--force - Force deployment without confirmation--dry-run - Simulate deployment without changes--skip-backup - Skip creating backup--skip-health-check - Skip post-deployment health check# Deploy to staging
./scripts/deploy.sh staging
# Deploy to production with force
./scripts/deploy.sh production --force
# Dry run deployment
./scripts/deploy.sh staging --dry-run
Comprehensive test runner with coverage analysis and reporting capabilities.
./scripts/test.sh [scope] [options]
all (default) - All test suitesbackend - Backend tests onlyfrontend - Frontend tests onlyshared - Shared package testsintegration - Integration testse2e - End-to-end tests--watch - Run tests in watch mode--coverage - Generate coverage report--verbose - Show detailed test output--report - Generate test report--fix - Auto-fix linting issues# Run all tests with coverage
./scripts/test.sh all --coverage --report
# Run only backend tests
./scripts/test.sh backend
# Run tests with auto-fix
./scripts/test.sh all --fix
Watch mode for continuous testing during development.
./scripts/test-watch.sh [scope]
all (default) - All test suitesbackend - Backend tests onlyfrontend - Frontend tests onlyshared - Shared package tests# Watch all tests
./scripts/test-watch.sh all
# Watch only backend tests
./scripts/test-watch.sh backend
Advanced coverage analysis with threshold checking and historical comparison.
./scripts/test-coverage.sh [scope] [options]
--report - Generate detailed coverage report--threshold NUM - Set coverage threshold (default: 80)--compare - Compare with previous coverage--html - Generate HTML coverage reports# Generate coverage with comparison
./scripts/test-coverage.sh all --compare --html
# Set custom threshold
./scripts/test-coverage.sh all --threshold 90
Docker image building with registry support and optimization.
./scripts/docker-build.sh [environment] [options]
--no-cache - Build without using cache--push - Push images to registry after build--tag TAG - Use custom tag instead of timestamp--verbose - Show detailed build output# Build for production
./scripts/docker-build.sh production
# Build and push
./scripts/docker-build.sh production --push
# Build with custom tag
./scripts/docker-build.sh production --tag v1.0.0
Docker environment management with service orchestration.
./scripts/docker-up.sh [environment] [options]
--build - Build images before starting--no-pull - Don't pull latest images--attach - Don't run in detached mode--logs - Show logs after startup--scale SERVICE=N - Scale specific service# Start development environment
./scripts/docker-up.sh development
# Start with build and logs
./scripts/docker-up.sh development --build --logs
# Scale backend service
./scripts/docker-up.sh production --scale backend=3
Safe Docker shutdown with cleanup and resource management.
./scripts/docker-down.sh [options]
--volumes - Remove named volumes--remove-orphans - Remove orphaned containers--timeout SECONDS - Set shutdown timeout (default: 30)--force - Force shutdown without confirmation# Stop services
./scripts/docker-down.sh
# Stop with volume cleanup
./scripts/docker-down.sh --volumes --remove-orphans
# Force shutdown
./scripts/docker-down.sh --force --timeout 10
Multi-level cleanup system for build artifacts, cache, and temporary files.
./scripts/clean.sh [options]
--deep - Deep clean including build artifacts--docker - Clean Docker resources--node-modules - Remove node_modules directories--logs - Remove log files--cache - Remove cache directories--all - Clean everything# Basic clean
./scripts/clean.sh
# Deep clean including node_modules
./scripts/clean.sh --deep --node-modules
# Clean everything
./scripts/clean.sh --all
Complete project initialization with environment configuration and dependency management.
./scripts/setup.sh [environment] [options]
development (default)stagingproduction--skip-deps - Skip dependency installation--skip-db - Skip database setup--skip-env - Skip environment file creation--docker - Setup for Docker environment--verbose - Show detailed output# Complete development setup
./scripts/setup.sh development
# Docker-based setup
./scripts/setup.sh production --docker
# Setup without dependencies
./scripts/setup.sh development --skip-deps
Application health monitoring with multiple output formats and watch capabilities.
./scripts/health-check.sh [options]
--detailed - Show detailed health information--watch - Run health checks continuously--backend-url URL - Backend URL (default: http://localhost:3003)--frontend-url URL - Frontend URL (default: http://localhost:3000)--timeout SECONDS - Request timeout (default: 10)--output FORMAT - Output format: table, json, csv--interval SECONDS - Check interval for watch mode (default: 30)# Basic health check
./scripts/health-check.sh
# Detailed health check
./scripts/health-check.sh --detailed
# Watch mode with JSON output
./scripts/health-check.sh --watch --output json
# Custom endpoints
./scripts/health-check.sh --backend-url http://api.example.com --timeout 5
export DATABASE_URL="postgresql://user:password@localhost:5432/hostingco"
export REDIS_URL="redis://localhost:6379"
export DOCKER_REGISTRY="your-registry.com"
export COMPOSE_PROJECT_NAME="hostingco"
export NODE_ENV="production"
export LOG_LEVEL="info"
export JWT_SECRET="your-super-secret-jwt-key"
.env.development - Development environment.env.staging - Staging environment.env.production - Production environmentdocker-compose.yml - Base Docker configurationdocker-compose.development.yml - Development overridesdocker-compose.staging.yml - Staging overridesdocker-compose.production.yml - Production overridesDestructive operations require confirmation:
# Table format (default)
./scripts/health-check.sh --output table
# JSON format for automation
./scripts/health-check.sh --output json
# CSV format for reporting
./scripts/health-check.sh --output csv
name: Build and Deploy
on: [push, pull_request]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup project
run: ./scripts/setup.sh development --skip-env
- name: Run tests
run: ./scripts/test.sh all --coverage --report
- name: Build project
run: ./scripts/build.sh production
- name: Health check
run: ./scripts/health-check.sh --detailed
deploy:
needs: test
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
steps:
- uses: actions/checkout@v3
- name: Deploy to staging
run: ./scripts/deploy.sh staging
stages:
- test
- build
- deploy
test:
stage: test
script:
- ./scripts/setup.sh development
- ./scripts/test.sh all --coverage
coverage: '/Lines: \d+\.\d+%/'
build:
stage: build
script:
- ./scripts/build.sh production
artifacts:
paths:
- backend/dist/
- frontend/dist/
deploy_staging:
stage: deploy
script:
- ./scripts/deploy.sh staging
environment:
name: staging
only:
- main
# Make scripts executable
chmod +x scripts/*.sh
# Check what's using ports
lsof -i :3000
lsof -i :3003
# Use different ports
./scripts/dev.sh --port-backend 3004 --port-frontend 3001
# Check database connectivity
./scripts/health-check.sh --detailed
# Reset database
./scripts/db-reset.sh development --force
# Clean Docker resources
./scripts/clean.sh --docker
# Rebuild images
./scripts/docker-build.sh production --no-cache
Enable verbose output for debugging:
# Verbose build
./scripts/build.sh production --verbose
# Verbose tests
./scripts/test.sh all --verbose
# Detailed health check
./scripts/health-check.sh --detailed --watch
--help flag for options./scripts/setup.sh for new environments./scripts/dev.sh for daily development./scripts/test.sh before commits./scripts/build.sh before deployment./scripts/deploy.sh for safe deploymentsFor script-specific issues:
./scripts/script-name.sh --help./scripts/script-name.sh --verboseFor project-specific issues, refer to the main project documentation or contact the development team.