Skip to main content

CLI: Deploying a Project

Develop and deploy your project entirely on Tensor One’s infrastructure. With Tensor One projects, you can create and implement Serverless Endpoints without the need for manual container management or Docker expertise. Code changes are automatically reflected in a live environment, without rebuilding or redeploying Docker images, thereby speeding up development.

How to Set Up a Basic Endpoint

This tutorial teaches you how to obtain the IP address of the machine executing your code. By the end, you will know how to:
  • Deploy your code as a Serverless Endpoint
  • Interact with it locally and in the cloud
  • Set up a project environment using tensoronecli

Prerequisites

  • Installed tensoronecli
  • Python 3.8+

Step 1: Set Up Project Environment

Configure the CLI with your API key:
Create a new project directory:
Select Hello World from the prompt and follow the instructions.

Step 2: Writing and Testing Code Locally

Navigate into your project folder:
Replace the default code in src/handler.py with the following:
Test your code locally:
You should see your local machine’s IP address in the output.

Step 3: Running a Development Server

Launch a live development server on a Tensor One Cluster:
Watch the logs for a generated URL to confirm successful deployment.

Step 4: Interacting with Your Code

Your project relies on the external library requests. Add it to your requirements.txt:
The dev server will automatically sync changes. Then interact with your endpoint using curl:
You should receive the Cluster’s IP address in the response.

Step 5: Deploying Your Endpoint

Stop the development server (Ctrl + C), and deploy your project:
You’ll see live Endpoint URLs in the output, such as:

Step 6: Interacting with Your Serverless Endpoint

Use curl to send a request directly to the deployed endpoint:
You should receive the IP address of the Cluster hosting your endpoint.

Conclusion

You’ve successfully:
  • Created a Tensor One project
  • Wrote and tested code locally
  • Ran a live development server
  • Deployed your Serverless Endpoint
You’re now ready to explore more complex projects and unlock the full potential of Tensor One’s serverless infrastructure.