OpenHands icon indicating copy to clipboard operation
OpenHands copied to clipboard

1-click serverless cloud deployments

Open arko7n opened this issue 1 year ago • 7 comments

What problem or use case are you trying to solve? I'm exploring ways to easily deploy OpenDevin on my personal cloud (not locally), and automate the deployment process. I'm using AWS, and prefer using the AWS Copilot CLI to deploy on a serverless stack – App Runner or ECS + Fargate.

Describe the UX of the solution you'd like

  • Deploy OpenDevin into my personal cloud account (AWS/Azure/GCP) form a single click / command. This requires programmatically deploying both front and backend to a cloud compute, preferably serverless (like on AWS Fargate).
  • [Optional] If I make local changes to the OpenDevin src code then I should be able 1-command redeploy (e.g., copilot deploy) it to my cloud, without pushing the code to the Github repo.

I tried deploying the Dockerfiles in OpenDevin/containers on AWS and ran into a bunch of errors like below:

06-19-2024 08:27:28 PM Starting OpenDevin...
06-19-2024 08:27:28 PM SANDBOX_USER_ID is not set

In Getting Started I see that the run command needs the local user Id, password, etc. but my local variables won't apply when the container is being run in a serverless environment.

Do you have thoughts on the technical implementation? Ideally the Dockerfile could be self sufficient and not require environment variables to run. This will allow it to be easily deployed to any serverless compute. We can modify the app to not require user Id / password. If I understand correctly the user/pass is needed for making file system changes in the host. Options:

  • Have a fully isolated cloud workspace within the container, which is not linked to the host's file system (i.e., no Docker Volume). I'm okay if the workspace is deleted along with the container.
  • Alternatively, for long term storage put the workspace in S3 and not on the host.

Describe alternatives you've considered

  • Ditch the Copilot CLI and write a custom script / CDK to build, deploy and run the docker containers on a self-managed EC2 instance. I will lose the serverless benefits.
  • Create a script that uses AWS Secrets Manager to get the ssh user/pass from a serverless host (Fargate), and run that script from Docker ENTRYPOINT. This seems complex and unstable.

arko7n avatar Jun 20 '24 05:06 arko7n

In Getting Started I see that the run command needs the local user Id

It just needs the current user_id?

SmartManoj avatar Jun 20 '24 05:06 SmartManoj

In Getting Started I see that the run command needs the local user Id

It just needs the current user_id?

Yes I mean this approach should work fine if I run it locally on Mac, or a server like EC2. But I'm not sure if commands like id -u work in a serverless environment (say AWS Fargate) because the server/host is abstracted.

arko7n avatar Jun 20 '24 05:06 arko7n

But I'm not sure if commands like id -u work in a serverless environment (say AWS Fargate)

Could you check it?

SmartManoj avatar Jun 20 '24 06:06 SmartManoj

I tried deploying on AppRunner first but it doesn't allow ssh.

I'm exploring the alternatives above, and will use Fargate next. There are some ways to ssh into Fargate, although not recommended.

Another potential issue I see is that serverless environments may not support mounting the Docker socket (/var/run/docker.sock).

For now is it safe to say that the current setup of OpenDevin is not directly compatible with serverless?

arko7n avatar Jun 20 '24 06:06 arko7n

@arko7n At the moment, OpenDevin cannot run on serverless environments. As you said, it requires access to the docker.sock in order to create the sandbox container, which is impossible to do within serverless environments (or SaaS~) like Google Cloud Run, AWS Fargate, CF's Workers, and so on.

iFurySt avatar Jun 20 '24 07:06 iFurySt

Could LocalBox work? https://github.com/OpenDevin/OpenDevin/blob/26fc3c886adf74614abfa14857273d8178dcb481/opendevin/runtime/docker/local_box.py#L12-L28

SmartManoj avatar Jun 20 '24 07:06 SmartManoj

This issue is stale because it has been open for 30 days with no activity. Remove stale label or comment or this will be closed in 7 days.

github-actions[bot] avatar Aug 18 '24 01:08 github-actions[bot]

This issue was closed because it has been stalled for over 30 days with no activity.

github-actions[bot] avatar Aug 25 '24 01:08 github-actions[bot]