This directory contains utility scripts for FlexGate development, testing, and deployment.
scripts/
├── deployment/ # Deployment and repository management
├── testing/ # Testing automation scripts
├── cleanup-branches.sh # Git branch cleanup
└── setup-database-native.sh # PostgreSQL setup (Homebrew)
Sets up PostgreSQL database using Homebrew (native installation).
Usage:
./scripts/setup-database-native.shFeatures:
- Installs PostgreSQL@16 via Homebrew
- Creates
flexgatedatabase - Creates database user
- Runs migrations
- Seeds initial data
- Generates JWT secret
- Updates .env file
Requirements:
- macOS with Homebrew
- No Docker required
Comprehensive test execution script for running all test suites.
Usage:
./scripts/testing/test-execution.shFeatures:
- Runs backend tests
- Runs frontend tests
- Runs E2E tests
- Generates test reports
Tests the Routes API endpoints.
Usage:
./scripts/testing/test-routes-api.shFeatures:
- Tests all 6 Routes API endpoints
- Validates CRUD operations
- Checks data persistence
Sets up the separate test repository for E2E tests.
Usage:
./scripts/testing/setup-test-repo.shFeatures:
- Creates
flexgate-testsrepository - Copies test files
- Installs dependencies
- Configures Playwright
Creates multiple FlexGate repositories for microservices architecture.
Usage:
./scripts/deployment/create-flexgate-repos.shFeatures:
- Creates multiple Git repositories
- Sets up repository structure
- Initializes with README files
Repositories Created:
- flexgate-proxy
- flexgate-admin-ui
- flexgate-agent
- flexgate-control-plane
- flexgate-llm-gateway
- (and more...)
Initializes all FlexGate repositories with common setup.
Usage:
./scripts/deployment/init-all-repos.shFeatures:
- Initializes Git
- Sets up .gitignore
- Creates basic structure
- Adds common dependencies
Cleans up merged and stale Git branches.
Usage:
./scripts/cleanup-branches.shFeatures:
- Lists merged branches
- Deletes merged feature branches
- Optionally deletes remote branches
- Interactive mode for safety
Options:
# Dry run (shows what would be deleted)
./scripts/cleanup-branches.sh --dry-run
# Delete remote branches too
./scripts/cleanup-branches.sh --remote
# Force delete without confirmation
./scripts/cleanup-branches.sh --forceLocated in launch/ directory:
day-1-2-checklist.sh- Day 1-2 launch preparation checklist
Located in benchmarks/ directory:
run.sh- Performance benchmarking script
Located in test-files-to-copy/ directory:
copy-to-test-repo.sh- Copies test files to test repository
chmod +x scripts/your-script.sh#!/bin/bash
set -e # Exit on error
echo "🚀 Script Name"
echo "Description of what this script does"
echo ""
# Your script logic hereif ! command -v some_command &> /dev/null; then
echo "❌ Error: some_command not found"
exit 1
fiGREEN='\033[0;32m'
RED='\033[0;31m'
YELLOW='\033[1;33m'
NC='\033[0m' # No Color
echo -e "${GREEN}✅ Success${NC}"
echo -e "${RED}❌ Error${NC}"
echo -e "${YELLOW}⚠️ Warning${NC}"-
Choose the right directory:
deployment/- Deployment and infrastructuretesting/- Testing and QA- Root
scripts/- General utilities
-
Name your script descriptively:
- Use kebab-case:
setup-new-feature.sh - Be specific:
migrate-postgres-to-v15.sh
- Use kebab-case:
-
Add documentation:
- Update this README
- Add comments in the script
- Include usage examples
-
Test your script:
- Test on clean environment
- Handle errors gracefully
- Provide helpful error messages
-
Make it executable:
chmod +x scripts/your-new-script.sh
| Task | Script |
|---|---|
| Setup database (native) | ./scripts/setup-database-native.sh |
| Setup database (Docker) | ./scripts/setup-database.sh |
| Run all tests | ./scripts/testing/test-execution.sh |
| Test Routes API | ./scripts/testing/test-routes-api.sh |
| Setup test repo | ./scripts/testing/setup-test-repo.sh |
| Create repositories | ./scripts/deployment/create-flexgate-repos.sh |
| Initialize repos | ./scripts/deployment/init-all-repos.sh |
| Cleanup branches | ./scripts/cleanup-branches.sh |
| Run benchmarks | ./benchmarks/run.sh |
| Launch checklist | ./launch/day-1-2-checklist.sh |
chmod +x scripts/script-name.sh# Use bash explicitly
bash scripts/script-name.sh# Run from project root
cd /path/to/flexgate-proxy
./scripts/script-name.sh# Check PostgreSQL is running
brew services list | grep postgresql
# Start PostgreSQL
brew services start postgresql@16