@@ -45,34 +45,48 @@ and configure its templated connection settings:
4545
4646## Running the App
4747
48+ This application contains two services:
49+ * create-index: Installs ELSER and ingests data into elasticsearch
50+ * api-frontend: Hosts the chatbot-rag-app application on http://localhost:4000
51+
4852There are two ways to run the app: via Docker or locally. Docker is advised for
4953ease while locally is advised if you are making changes to the application.
5054
5155### Run with docker
5256
53- Docker compose is the easiest way, as you get one-step to:
54- * ingest data into elasticsearch
55- * run the app, which listens on http://localhost:4000
57+ Docker compose is the easiest way to get started, as you don't need to have a
58+ working Python environment.
5659
5760** Double-check you have a ` .env ` file with all your variables set first!**
5861
62+ #### Create your Elasticsearch index
63+
64+ First, ingest the data into elasticsearch:
65+ ``` bash
66+ docker compose run -T --rm --pull always create-index
67+ ```
68+
69+ * Note* : This may take several minutes to complete
70+
71+ #### Run the application
72+
73+ Now, run the app, which listens on http://localhost:4000
5974``` bash
60- docker compose up --pull always --force-recreate
75+ docker compose run --rm -- pull always api-frontend
6176```
6277
63- * Note* : First time creating the index can fail on timeout. Wait a few minutes
64- and retry.
78+ #### Cleanup when finished
6579
66- Clean up when finished, like this:
80+ When you are done, clean up the services above like this:
6781
6882``` bash
6983docker compose down
7084```
7185
72- ### Run locally
86+ ### Run with Python
7387
74- If you want to run this example with Python and Node.js , you need to do a few
75- things listed in the [ Dockerfile] ( Dockerfile ) . The below uses the same
88+ If you want to run this example with Python, you need to do a few things listed
89+ in the [ Dockerfile] ( Dockerfile ) to build it first . The below uses the same
7690production mode as used in Docker to avoid problems in debug mode.
7791
7892** Double-check you have a ` .env ` file with all your variables set first!**
@@ -89,7 +103,7 @@ nvm use --lts
89103(cd frontend; yarn install; REACT_APP_API_HOST=/api yarn build)
90104```
91105
92- #### Configure your python environment
106+ #### Configure your Python environment
93107
94108Before we can run the app, we need a working Python environment with the
95109correct packages installed:
@@ -102,17 +116,16 @@ pip install "python-dotenv[cli]"
102116pip install -r requirements.txt
103117```
104118
105- #### Run the ingest command
119+ #### Create your Elasticsearch index
106120
107121First, ingest the data into elasticsearch:
108122``` bash
109- FLASK_APP=api/app.py dotenv run -- flask create-index
123+ dotenv run -- flask create-index
110124```
111125
112- * Note* : First time creating the index can fail on timeout. Wait a few minutes
113- and retry.
126+ * Note* : This may take several minutes to complete
114127
115- #### Run the app
128+ #### Run the application
116129
117130Now, run the app, which listens on http://localhost:4000
118131``` bash
@@ -185,13 +198,14 @@ passages. Modify this script to index your own data.
185198
186199See [ Langchain documentation] [ loader-docs ] for more ways to load documents.
187200
188- ### Building from source with docker
201+ ### Running from source with Docker
189202
190- To build the app from source instead of using published images, pass the ` --build `
191- flag to Docker Compose.
203+ To build the app from source instead of using published images, pass the
204+ ` --build ` flag to Docker Compose instead of ` --pull always `
192205
206+ For example, to run the create-index service from source:
193207``` bash
194- docker compose up --build --force-recreate
208+ docker compose run --rm --build create-index
195209```
196210
197211---
0 commit comments