Skip to content

Commit 5e042c8

Browse files
Update for ghcr package (#19)
* Update for ghcr package * update redis cloud link
1 parent bf239ed commit 5e042c8

File tree

7 files changed

+61
-579
lines changed

7 files changed

+61
-579
lines changed

.dockerignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
*node_modules/

Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ RUN yarn install --no-optional
1111
ADD ./gui ./
1212
RUN yarn build
1313

14-
1514
FROM python:3.8-slim-buster AS ApiImage
1615

1716
ENV PYTHONUNBUFFERED 1
@@ -31,6 +30,8 @@ RUN pip install -e .
3130
# add static react files to fastapi image
3231
COPY --from=ReactImage /app/gui/build /app/backend/vecsim_app/templates/build
3332

33+
LABEL org.opencontainers.image.source https://github.com/RedisVentures/redis-product-search
34+
3435
WORKDIR /app/backend/vecsim_app
3536

3637
CMD ["sh", "./entrypoint.sh"]

README.md

Lines changed: 41 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@ The following Redis Stack capabilities are available in this demo:
2727
- Flat (brute-force)
2828
- **Hybrid Queries**
2929
- Apply tags as pre-filter for vector search
30-
- **JSON storage**
31-
3230

3331
## Application
3432

@@ -52,7 +50,6 @@ This app was built as a Single Page Application (SPA) with the following compone
5250
Some inspiration was taken from this [Cookiecutter project](https://github.com/Buuntu/fastapi-react)
5351
and turned into a SPA application instead of a separate front-end server approach.
5452

55-
5653
### Datasets
5754

5855
The dataset was taken from the the following Kaggle links.
@@ -61,57 +58,58 @@ The dataset was taken from the the following Kaggle links.
6158
- [Smaller Dataset](https://www.kaggle.com/datasets/paramaggarwal/fashion-product-images-small)
6259

6360

64-
## Running Locally
65-
Before you can run the application locally, you must use the Jupyter Notebook in the `data/` directory to create product embeddings and product metadata JSON files. Both files will end up stored in the `data/` directory. Then you can proceed with one or both of the options below.
61+
## Running the App
62+
Before running the app, install [Docker Desktop](https://www.docker.com/products/docker-desktop/).
63+
64+
6665

67-
### Using pre-built containers
66+
#### Redis Cloud (recommended)
6867

69-
The easiest option to run locally is to use the following docker-compose file to launch the
70-
prebuilt container hosted on GitHub.
68+
1. [Get your Redis Cloud Database](https://app.redislabs.com/) (if needed).
7169

72-
```yaml
73-
version: '3.7'
74-
services:
70+
2. Export Redis Endpoint Environment Variables:
71+
```bash
72+
$ export REDIS_HOST=your-redis-host
73+
$ export REDIS_PORT=your-redis-port
74+
$ export REDIS_PASSOWRD=your-redis-password
75+
```
7576

76-
redis-vector-db:
77-
image: redis/redis-stack:latest
78-
ports:
79-
- 6379:6379
80-
- 8001:8001
77+
3. Run the App:
78+
```bash
79+
$ docker compose -f docker-cloud-redis.yml up
80+
```
8181

82-
backend:
83-
image: ghcr.io/spartee/redis-vss-fashion:v0.2.0
84-
environment:
85-
DEPLOYMENT: "dev"
86-
REDIS_DATA_URL: 'redis://redis-vector-db:6379'
87-
REDIS_OM_URL: 'redis://redis-vector-db:6379'
88-
REDIS_HOST: 'redis-vector-db'
89-
REDIS_PORT: 6379
90-
expose:
91-
- "8888"
92-
ports:
93-
- "8888:8888"
94-
depends_on:
95-
- "redis-vector-db"
82+
> 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.
9683

84+
#### Redis Docker
85+
```bash
86+
$ docker compose -f docker-local-redis.yml up
9787
```
9888

99-
To launch, run the following
100-
- ``docker compose up --build`` in same directory as ``docker-compose.yml``
101-
- Wait while things install and get setup
102-
- Navigate to `http://localhost:8888` in a browser
89+
### Customizing (optional)
90+
You can use the Jupyter Notebook in the `data/` directory to create product embeddings and product metadata JSON files. Both files will end up stored in the `data/` directory and used when creating your own container.
91+
92+
Create your own containers using the `build.sh` script and then make sure to update the `.yml` file with the right image name.
10393

104-
### Using a React development env
105-
It's typically easier to write front end code in an interactive environment (**outside of Docker**)where one can test out code changes in real time. In order to use this approach:
10694

107-
1. Follow steps from previous section with Docker Compose to deploy the backend API.
108-
2. Skip the step about launching a browser at host/port.
109-
3. `cd gui/` directory and use `yarn` to install packages: `yarn install --no-optional` (you may need to use `npm` to install `yarn`).
110-
4. Use `yarn` to serve the application from your machine: `yarn start`.
95+
### Using a React development env
96+
It's typically easier to write front end code in an interactive environment, testing changes in realtime.
97+
98+
1. Deploy the app using steps above.
99+
2. Install NPM packages (you may need to use `npm` to install `yarn`)
100+
```bash
101+
$ cd gui/
102+
$ yarn install --no-optional
103+
````
104+
4. Use `yarn` to serve the application from your machine
105+
```bash
106+
$ yarn start
107+
```
111108
5. Navigate to `http://localhost:3000` in a browser.
112109
110+
All changes to your local code will be reflected in your display in semi realtime.
111+
113112
### Troubleshooting
113+
Sometimes you need to clear out some Docker cached artifacts. Run `docker system prune`, restart Docker Desktop, and try again.
114114
115-
#### Issues building the container
116-
- Sometimes it works if you try again. Or maybe you need to clear out some Docker cache. Run `docker system prune`, restart Docker Desktop, and try again.
117-
- The generated `node_modules` folder (under `gui/` when running the app outside of Docker) can mess things up when building docker images. Delete that folder (if present) and try rebuilding again.
115+
Open an issue here on GitHub and we will try to be responsive to these. Additionally, please consider [contributing](CONTRIBUTING.md).

build.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
docker build -t redisventures/redis-product-search:latest .

docker-cloud-redis.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
version: '3.7'
2+
3+
services:
4+
backend:
5+
image: ghcr.io/redisventures/redis-product-search:latest
6+
environment:
7+
DEPLOYMENT: "dev"
8+
REDIS_HOST: ${REDIS_HOST}
9+
REDIS_PORT: ${REDIS_PORT}
10+
REDIS_PASSWORD: ${REDIS_PASSWORD}
11+
expose:
12+
- "8888"
13+
ports:
14+
- "8888:8888"

docker-compose.yml renamed to docker-local-redis.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
version: '3.7'
2-
services:
32

3+
services:
44
redis-vector-db:
55
build:
66
context: ./redis-vector-db
@@ -11,9 +11,7 @@ services:
1111
- 6379:6379
1212
- 8001:8001
1313
backend:
14-
build:
15-
context: .
16-
dockerfile: Dockerfile
14+
image: ghcr.io/redisventures/redis-product-search:latest
1715
environment:
1816
DEPLOYMENT: "dev"
1917
REDIS_HOST: "redis-vector-db"

0 commit comments

Comments
 (0)