13:51 pm

What is Langflow?

Langflow is a UI for building and deploying LLM-based applications, particularly with LangChain.

As easy as drag and drop like figma but for llm apps.

My Setup

  • AWS EC2 (t2 medium, 4gb ram, 25 gb ssd, 2vcpu)
  • Ubuntu 22.4

Deployment

Steps to Deploy

SSH into the instance

ssh -i privkey.pem ubuntu@<ip addr/domain>

Update and Upgrade apps and sources in ubuntu

sudo apt update && sudo apt upgrade -y

Install pipx

sudo apt update
sudo apt install pipx
pipx ensurepath
sudo pipx ensurepath --global # optional to allow pipx actions with --global argument

Install Langflow Globally

pipx install langflow --python python3.12

Run LangFlow

  • To run the langflow You can simply eter the command:
langflow run
  • To run forever and/or in background
    • I can use a different terminal session, run in background, and return to original terminal
    • e.g. with screen, nohup, tmux
    • Or you can make a systemd service (Best for long term stability)
  • I used screen command to run the langflow in different terminal session
      screen -S langflow
      langflow run
    • Press Ctrl + A, then D to detach the session.
    • To reconnect, use:
        screen -r langflow

Running Langflow using Systemd Service

If you want Langflow to start automatically on boot, create a Systemd service:

sudo nano /etc/systemd/system/langflow.service

Add the following

/etc/systemd/system/langflow.service
[Unit]
Description=Langflow Server
After=network.target
 
[Service]
ExecStart=/usr/local/bin/langflow run
WorkingDirectory=/home/ubuntu/
Restart=always
User=ubuntu
 
[Install]
WantedBy=multi-user.target

Then enable and start the service:

sudo systemctl daemon-reload
sudo systemctl enable langflow
sudo systemctl start langflow

To check logs, use following command:

journalctl -u langflow -f

You may check the Running langflow UI by either browsing in browser to http://<ip addr>:7860 or `curl http://localhost:7860

Note: the default port for langflow is 7860

Note: Remember to add port 7860 in Outbound Rules (In Security Group) in AWS.

SSL Configuration

To Configure SSL certificate for Enaabling HTTPS to your website for security enhancments. And Setting up NGINX reverse proxy, we use LetsEncrypt free ssl certificates and CertBot tool for that. See the following Note to Better dive deeper into the SSL Setup.

Prerequisites: A domain with DNS control

How To Secure Nginx with Let’s Encrypt on Ubuntu

How To Secure Nginx with Let's Encrypt on Ubuntu

15:42 pm


Links : TODO

Tags :

Date : 6th March, Thursday, 2025, (Wikilinks: 6th March, March 25, March, 2025. Thursday)

Category : Others

Link to original


Links :

Tags : AI, ML, AI Agents Agent

Date : 6th March, Thursday, 2025, (Wikilinks: 6th March, March 25, March, 2025. Thursday)

Category : Others