mirror of
https://github.com/codeflash-ai/codeflash-internal.git
synced 2026-05-04 18:25:18 +00:00
- Introduced new API endpoints for downloading individual archived logs and all logs for a repository as a ZIP file. - Enhanced the CSV handling in the application to include new fields for auto-termination and analysis configuration. - Updated the frontend to support new features, including a modal for auto-termination settings and improved UI for log management. - Updated styles for modals and tables to enhance visual consistency and usability." - Added Dumpy security code in the FE with "123456" - added ability to customize and view the repo analysis by the LLM results - adding deployment folder for the whole deployment flow along with the dogs - fixed some permission errors and ssh access by www-data user while deployment - added s3 bucket saving logs based --------- Co-authored-by: Ashraf <ashraf@rapiddata.io> Co-authored-by: Mohamed Ashraf <mohamedashrraf222@gmail.com> Co-authored-by: Kevin Turcios <106575910+KRRT7@users.noreply.github.com> Co-authored-by: Sarthak Agarwal <sarthak.saga@gmail.com>
158 lines
7.7 KiB
Text
158 lines
7.7 KiB
Text
# Environment for EC2-based Optimizer Factory
|
|
# Copy this file to .env and fill in your actual values
|
|
|
|
|
|
|
|
# =============================================================================
|
|
# AWS CONFIGURATION
|
|
# =============================================================================
|
|
|
|
# AWS_REGION: AWS region where your EC2 instances will run
|
|
# Used by: server/app.py
|
|
# Example: us-east-1, us-west-2, eu-west-1
|
|
AWS_REGION=us-east-1
|
|
|
|
## EC2 INSTANCE SETTINGS
|
|
# AWS_KEY_NAME: Name of your EC2 Key Pair used for SSH
|
|
AWS_KEY_NAME=your_key_pair_name
|
|
# AWS_SECURITY_GROUP: Security group ID allowing SSH egress/ingress to instance
|
|
AWS_SECURITY_GROUP=sg-xxxxxxxx
|
|
# AWS_INSTANCE_TYPE: Instance type (example: c7i.2xlarge)
|
|
AWS_INSTANCE_TYPE=c7i.2xlarge
|
|
# AWS_AMI_ID: Ubuntu 22.04 AMI ID in your region
|
|
AWS_AMI_ID=ami-xxxxxxxx
|
|
# SSH_KEY_PATH: Local path to the private key for AWS_KEY_NAME
|
|
# IMPORTANT: This must be an absolute path or a path that resolves correctly
|
|
# Examples:
|
|
# - Linux/macOS: ~/.ssh/your_key_pair.pem or /home/user/.ssh/your_key_pair.pem
|
|
# - WSL: ~/.ssh/your_key_pair.pem (NOT /mnt/c/path/to/key.pem)
|
|
# - Windows: C:\Users\YourName\.ssh\your_key_pair.pem
|
|
#
|
|
# WSL USERS: You MUST copy your SSH key to the WSL filesystem and set correct permissions:
|
|
# 1. Copy key: cp /mnt/c/path/to/your/key.pem ~/.ssh/your_key_pair.pem
|
|
# 2. Set permissions: chmod 600 ~/.ssh/your_key_pair.pem
|
|
# 3. Use WSL path: SSH_KEY_PATH=~/.ssh/your_key_pair.pem
|
|
#
|
|
# The key file must have 600 permissions (readable only by owner) for SSH to work.
|
|
SSH_KEY_PATH=~/.ssh/your_key_pair.pem
|
|
|
|
## (Removed) AWS Batch configuration: no longer used
|
|
|
|
# =============================================================================
|
|
# SERVER CONFIGURATION
|
|
# =============================================================================
|
|
|
|
# PORT: Port number for the Flask web server
|
|
# Used by: server/app.py to start the web interface
|
|
# Default: 5000
|
|
PORT=5000
|
|
|
|
# CODEFLASH_API_KEY: API key for Codeflash optimization service
|
|
# Used by: server/app.py and scripts/run_optimization.sh
|
|
# Get this from: https://app.codeflash.ai
|
|
CODEFLASH_API_KEY=your_codeflash_api_key_here
|
|
|
|
# ANTHROPIC_API_KEY: API key for Anthropic Claude LLM analysis
|
|
# Used by: server/analyzer.py and scripts/llm_setup_helper.py for repository analysis
|
|
# Get this from: https://console.anthropic.com/ > API Keys
|
|
ANTHROPIC_API_KEY=your_anthropic_api_key_here
|
|
|
|
# ANTHROPIC_MODEL: Anthropic model to use for LLM analysis
|
|
# Used by: server/analyzer.py and scripts/run_optimization.sh
|
|
# Default: claude-3-5-haiku-20241022
|
|
ANTHROPIC_MODEL=claude-3-5-haiku-20241022
|
|
|
|
# GITHUB_TOKEN: GitHub Personal Access Token for repository access
|
|
# Used by: server/analyzer.py (for accessing private repos during analysis)
|
|
# scripts/run_optimization.sh (for GitHub operations during optimization via EC2)
|
|
# Get this from: GitHub Settings > Developer settings > Personal access tokens
|
|
# Required scopes: repo (for private repos), public_repo (for public repos)
|
|
GITHUB_TOKEN=your_github_token_here
|
|
|
|
# =============================================================================
|
|
# AWS CREDENTIALS CONFIGURATION
|
|
# =============================================================================
|
|
|
|
# AWS_ACCESS_KEY_ID: AWS Access Key ID for S3 and EC2 operations
|
|
# Used by: server/app.py, server/s3_utils.py for AWS API authentication
|
|
# Get this from: AWS Console > IAM > Users > Security credentials > Access keys
|
|
# Required permissions: S3 (read/write), EC2 (launch/terminate instances)
|
|
AWS_ACCESS_KEY_ID=your_access_key_here
|
|
|
|
# AWS_SECRET_ACCESS_KEY: AWS Secret Access Key for S3 and EC2 operations
|
|
# Used by: server/app.py, server/s3_utils.py for AWS API authentication
|
|
# Get this from: AWS Console > IAM > Users > Security credentials > Access keys
|
|
# Required permissions: S3 (read/write), EC2 (launch/terminate instances)
|
|
AWS_SECRET_ACCESS_KEY=your_secret_key_here
|
|
|
|
# AWS_DEFAULT_REGION: AWS region for S3 bucket and EC2 operations
|
|
# Used by: server/app.py, server/s3_utils.py for AWS service region
|
|
# Must match the region where your S3 bucket and EC2 instances are located
|
|
# Example: us-east-1, us-west-2, eu-west-1
|
|
AWS_DEFAULT_REGION=us-east-2
|
|
|
|
# AWS_S3_LOG_BUCKET: S3 bucket name for storing archived job logs
|
|
# Used by: server/s3_utils.py for log archiving and retrieval
|
|
# Must be a globally unique bucket name (S3 bucket names are globally unique)
|
|
# Example: my-company-optimization-logs, optimization-factory-logs-2025
|
|
AWS_S3_LOG_BUCKET=your-unique-log-bucket-name
|
|
|
|
# =============================================================================
|
|
# TROUBLESHOOTING SSH KEY ISSUES
|
|
# =============================================================================
|
|
#
|
|
# Common SSH key problems and solutions:
|
|
#
|
|
# 1. "Permissions are too open" error:
|
|
# - Problem: SSH key has incorrect permissions
|
|
# - Solution: Run `chmod 600 ~/.ssh/your_key_pair.pem`
|
|
# - WSL users: Ensure key is in WSL filesystem, not Windows filesystem
|
|
#
|
|
# 2. "No such file or directory" error:
|
|
# - Problem: SSH_KEY_PATH points to non-existent file
|
|
# - Solution: Verify the path exists with `ls -la ~/.ssh/your_key_pair.pem`
|
|
# - Check that the path in .env matches the actual file location
|
|
#
|
|
# 3. "Permission denied" error:
|
|
# - Problem: SSH key permissions are too restrictive or incorrect
|
|
# - Solution: Run `chmod 600 ~/.ssh/your_key_pair.pem` (not 700 or 644)
|
|
# - Verify with `ls -la ~/.ssh/your_key_pair.pem` (should show -rw-------)
|
|
#
|
|
# 4. WSL-specific issues:
|
|
# - Problem: Using Windows path (/mnt/c/...) causes permission issues
|
|
# - Solution: Copy key to WSL filesystem: `cp /mnt/c/path/to/key.pem ~/.ssh/`
|
|
# - Then set permissions: `chmod 600 ~/.ssh/your_key_pair.pem`
|
|
# - Update .env to use WSL path: `SSH_KEY_PATH=~/.ssh/your_key_pair.pem`
|
|
#
|
|
# 5. Testing SSH connectivity:
|
|
# - Test manually: `ssh -i ~/.ssh/your_key_pair.pem ubuntu@YOUR_EC2_IP`
|
|
# - If this works, the issue is in the application configuration
|
|
# - If this fails, the issue is with the SSH key or EC2 instance setup
|
|
|
|
# =============================================================================
|
|
# REMOTE JOB CONFIGURATION (Set by server/app.py when launching jobs)
|
|
# =============================================================================
|
|
# The following variables are injected remotely on EC2 per job:
|
|
|
|
# GITHUB_REPO_URL: Repository URL to optimize (set by server/app.py)
|
|
# MODULE_ROOT: Module root directory (set by server/app.py)
|
|
# TESTS_ROOT: Tests root directory (set by server/app.py)
|
|
# LLM_MODULE_ROOT: LLM-suggested module root (from analyzer results)
|
|
# LLM_TESTS_ROOT: LLM-suggested tests root (from analyzer results)
|
|
# LLM_PYTEST_CMD: LLM-suggested pytest command (from analyzer results)
|
|
# LLM_FORMATTER_CMDS: LLM-suggested formatter commands (from analyzer results)
|
|
# LLM_PIP_PACKAGES: LLM-suggested Python packages (from analyzer results)
|
|
# WORK_DIR: Working directory on EC2 (defaults to /home/ubuntu/work)
|
|
# VENV_PATH: Virtual environment path (set by entrypoint.sh)
|
|
# PRE_INSTALL_CMDS: Pre-installation commands (allowlisted by analyzer)
|
|
# INSTALL_CMDS: Installation commands (allowlisted by analyzer)
|
|
# POST_INSTALL_CMDS: Post-installation commands (allowlisted by analyzer)
|
|
# SYSTEM_PACKAGES: System packages to install (allowlisted by analyzer)
|
|
# TEST_LOG_DIR: Test log directory (defaults to /home/ubuntu/app/logs)
|
|
# TEST_LOG_FILE: Test log file path (set by run_optimization.sh)
|
|
# EXIT_FILE: Exit code file path (set by run_optimization.sh)
|
|
# STAGE_FILE: Stage tracking file path (set by run_optimization.sh)
|
|
# CF_TARGET_FILE: Codeflash target file (for single-file optimization)
|
|
# CF_TARGET_FUNCTION: Codeflash target function (for single-function optimization)
|
|
# LLM_SETUP_MAX_STEPS: Maximum LLM setup steps (defaults to 10)
|
|
# LLM_SETUP_MAX_ROUNDS: Maximum LLM setup rounds (defaults to 2)
|