This directory contains shell scripts for automating common development operations with Docker.
Starts the complete development environment using Docker Compose.
./scripts/dev-start.shFeatures:
- Builds and starts all services (database, backend, frontend)
- Uses development overrides for hot-reloading
- Checks service health and provides status feedback
- Shows service URLs and useful commands
Stops the development environment with optional cleanup.
./scripts/dev-stop.sh [OPTIONS]Options:
--cleanup: Remove containers after stopping--volumes: Remove volumes (WARNING: Deletes database data)--help: Show help message
Examples:
./scripts/dev-stop.sh # Stop services only
./scripts/dev-stop.sh --cleanup # Stop and remove containers
./scripts/dev-stop.sh --cleanup --volumes # Stop, remove containers and volumesRuns Alembic database migrations through Docker.
./scripts/migrate.shFeatures:
- Checks database connectivity before running migrations
- Applies all pending migrations
- Shows current migration status
- Provides helpful error messages and troubleshooting tips
Creates new Alembic migration files through Docker.
./scripts/migrate-create.sh "Migration description"Examples:
./scripts/migrate-create.sh "Add user table"
./scripts/migrate-create.sh "Add recipe and ingredient models"
./scripts/migrate-create.sh "Add indexes for recipe search"Features:
- Auto-generates migration files based on model changes
- Validates database connectivity
- Shows generated migration files
- Provides next steps guidance
Builds Docker images for all or specific services.
./scripts/build.sh [OPTIONS]Options:
--force: Force rebuild of all images--no-cache: Build without using Docker cache--service SERVICE: Build specific service (backend, frontend)--help: Show help message
Examples:
./scripts/build.sh # Build all services
./scripts/build.sh --force # Force rebuild all services
./scripts/build.sh --service backend # Build only backend service
./scripts/build.sh --no-cache # Build without cacheRuns backend tests with various options and configurations.
./scripts/test.sh [OPTIONS]Options:
-t, --type TYPE: Test type (all, unit, integration, auth, models, api)-v, --verbose: Run tests in verbose mode-c, --coverage: Run tests with coverage report-h, --help: Show help message
Examples:
./scripts/test.sh # Run all tests
./scripts/test.sh -t unit # Run only unit tests
./scripts/test.sh -t api -v # Run API tests in verbose mode
./scripts/test.sh -c # Run all tests with coverageCleans up Docker resources (containers, images, volumes, networks).
./scripts/cleanup.sh [OPTIONS]Options:
--containers: Remove stopped containers--images: Remove dangling and unused images--volumes: Remove unused volumes (WARNING: Data loss)--networks: Remove unused networks--all: Clean up everything--force: Skip confirmation prompts--help: Show help message
Examples:
./scripts/cleanup.sh # Basic cleanup (containers + images)
./scripts/cleanup.sh --all # Clean up everything
./scripts/cleanup.sh --all --force # Clean up everything without prompts
./scripts/cleanup.sh --volumes # Remove volumes (with confirmation)Deploys the backend to Google Cloud Run.
./scripts/deploy-cloudrun.sh [OPTIONS]Options:
--project PROJECT: GCP project ID (required if not set via gcloud config)--region REGION: Cloud Run region (default: us-central1)--dry-run: Show what would be deployed without deploying--help: Show help message
Examples:
./scripts/deploy-cloudrun.sh --project my-cooking-app
./scripts/deploy-cloudrun.sh --project my-cooking-app --region us-west1
./scripts/deploy-cloudrun.sh --dry-run # Preview deploymentOne-time GCP project setup for Cloud Run deployment.
./scripts/setup-gcp.sh --project PROJECT_IDFeatures:
- Enables required APIs (Cloud Run, Cloud Build, Container Registry)
- Configures gcloud defaults
- Provides next steps guidance
IMPORTANT: Before running the application in production, you must set a secure JWT secret key.
# Option 1: Use the provided script
python backend/generate_secret_key.py
# Option 2: Use Python directly
python -c "import secrets; print(secrets.token_hex(32))"- Copy the generated key
- Create a
.envfile in the backend directory (if it doesn't exist) - Add the secret key:
SECRET_KEY=your_generated_256_bit_hex_key_here- Never use the default secret key in production
- Keep the same secret key across app restarts to maintain user sessions
- Never commit the secret key to version control
- Only change the secret key when you want to invalidate all existing tokens
- Consider using a secrets management service in production
# First time setup
./scripts/build.sh
./scripts/dev-start.sh
./scripts/migrate.sh
# Daily development
./scripts/dev-start.sh# Create a new migration
./scripts/migrate-create.sh "Add new feature"
# Apply migrations
./scripts/migrate.sh# Regular cleanup
./scripts/cleanup.sh
# Deep cleanup (removes all data)
./scripts/cleanup.sh --all
# Fresh start
./scripts/dev-stop.sh --cleanup --volumes
./scripts/cleanup.sh --all
./scripts/build.sh --force
./scripts/dev-start.sh- Docker and Docker Compose installed
- All scripts must be run from the project root directory
- Backend service must be running for migration operations
- Check Docker is running:
docker info - Check for port conflicts:
lsof -i :3000,8000,5432 - Clean up and rebuild:
./scripts/cleanup.sh --all && ./scripts/build.sh --force
- Ensure database service is healthy:
docker-compose ps database - Check database logs:
docker-compose logs database - Restart database:
docker-compose restart database
- Check backend service is running:
docker-compose ps backend - Check backend logs:
docker-compose logs backend - Verify database connectivity:
docker-compose exec database pg_isready -U recipe_user -d recipe_db
For more help, check the individual script help messages using the --help option.