How to use LangChain on self-hosted?

Continuing the discussion from :parrot::chains: LangChain - Memory + Chat:

Can anybody share a noob guide to self-host this feature? I tried to run the specific AI image but it seems to not work.

I need to use it as a service on N8N actual docker-compose template?

Big thanks! :slight_smile:

2 Likes

I am sorry to hear. Can you please tell me what problem you have? What error do you get when you run the provided command?

1 Like

What command do I use to install LangChain?

This can be found in our docs here:

1 Like

Hi Jan,

I am also having diffuculties getting Langchain installed on my Docker instance.

I used this command:

docker run -it --rm --name n8n -p 5678:5678 -v ~/.n8n:/home/node/.n8n docker.n8n.io/n8nio/n8n:ai-beta

and I received this error:

docker: Error response from daemon: driver failed programming external connectivity on endpoint n8n (f03e9bc9836fc5ed07c446c187265d04bc6400da7db6e2761937b7d5a83bc687): Bind for 0.0.0.0:5678 failed: port is already allocated.
ERRO[0000] error waiting for container: context canceled 

Edit

So I quit the instance that I had running with this command:

root@docker-ubuntu-s-1vcpu-1gb-ams3-01:~# docker-compose down

and then tried again:

root@docker-ubuntu-s-1vcpu-1gb-ams3-01:~/n8n-docker-caddy# docker-compose down
Stopping n8n-docker-caddy_n8n_1   ... done
Stopping n8n-docker-caddy_caddy_1 ... done
Removing n8n-docker-caddy_n8n_1   ... done
Removing n8n-docker-caddy_caddy_1 ... done
Removing network n8n-docker-caddy_default
root@docker-ubuntu-s-1vcpu-1gb-ams3-01:~/n8n-docker-caddy# docker run -it --rm --name n8n -p 5678:5678 -v ~/.n8n:/home/node/.n8n docker.n8n.io/n8nio/n8n:ai-beta
Initializing n8n process
n8n ready on 0.0.0.0, port 5678
Version: 1.9.0

Editor is now accessible via:
http://localhost:5678/

Press "o" to open in Browser.

But now I can’t access the instance from my normal domain.

What am I doing wrong?

best,
Mark

Welcome to the community @LinkedUp_Online!

Yes, the first error message was exactly about that, that you already have an n8n instance running on the same port. How to properly run multiple n8n instances on the same host, would definitely to much to explain here. If you do not have experience with hosting applications like n8n, we recommend either getting an expert who can set that up for you, or using our cloud solution. You can test the latter here for free.

That said. If you just want to play around a little bit you can spin up the LangChain version for testing on a different port (like 5679) via this command:

docker run -it --rm --name n8n -p 5679:5678 -v ~/.n8n:/home/node/.n8n docker.n8n.io/n8nio/n8n:ai-beta
1 Like

Hi!

Thanks for the response!

I was under the impression that it was going to update my current version to include Langchain. But its different docker instance then… ok!

When will Langchain be available for self-hosted?

Kind regards,

Mark

Ah yes, if you want to update your existing instance you can simply change the Docker image to use the tag ai-beta in your docker-compose file.

Ah so it is possible, great! :slight_smile:

I looked at the content of my docker-compose file, but I don’t see a clear place to add the ai-beta tag:


services:
  caddy:
    image: caddy:latest
    restart: unless-stopped
    ports:
      - "80:80"
      - "443:443"
    volumes:
      - ${DATA_FOLDER}/caddy_data:/data
      - ${DATA_FOLDER}/caddy_config:/config
      - ${DATA_FOLDER}/caddy_config/Caddyfile:/etc/caddy/Caddyfile

  n8n:
    image: n8nio/n8n
    restart: always
    ports:
      - 5678:5678
    environment:
      - N8N_BASIC_AUTH_ACTIVE=true
      - N8N_BASIC_AUTH_USER
      - N8N_BASIC_AUTH_PASSWORD
      - N8N_HOST=${SUBDOMAIN}.${DOMAIN_NAME}
      - N8N_PORT=5678
      - N8N_PROTOCOL=https
      - NODE_ENV=production
      - WEBHOOK_URL=https://${SUBDOMAIN}.${DOMAIN_NAME}/
      - GENERIC_TIMEZONE=${GENERIC_TIMEZONE}
    volumes:
      - ${DATA_FOLDER}/local_files:/files
      - ${DATA_FOLDER}/.n8n:/home/node/.n8n
volumes:
  caddy_data:
    external: true
  caddy_config:

Where can I add it?

Thanks!

You change the part:

...
  n8n:
    image: n8nio/n8n
...

to

...
  n8n:
    image: n8nio/n8n:ai-beta
...
3 Likes

Hi Jan,

Thanks that worked! :slight_smile:

Kind regards,

Mark

Glad to hear. Have fun!

Thanks like always, guys. I just get lost trying to forward ports and everything else, so updating the actual image should do the trick.

I’ll try and share my work on it, N8N is on fire!! :rocket::fire:

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.