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:Step 2: Writing and Testing Code Locally
Navigate into your project folder:src/handler.py
with the following:
Step 3: Running a Development Server
Launch a live development server on a Tensor One Cluster:Step 4: Interacting with Your Code
Your project relies on the external libraryrequests
. Add it to your requirements.txt
:
curl
:
Step 5: Deploying Your Endpoint
Stop the development server (Ctrl + C
), and deploy your project:
Step 6: Interacting with Your Serverless Endpoint
Usecurl
to send a request directly to the deployed endpoint:
Conclusion
You’ve successfully:- Created a Tensor One project
- Wrote and tested code locally
- Ran a live development server
- Deployed your Serverless Endpoint