Skip to content

Commit 025ed28

Browse files
authored
fix local docker (#24)
* fix local docker
1 parent 173a077 commit 025ed28

File tree

5 files changed

+24
-13
lines changed

5 files changed

+24
-13
lines changed

README.md

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -91,20 +91,23 @@ The dataset was taken from the the following Kaggle links.
9191
- [Large Dataset](https://www.kaggle.com/datasets/paramaggarwal/fashion-product-images-dataset)
9292
- [Smaller Dataset](https://www.kaggle.com/datasets/paramaggarwal/fashion-product-images-small)
9393

94+
A formatted version is available for use with this demo at:
95+
9496

9597
## Running the App with docker-compose
9698
Before running the app, install [Docker Desktop](https://www.docker.com/products/docker-desktop/).
9799

98-
#### Using Redis Cloud (recommended)
100+
#### Using Redis Cloud
99101

100102
1. [Get your Redis Cloud Database](https://app.redislabs.com/) (if needed).
101103

102-
2. Export Redis Endpoint Environment Variables:
103-
```bash
104-
$ export REDIS_HOST=your-redis-host
105-
$ export REDIS_PORT=your-redis-port
106-
$ export REDIS_PASSOWRD=your-redis-password
107-
```
104+
2. `cp template.env .env` and update with cloud values
105+
106+
```bash
107+
REDIS_HOST=your-redis-host
108+
REDIS_PORT=your-redis-port
109+
REDIS_PASSOWRD=your-redis-password
110+
```
108111

109112
3. Run the App:
110113
```bash
@@ -113,11 +116,17 @@ Before running the app, install [Docker Desktop](https://www.docker.com/products
113116

114117
> The benefit of this approach is that the db will persist beyond application runs. So you can make updates and re run the app without having to provision the dataset or create another search index.
115118

116-
#### Using Redis Docker
119+
#### Running the app locally using docker
120+
121+
1. `cp template.env .env`
122+
123+
2. Run compose command
117124
```bash
118125
$ docker compose -f docker-local-redis.yml up
119126
```
120127

128+
Note: you can add `--build` and `--force-recreate` if caching old images.
129+
121130
## Running without docker-compose
122131

123132
### Run frontend

backend/productsearch/config.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
API_DOCS = "/api/docs"
1717
OPENAPI_DOCS = "/api/openapi.json"
1818
INDEX_NAME = "products"
19+
1920
REDIS_HOST = os.environ.get("REDIS_HOST", "redis-vector-db")
2021
REDIS_PORT = os.environ.get("REDIS_PORT", 6379)
2122
REDIS_DB = os.environ.get("REDIS_DB", 0)

backend/productsearch/db/load.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
#!/usr/bin/env python3
22
import asyncio
33
import json
4-
import requests
54
import os
65
from typing import List
76

87
import numpy as np
9-
from redisvl.index import AsyncSearchIndex
10-
8+
import requests
119
from productsearch import config
10+
from redisvl.index import AsyncSearchIndex
1211

1312

1413
def read_from_s3():

docker-local-redis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ services:
1212
ports:
1313
- "8888:8888"
1414
depends_on:
15-
- "redis"
16-
redis:
15+
- "redis-vector-db"
16+
redis-vector-db:
1717
image: redis/redis-stack:latest
1818
ports:
1919
- "6379:6379"

template.env

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
REDIS_HOST=redis-vector-db
2+
REDIS_PORT=6379

0 commit comments

Comments
 (0)