Skip to main content

Overview

To get started with RunPod:

Quick migration with Docker

Transitioning from Banana to RunPod doesn't have to be a lengthy process. For users seeking a swift migration path while maintaining Banana's dependencies for the interim, the Docker approach provides an efficient solution. This method allows you to leverage Docker to encapsulate your environment, simplifying the migration process and enabling a smoother transition to RunPod.

Why consider the Dockerfile approach?

Utilizing a Dockerfile for migration offers a bridge between Banana and RunPod, allowing for immediate deployment of existing projects without the need to immediately discard Banana's dependencies. This approach is particularly beneficial for those looking to test or move their applications to RunPod with minimal initial adjustments.

Dockerfile

The provided Dockerfile outlines a straightforward process for setting up your application on RunPod.

Add this Dockerfile to your project.

FROM runpod/banana:peel as bread
FROM repo/image:tag

RUN pip install runpod

COPY --from=bread /handler.py .
COPY --from=bread /start.sh .

RUN chmod +x start.sh
CMD ["./start.sh"]

Building and deploying

After creating your Dockerfile, build your Docker image and deploy it to RunPod. This process involves using Docker commands to build the image and then deploying it to RunPod.

Advantages and considerations

This Dockerfile approach expedites the migration process, allowing you to leverage RunPod's powerful features with minimal initial changes to your project. It's an excellent way to quickly transition and test your applications on RunPod.

However, while this method facilitates a quick start on RunPod, it's advisable to plan for a future migration away from Banana's dependencies, as there is overhead to building Banana's dependencies and deploying them to RunPod.

Gradually adapting your project to utilize RunPod's native features and services will optimize your application's performance and scalability.

Moving forward

Once you've migrated your application using the Docker approach, consider exploring RunPod's full capabilities. Transitioning away from Banana's dependencies and fully integrating with RunPod's services will allow you to take full advantage of what RunPod has to offer.

This quick migration guide is just the beginning. Continue with the rest of our tutorial to learn how to leverage RunPod's features to their fullest and ensure your project is fully adapted to its new environment.

The rest of this guide will help you set up a RunPod project.

Setting up your project

Just like with Banana, RunPod provides a Python SDK to run your projects.

To get started, install setup a virtual environment then install the SDK library.

Create a Python virtual environment with venv:

python3 -m venv env
source env/bin/activate

To install the SDK, run the following command from the terminal.

python -m pip install runpod

Project examples

RunPod provides a repository of templates for your project.

You can use the template to get started with your project.

gh repo clone runpod-workers/worker-template

Now that you've got a basic RunPod Worker template created:

  • Continue reading to see how you'd migrate from Banana to RunPod
  • See Generate SDXL Turbo for a general approach on deploying your first Serverless Endpoint with RunPod.

Project structure

When beginning to migrate your Banana monorepo to RunPod, you will need to understand the structure of your project.

Banana is a monorepo that contains multiple services. The basic structure for Banana projects is aligned with the RunPod Serverless projects for consistency:

.
├── Dockerfile # Docker configuration
├── README.md # Project documentation
├── banana_config.json # Configuration settings
├── requirements.txt # Dependencies
└── src
├── app.py # Main application code
└── download.py # Download script

Both project setups at a minimum contain:

  • Dockerfile: Defines the container for running the application.
  • Application code: The executable code within the container.

Optional files included in both setups:

  • requirements.txt: Lists dependencies needed for the application.

Banana Configuration settings

Banana configuration settings are stored in a banana_config.json file.

Banana uses a banana_config.json file which contains things like Idle Timeout, Inference Timeout, and Max Replicas.

Idle Timeout

RunPod allows you to set an Idle Timeout when creating the Endpoint. The default value is 5 seconds.

Inference Timeout

RunPod has a similar concept to Inference Timeout. For runs that are take less than 30 seconds to execute, you should use the run_sync handler. For runs that take longer than 30 seconds to execute, you should use the sync handler.

Max Replicas

When creating a Worker in RunPod, you can set the max Workers that will scale up depending on the amount of Worker sent to your Endpoint. For more informaiton, see Scale Type

note

When creating a Worker, select the Flashboot option to optimize your startup time.