![見出し画像](https://assets.st-note.com/production/uploads/images/144339114/rectangle_large_type_2_bde769fd9069e204b71bb32773d863a9.png?width=1200)
Dify0.6.11 Firecrawlをローカルで動かす。
Dify0.6.11のリリースでFirecrawlとの連携がサポートされました。
Firecrawlはウェブスクレーパーのようなもので、Difyと連携させるとWebページを直でナレッジ(RAG)として利用できるスグレモノです。
ある程度は以下のリンクに記載されてあるSelf hostの手順でいけると思いますが、APIキーの指定場所とか書いてなかったりしたので私は迷いました。
また、DifyからFirecrawlを設定しようとすると「failed to establish a new connection: [errno 111] connection refused」も出ました。色々いじってたら治ったので原因はわからないですが、直前にした作業を書いておきます。
git clone https://github.com/mendableai/firecrawl.git
以下のファイルが取得できたはずです。
![](https://assets.st-note.com/img/1718603848024-Q3PbR4lvM6.png?width=1200)
apps/apiに移動します。
![](https://assets.st-note.com/img/1718604865457-kTWf8tojMA.png?width=1200)
apps/apiの中の「.env.example」を「.env」にリネーム
.envをVSCodeなどのテキストエディタで開く
以下の設定値を変更する
REDIS_URL=redis://redis:6379
USE_DB_AUTHENTICATION=false
TEST_API_KEY= fc-xxxxxxx #ここがAPI Keyの値になります。好みの値に。
apps/apiでコマンドプロンプトを開き以下を実行(これでfailed to establish a new connection: [errno 111] connection refusedのエラーが解消されたと思われる。)
pnpm install
node.jsが入ってない人、pnpmが入ってない人は以下を参考に
Firecrawlのrootに戻る。
![](https://assets.st-note.com/img/1718603848024-Q3PbR4lvM6.png?width=1200)
コンテナを立ち上げます。
docker compose up
私の環境ではhttp://localhost:3002ではなく、http://host.docker.internal:3002で行けました。多分コンテナのネットワーク関係が起因してるけど、詳しくないのでわからん。
![](https://assets.st-note.com/img/1718604317793-kF66YJf3nI.png?width=1200)
Selfhost.mdにはhttp://localhost:3002で実行されるって書いてあるからこっち設定したら[errno 111] connection refused.
![](https://assets.st-note.com/img/1718604429916-WgPQMhe3M4.png?width=1200)
![](https://assets.st-note.com/img/1718604499042-TrICgpaLBl.png?width=1200)
この記事が気に入ったらサポートをしてみませんか?