mirror of
https://github.com/langflow-ai/langflow.git
synced 2026-07-24 02:05:11 +08:00
deploy: a7825e14c9
This commit is contained in:
@ -23,8 +23,8 @@
|
||||
<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Sora:wght@550;600&display=swap">
|
||||
<script>!function(){window.semaphore=window.semaphore||[],window.ketch=function(){window.semaphore.push(arguments)};var e=document.createElement("script");e.type="text/javascript",e.src="https://global.ketchcdn.com/web/v3/config/datastax/langflow_org_web/boot.js",e.defer=e.async=!0,document.getElementsByTagName("head")[0].appendChild(e)}()</script>
|
||||
<script defer="true">!function(){const e=e=>{if(window.gtag&&e.purposes&&"analytics"in e.purposes&&"targeted_advertising"in e.purposes){const n=!0===e.purposes.analytics?"granted":"denied",t=!0===e.purposes.targeted_advertising?"granted":"denied",a={analytics_storage:n,ad_personalization:t,ad_storage:t,ad_user_data:t};window.gtag("consent","update",a)}};window.ketch&&window.ketch("on","consent",e)}()</script><link rel="stylesheet" href="/assets/css/styles.79069821.css">
|
||||
<script src="/assets/js/runtime~main.b2a37277.js" defer="defer"></script>
|
||||
<script src="/assets/js/main.f711f3e7.js" defer="defer"></script>
|
||||
<script src="/assets/js/runtime~main.39baa8ce.js" defer="defer"></script>
|
||||
<script src="/assets/js/main.90f3e6c7.js" defer="defer"></script>
|
||||
</head>
|
||||
<body class="navigation-with-keyboard">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" style="display: none;"><defs>
|
||||
@ -48,6 +48,7 @@
|
||||
</div>
|
||||
</a>
|
||||
</li></ul></nav></div></div></aside><main class="docMainContainer_TBSr"><div class="container padding-top--md padding-bottom--lg"><div class="row"><div class="col docItemCol_VOVn"><div class="docItemContainer_Djhp"><article><nav class="theme-doc-breadcrumbs breadcrumbsContainer_Z_bl" aria-label="Breadcrumbs"><ul class="breadcrumbs"><li class="breadcrumbs__item"><a aria-label="Home page" class="breadcrumbs__link" href="/"><svg viewBox="0 0 24 24" class="breadcrumbHomeIcon_YNFT"><path d="M10 19v-5h4v5c0 .55.45 1 1 1h3c.55 0 1-.45 1-1v-7h1.7c.46 0 .68-.57.33-.87L12.67 3.6c-.38-.34-.96-.34-1.34 0l-8.36 7.53c-.34.3-.13.87.33.87H5v7c0 .55.45 1 1 1h3c.55 0 1-.45 1-1z" fill="currentColor"></path></svg></a></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Deploy</span></li><li class="breadcrumbs__item"><span class="breadcrumbs__link">Containerized deployments</span></li><li class="breadcrumbs__item breadcrumbs__item--active"><span class="breadcrumbs__link">Containerize a Langflow application</span></li></ul></nav><div class="tocCollapsible_ETCw theme-doc-toc-mobile tocMobile_ITEo"><button type="button" class="clean-btn tocCollapsibleButton_TO0P">On this page</button></div><div class="theme-doc-markdown markdown"><header><h1>Containerize a Langflow application</h1></header><style>[data-ch-theme="github-dark"] { --ch-t-colorScheme: dark;--ch-t-foreground: #c9d1d9;--ch-t-background: #0d1117;--ch-t-lighter-inlineBackground: #0d1117e6;--ch-t-editor-background: #0d1117;--ch-t-editor-foreground: #c9d1d9;--ch-t-editor-lineHighlightBackground: #6e76811a;--ch-t-editor-rangeHighlightBackground: #ffffff0b;--ch-t-editor-infoForeground: #3794FF;--ch-t-editor-selectionBackground: #264F78;--ch-t-focusBorder: #1f6feb;--ch-t-tab-activeBackground: #0d1117;--ch-t-tab-activeForeground: #c9d1d9;--ch-t-tab-inactiveBackground: #010409;--ch-t-tab-inactiveForeground: #8b949e;--ch-t-tab-border: #30363d;--ch-t-tab-activeBorder: #0d1117;--ch-t-editorGroup-border: #30363d;--ch-t-editorGroupHeader-tabsBackground: #010409;--ch-t-editorLineNumber-foreground: #6e7681;--ch-t-input-background: #0d1117;--ch-t-input-foreground: #c9d1d9;--ch-t-input-border: #30363d;--ch-t-icon-foreground: #8b949e;--ch-t-sideBar-background: #010409;--ch-t-sideBar-foreground: #c9d1d9;--ch-t-sideBar-border: #30363d;--ch-t-list-activeSelectionBackground: #6e768166;--ch-t-list-activeSelectionForeground: #c9d1d9;--ch-t-list-hoverBackground: #6e76811a;--ch-t-list-hoverForeground: #c9d1d9; }</style>
|
||||
<!-- -->
|
||||
<p>Designing flows in the visual editor is only the first step in building an application that uses Langflow.</p>
|
||||
<p>Once you have a functional flow, you can use that flow in a larger application, such as a website or mobile app.
|
||||
Because Langflow is both an IDE and a runtime, you can use Langflow to build and test your flows locally, and then package and serve your flows in a production environment.</p>
|
||||
@ -75,19 +76,12 @@ To do this, add the following to your Langflow application's Dockerfile:</p
|
||||
<div class="ch-codeblock not-prose" data-ch-theme="github-dark"><div class="ch-code-wrapper ch-code" data-ch-measured="false"><code class="ch-code-scroll-parent"><br><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span>COPY pyproject.toml uv.lock /app/</span></div></div><br></code></div></div>
|
||||
<h3 class="anchor anchorWithHideOnScrollNavbar_WYt5" id="docker-env">Environment variables<a href="#docker-env" class="hash-link" aria-label="Direct link to Environment variables" title="Direct link to Environment variables"></a></h3>
|
||||
<p>The <code>docker.env</code> file is a <code>.env</code> file loaded into your Docker image.
|
||||
It contains environment variables that control Langflow's behavior, such as authentication, database storage, API keys, and server configurations.
|
||||
It contains <a href="/environment-variables">Langflow environment variables</a> that are used in flows or control Langflow's behavior, such as authentication, database storage, API keys, and server configurations.
|
||||
For example:</p>
|
||||
<div class="ch-codeblock not-prose" data-ch-theme="github-dark"><div class="ch-code-wrapper ch-code" data-ch-measured="false"><code class="ch-code-scroll-parent"><br><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span>LANGFLOW_AUTO_LOGIN=True</span></div></div><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span>LANGFLOW_SAVE_DB_IN_CONFIG_DIR=True</span></div></div><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span>LANGFLOW_BASE_URL=http://0.0.0.0:7860</span></div></div><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span>OPENAI_API_KEY=sk-...</span></div></div><br></code></div></div>
|
||||
<p>You can set environment variables in the Dockerfile, but if you set an environment variable in both <code>docker.env</code> and the Dockerfile, Langflow uses the value set in <code>docker.env</code>.</p>
|
||||
<p>Langflow automatically converts a <a href="/configuration-global-variables#default-environment-variables">predefined list</a> of environment variables into global variables.</p>
|
||||
<p>If your custom environment variables aren't in this predefined list, you need to explicitly include them using the <code>LANGFLOW_VARIABLES_TO_GET_FROM_ENVIRONMENT</code> environment variable.</p>
|
||||
<p>This environment variable accepts a comma-separated list of environment variables to get from the environment and store as global variables.</p>
|
||||
<p>For example, this configuration creates global variables named <code>WATSONX_PROJECT_ID</code> and <code>WATSONX_API_KEY</code> in Langflow's database and makes them available for use in components:</p>
|
||||
<div class="ch-codeblock not-prose" data-ch-theme="github-dark"><div class="ch-code-wrapper ch-code" data-ch-measured="false"><code class="ch-code-scroll-parent"><br><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span>LANGFLOW_AUTO_LOGIN=True</span></div></div><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span>LANGFLOW_SAVE_DB_IN_CONFIG_DIR=True</span></div></div><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span>WATSONX_PROJECT_ID=your_project_id</span></div></div><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span>WATSONX_API_KEY=your_api_key</span></div></div><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span>LANGFLOW_VARIABLES_TO_GET_FROM_ENVIRONMENT=WATSONX_PROJECT_ID,WATSONX_API_KEY</span></div></div><br></code></div></div>
|
||||
<p>Alternatively, set <code>LANGFLOW_FALLBACK_TO_ENV_VAR=True</code> to allow global variables set in Langflow Settings to use an environment variable with the same name if Langflow can't retrieve the variable value from the global variables.</p>
|
||||
<p>For example, in this configuration, when a component references the global variables <code>WATSONX_PROJECT_ID</code> or <code>WATSONX_API_KEY</code> that don't exist in Langflow's database, Langflow will automatically use the corresponding environment variable value as a fallback.</p>
|
||||
<div class="ch-codeblock not-prose" data-ch-theme="github-dark"><div class="ch-code-wrapper ch-code" data-ch-measured="false"><code class="ch-code-scroll-parent"><br><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span>LANGFLOW_AUTO_LOGIN=True</span></div></div><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span>LANGFLOW_SAVE_DB_IN_CONFIG_DIR=True</span></div></div><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span>LANGFLOW_FALLBACK_TO_ENV_VAR=True</span></div></div><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span>WATSONX_PROJECT_ID=your_project_id</span></div></div><div><span class="ch-code-line-number">_<!-- -->10</span><div style="display:inline-block;margin-left:16px"><span>WATSONX_API_KEY=your_api_key</span></div></div><br></code></div></div>
|
||||
<p>For more information, see <a href="/environment-variables">Langflow environment variables</a> and <a href="/configuration-global-variables">Global variables</a>.</p>
|
||||
<p>You can set environment variables in the Dockerfile as well.
|
||||
However, if you set an environment variable in both <code>docker.env</code> and the Dockerfile, Langflow uses the value set in <code>docker.env</code>.</p>
|
||||
<p>Langflow can also <a href="/configuration-global-variables#add-custom-global-variables-from-the-environment">create global variables from your environment variables</a>, or <a href="/configuration-global-variables#use-environment-variables-for-missing-global-variables">use environment variables as a backup for missing global variables</a>.</p>
|
||||
<h3 class="anchor anchorWithHideOnScrollNavbar_WYt5" id="secrets">Secrets<a href="#secrets" class="hash-link" aria-label="Direct link to Secrets" title="Direct link to Secrets"></a></h3>
|
||||
<p>For simplicity, the examples in the Langflow documentation might use direct references to API keys and other sensitive values.
|
||||
In your own applications, you should always follow industry best practices for managing secrets, such as using environment variables or secret management tools.</p>
|
||||
@ -109,7 +103,7 @@ When you package Langflow as a dependency of an application, you only want to in
|
||||
</li>
|
||||
</ol>
|
||||
<h3 class="anchor anchorWithHideOnScrollNavbar_WYt5" id="components">Components<a href="#components" class="hash-link" aria-label="Direct link to Components" title="Direct link to Components"></a></h3>
|
||||
<p>The core components and bundles that you see in the Langflow visual editor are automatically included in the base Langflow Docker image.</p>
|
||||
<p>The <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-component" aria-hidden="true"><path d="M15.536 11.293a1 1 0 0 0 0 1.414l2.376 2.377a1 1 0 0 0 1.414 0l2.377-2.377a1 1 0 0 0 0-1.414l-2.377-2.377a1 1 0 0 0-1.414 0z"></path><path d="M2.297 11.293a1 1 0 0 0 0 1.414l2.377 2.377a1 1 0 0 0 1.414 0l2.377-2.377a1 1 0 0 0 0-1.414L6.088 8.916a1 1 0 0 0-1.414 0z"></path><path d="M8.916 17.912a1 1 0 0 0 0 1.415l2.377 2.376a1 1 0 0 0 1.414 0l2.377-2.376a1 1 0 0 0 0-1.415l-2.377-2.376a1 1 0 0 0-1.414 0z"></path><path d="M8.916 4.674a1 1 0 0 0 0 1.414l2.377 2.376a1 1 0 0 0 1.414 0l2.377-2.376a1 1 0 0 0 0-1.414l-2.377-2.377a1 1 0 0 0-1.414 0z"></path></svg> <strong>Core components</strong> and <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-blocks" aria-hidden="true"><rect width="7" height="7" x="14" y="3" rx="1"></rect><path d="M10 21V8a1 1 0 0 0-1-1H4a1 1 0 0 0-1 1v12a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1v-5a1 1 0 0 0-1-1H3"></path></svg> [<strong>Bundles</strong>] that you see in the Langflow visual editor are automatically included in the base Langflow Docker image.</p>
|
||||
<p>If you have any <a href="/components-custom-components">custom components</a> that you created for your application, you must include these components in your application directory:</p>
|
||||
<ol>
|
||||
<li>Create a <code>/components</code> folder in your application directory.</li>
|
||||
|
||||
Reference in New Issue
Block a user