Makefile 2.4 KB

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