Skip to content

Commit

Permalink
Added ssh_password to config setup (#2139)
Browse files Browse the repository at this point in the history
Co-authored-by: Aleksandar <isavitaisa@gmail.com>
  • Loading branch information
SmartManoj and isavita committed May 31, 2024
1 parent f4bc524 commit 961c96a
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 2 deletions.
1 change: 1 addition & 0 deletions Development.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ To configure the LM of your choice, follow these steps:
make setup-config
```
This command will prompt you to enter the LLM API key, model name, and other variables ensuring that OpenDevin is tailored to your specific needs. Note that the model name will apply only when you run headless. If you use the UI, please set the model in the UI.
Set `persist_sandbox` to false if you want to use clean sandbox for each task. If `persist_sandbox` is set to true, you will need to set the `ssh_password` as well.

**Note on Alternative Models:**
Some alternative models may prove more challenging to tame than others. Fear not, brave adventurer! We shall soon unveil LLM-specific documentation to guide you on your quest. And if you've already mastered the art of wielding a model other than OpenAI's GPT, we encourage you to [share your setup instructions with us](https://github.com/OpenDevin/OpenDevin/issues/417).
Expand Down
9 changes: 9 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,15 @@ setup-config-prompts:
workspace_dir=$${workspace_dir:-$(DEFAULT_WORKSPACE_DIR)}; \
echo "workspace_base=\"$$workspace_dir\"" >> $(CONFIG_FILE).tmp

@read -p "Do you want to persist the sandbox container? [true/false] [default: true]: " persist_sandbox; \
persist_sandbox=$${persist_sandbox:-true}; \
if [ "$$persist_sandbox" = "true" ]; then \
read -p "Enter a password for the sandbox container: " ssh_password; \
echo "ssh_password=\"$$ssh_password\"" >> $(CONFIG_FILE).tmp; \
else \
echo "persist_sandbox=\"$$persist_sandbox\"" >> $(CONFIG_FILE).tmp
fi

@echo "" >> $(CONFIG_FILE).tmp

@echo "[llm]" >> $(CONFIG_FILE).tmp
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ export WORKSPACE_BASE=$(pwd)/workspace;
docker run -it \
--pull=always \
-e SANDBOX_USER_ID=$(id -u) \
-e PERSIST_SANDBOX="true" \
-e SSH_PASSWORD="make something up here" \
-e WORKSPACE_MOUNT_PATH=$WORKSPACE_BASE \
-v $WORKSPACE_BASE:/opt/workspace_base \
Expand Down
1 change: 1 addition & 0 deletions docs/modules/usage/intro.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ OpenDevin runs bash commands within a Docker sandbox, so it should not affect yo
docker run -it \
--pull=always \
-e SANDBOX_USER_ID=$(id -u) \
-e PERSIST_SANDBOX="true" \
-e SSH_PASSWORD="make something up here" \
-e WORKSPACE_MOUNT_PATH=$WORKSPACE_BASE \
-v $WORKSPACE_BASE:/opt/workspace_base \
Expand Down
2 changes: 1 addition & 1 deletion opendevin/core/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ class AppConfig(metaclass=Singleton):
disable_color: bool = False
sandbox_user_id: int = os.getuid() if hasattr(os, 'getuid') else 1000
sandbox_timeout: int = 120
persist_sandbox: bool = True
persist_sandbox: bool = False
ssh_port: int = 63710
ssh_password: str | None = None
github_token: str | None = None
Expand Down
4 changes: 3 additions & 1 deletion opendevin/runtime/docker/ssh_box.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,9 @@ def __init__(
# set up random user password
if config.persist_sandbox:
if not config.ssh_password:
raise Exception('Password must be set for persistent sandbox')
raise Exception(
'Please add ssh_password to your config.toml or add -e SSH_PASSWORD to your docker run command'
)
self._ssh_password = config.ssh_password
self._ssh_port = config.ssh_port
else:
Expand Down
2 changes: 2 additions & 0 deletions tests/integration/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ where `conftest.py` defines the infrastructure needed to load real-world LLM pro
and responses for mocking purpose. Prompts and responses generated during real runs
of agents with real LLMs are stored under `mock/AgentName/TestName` folders.

**Note:** Set PERSIST_SANDBOX=false to use a clean sandbox for each test.

## Run Integration Tests

Take a look at `run-integration-tests.yml` to learn how integration tests are
Expand Down

0 comments on commit 961c96a

Please sign in to comment.