Makefile 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. # Makefile for OpenDevin project
  2. # Variables
  3. DOCKER_IMAGE = ghcr.io/opendevin/sandbox
  4. BACKEND_PORT = 3000
  5. FRONTEND_PORT = 3001
  6. DEFAULT_WORKSPACE_DIR = "./workspace"
  7. CONFIG_FILE = config.toml
  8. # Build
  9. build:
  10. @echo "Building project..."
  11. @echo "Pulling Docker image..."
  12. @docker pull $(DOCKER_IMAGE)
  13. @echo "Installing Python dependencies..."
  14. @pip install pipenv
  15. @pipenv install -v
  16. @echo "Setting up frontend environment..."
  17. @cd frontend && npm install
  18. # Start backend
  19. start-backend:
  20. @echo "Starting backend..."
  21. @pipenv run uvicorn opendevin.server.listen:app --port $(BACKEND_PORT)
  22. # Start frontend
  23. start-frontend:
  24. @echo "Starting frontend..."
  25. @cd frontend && npm run start -- --port $(FRONTEND_PORT)
  26. # Run the app
  27. run:
  28. @echo "Running the app..."
  29. @mkdir -p logs
  30. @rm -f logs/pipe
  31. @mkfifo logs/pipe
  32. @cat logs/pipe | (make start-backend) &
  33. @echo 'test' | tee logs/pipe | (make start-frontend)
  34. # Setup config.toml
  35. setup-config:
  36. @echo "Setting up config.toml..."
  37. @read -p "Enter your LLM API key: " llm_api_key; \
  38. echo "LLM_API_KEY=\"$$llm_api_key\"" >> $(CONFIG_FILE).tmp
  39. @read -p "Enter your LLM Model name [default: gpt-4-0125-preview]: " llm_model; \
  40. echo "LLM_MODEL=\"$$llm_model\"" >> $(CONFIG_FILE).tmp
  41. @read -p "Enter your workspace directory [default: $(DEFAULT_WORKSPACE_DIR)]: " workspace_dir; \
  42. workspace_dir=$${workspace_dir:-$(DEFAULT_WORKSPACE_DIR)}; \
  43. echo "WORKSPACE_DIR=\"$$workspace_dir\"" >> $(CONFIG_FILE).tmp
  44. @mv $(CONFIG_FILE).tmp $(CONFIG_FILE)
  45. # Help
  46. help:
  47. @echo "Usage: make [target]"
  48. @echo "Targets:"
  49. @echo " build - Build project, including environment setup and dependencies."
  50. @echo " start-backend - Start the backend server for the OpenDevin project."
  51. @echo " start-frontend - Start the frontend server for the OpenDevin project."
  52. @echo " run - Run the OpenDevin application, starting both backend and frontend servers."
  53. @echo " Backend Log file will be stored in the 'logs' directory."
  54. @echo " setup-config - Setup the configuration for OpenDevin by providing LLM API key, LLM Model name, and workspace directory."
  55. @echo " help - Display this help message, providing information on available targets."
  56. # Phony targets
  57. .PHONY: install start-backend start-frontend run setup-config help