Makefile 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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. @rm logs/pipe
  30. @mkfifo logs/pipe
  31. @cat logs/pipe | (make start-backend) &
  32. @echo 'test' | tee logs/pipe | (make start-frontend)
  33. # Setup config.toml
  34. setup-config:
  35. @echo "Setting up config.toml..."
  36. @read -p "Enter your LLM API key: " llm_api_key; \
  37. echo "LLM_API_KEY=\"$$llm_api_key\"" >> $(CONFIG_FILE).tmp
  38. @read -p "Enter your LLM Model name [default: gpt-4-0125-preview]: " llm_model; \
  39. echo "LLM_MODEL=\"$$llm_model\"" >> $(CONFIG_FILE).tmp
  40. @read -p "Enter your workspace directory [default: $(DEFAULT_WORKSPACE_DIR)]: " workspace_dir; \
  41. workspace_dir=$${workspace_dir:-$(DEFAULT_WORKSPACE_DIR)}; \
  42. echo "WORKSPACE_DIR=\"$$workspace_dir\"" >> $(CONFIG_FILE).tmp
  43. @mv $(CONFIG_FILE).tmp $(CONFIG_FILE)
  44. # Help
  45. help:
  46. @echo "Usage: make [target]"
  47. @echo "Targets:"
  48. @echo " build - Build project, including environment setup and dependencies."
  49. @echo " start-backend - Start the backend server for the OpenDevin project."
  50. @echo " start-frontend - Start the frontend server for the OpenDevin project."
  51. @echo " run - Run the OpenDevin application, starting both backend and frontend servers."
  52. @echo " Backend Log file will be stored in the 'logs' directory."
  53. @echo " setup-config - Setup the configuration for OpenDevin by providing LLM API key, LLM Model name, and workspace directory."
  54. @echo " help - Display this help message, providing information on available targets."
  55. # Phony targets
  56. .PHONY: install start-backend start-frontend run setup-config help