Flowise AI Tutorial #5 - Deploying to Render

21.13k views1807 WordsCopy TextShare
Leon van Zyl
#flowise #langchain #autogpt #openai In this tutorial we will have a look at deploying Flowise, as ...
Video Transcript:
in the previous videos we had a look at some of the fundamentals of creating flowwise applications but now I want to move on to a topic that many of you have been requesting in the comments and that is deploying flowwise applications to the cloud we will have a look at additional flowwise features in the series but I get the sense that you guys really want to deploy your applications to a production server at this point so let's now have a look at the different deployment options as well as some other important settings that you need
to consider when running your application online like security and file persistence without further Ado let's get started let's first have a look at our deployment options the flowwise documentation is an incredible resource so if you do get stuck or if you want to try an alternative to what we'll be covering today I highly recommend having a look at the documentation I will leave a link to the docs in the description below we can see some of the deployment options by clicking on the deployment page in the docs because flowwise uses the launching JS version of
Lang chain we can basically deploy our application to any server that supports node and a few examples of these are AWS Azure digital ocean and Google Cloud platform but from my testing the easiest service to use for deploying flowwise applications is render so in this video we will be having a look at deploying our flowwise application to render so let's talk about the prerequisites first go over to reindeer.com and register your account creating an account is free and if we go to the pricing page we can see this individual package which is free to use
and this is the package that we'll be using in this demo the reason why I feel render is easy to use is we can deploy our projects from GitHub so go ahead and create your render account we will also be using GitHub so if you haven't already go to github.com and create your account what we want to do is we want to create a copy of the flowwise project and then save it in one of our repositories we will then use render to deploy a new instance of flow wise from our GitHub repositories but first
let's create a copy of flowwise AI in the description of this video you will find the link to the flowwise repository so open that link and then from this page click on Fork Fork will create a copy of the flowwise project and install it in our own namespace when creating the fork give the project a name I will just call it flowwise and ensure that copy the main branch only is ticked then click on create Fork we have now created a copy of flowwise and stored it in our own namespace on GitHub we then don't
have to do anything else in GitHub so after logging into reindeer we can now start up a new service and in our scenario we want to start up a web services service so simply click on new web service if this is your first time logging in you should see a setting on the right hand side for connecting to GitHub after doing that you will see a list of your repositories and in this list find a repository for flowwise and click on connect we can now give our repository a name I will call mine flowwise you
can then change your region leave the branch as Main and leave the root directory as blank for the runtime select node for the build command we'll make one small change we will call yarn install followed by yarn build and for the start command we can leave it as yarn start for the instance type you can go ahead and select the free instance but for demonstration purposes I'll actually select the starter package don't worry though you will be able to follow along with this tutorial on the free package but at the end of the video I
will show you one big benefit of using a paid instance before we click on create web service we first need to click on Advanced and first let me explain this after creating this flowwise instance your flywise projects will be deployed online they will be accessible through a URL and ideally you don't want to give everyone access to your flowwise dashboard so what we'll do is we'll set up a username and password to protect our flowwise instance to do that let's click on ADD environment variable for the key value enter flowwise underscore username and give it
a value I'll just call it admin add another environment variable and call this flowwise underscore core password and give it a value I'll just enter password123 we are now done and we can scroll down to the bottom and click on create web service this will take a few minutes to complete but effectively render is now copying the false from GitHub running the Bold script and then deploying the compiled project and after a few minutes the status of the deployment will change to live and we can see in the logs the flowwise server is running we
can now access our flowwise instance by clicking on this URL and because we set a username and password our application is now secure to access our flowwise app I'll just enter my credentials and we are now able to use flowwise in the cloud we can create new chat flows we can access the marketplace access tools as well as the API Keys let's go ahead and put our localhost and Cloud instance of flywise next to each other on the left we we've got the local instance and on the right our Cloud instance let's talk about exporting
chat flows let's say we've now created a chat flow in our local instance and we now want to import that chat flow into our Cloud instance to copy these chat flows over to the cloud instance is really easy firstly we can copy all chat flows across in a single go by clicking on settings export database this will download a db.json file and all we need to do in the cloud instance is to click on settings then load database and select the file and that will import all of our chat flows in one go I'm personally
not a fan of doing that since you will override all your chat flows when you do that and there's a security issue when doing that as well since all API keys will be copied across as well so what I like to do instead is to copy the individual chat flows cross let's have a look at this I'll select the chat model demo to demonstrate this in our Cloud instance or create a new chat flow I'll save it and give it the same name like chat model demo all we need to do now is in the
local instance we can click on settings then export chat flow this will download the chat flow to our machine and in the cloud instance I'll click on settings then load chat flow and I'll then select the file that we exported and this imported our project into the cloud instance take note that the openai API key field is empty and this is a security precaution the last thing you want to do is to accidentally copy across an API key that was meant for Dave over to production and this is also the issue that I mentioned by
exporting and importing the entire database when you import the database it actually copies the API Keys across as well so therefore are recommend importing and exporting individual chat flows instead Let's test out this chat flow or paste in my API key I'll save this and let's open up chat I'll just type in hello there and after submitting this we can see the response coming back from the model this is working we now have a chat model running in the cloud let's now talk about file persistence when we create chat flows these chat flows are stored
in a Json file on the server and it's very important to take note that services like rain there will delete these files when the server is reset the server reset can happen for a multitude of reasons this can be due to maintenance or downtime the server will also be reset if we deploy the latest version of flowwise to the server any changes at a server level will reset the server and we will lose these chat flows which is not ideal realistically the this hardly ever happens and for prototyping an application it's perfectly fine however for
a production app you want to guarantee that these files will not be deleted luckily reindeer provides a solution for this if we go back to the render dashboard we can assign a disk to our project we can use a disk to store application data that needs to be persisted across deploys note that this service is only available on one of the paid instances so if you are using a free instance you will not have this option either way let's have a look at how we can assign a disk to our project we can click on
ADD disk we can then give our disk a name I'll just call it flowwise then for the mount path enter front slash opt front slash reindeer front slash dot flowwise or leave the size as 10 gig and then click on Save while this is building we also need to set up additional environment variables to connect our flowwise application to the disk this will instruct flow wise to store any application data on the disk instead of on the same disk as the project so let's click on environment then click on ADD environment variable for the key
enter database underscore path and for the value enter front slash opt front slash render slash dot flowwise this is the same value we used as the mount path on the disk we can now save these changes we now have our flowwise project running in the cloud which is accessible through a URL and our models are now saved on a disk which is persisted even if the server had to be reset I hope you found this video useful please let me know in the comments which flow-wise feature you would want me to cover next I'll see
you in the next one bye bye
Copyright © 2024. Made with ♥ in London by YTScribe.com