Skip to content

Commit 3a0762d

Browse files
authored
Upgrade python and java to 4.x. Change docker-compose to separate out the batch load. (#95)
1 parent be299c7 commit 3a0762d

File tree

15 files changed

+155
-161
lines changed

15 files changed

+155
-161
lines changed

docs/001-introduction.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Introduction
22

3-
In this tutorial you will learn how to install and use the [RediSearch](https://redisearch.io) module that provides an indexing and full text search engine for Redis.
3+
In this tutorial you will learn how to use the [redis-stack](https://redis.io/docs/stack/get-started/install/docker/) image to use the [redisearch module](https://redis.io/docs/stack/search/) that provides an indexing and full text search engine for Redis.
44

55
RediSearch provides a simple and fast way to index and query data using any field (secondary index), and do search and aggregation on an indexed dataset.
66

docs/002-install-redisearch.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,17 @@ You have multiple ways to run RediSearch:
55
* building from [sources](https://github.com/RediSearch/RediSearch) and installing it inside an existing Redis Instance
66
* using [Redis Cloud](https://redislabs.com/redis-enterprise-cloud/) _(when RediSearch module 2.0 available)_
77
* using [Redis Enterprise](https://redislabs.com/redis-enterprise-software/) _(when RediSearch module 2.0 available)_
8-
* using [Docker](https://hub.docker.com/r/redislabs/redisearch/)
8+
* using [Docker](https://hub.docker.com/r/redis/redis-stack)
99

1010
Let's use Docker for now.
1111

1212
**1.1 Open a terminal an run the following command**
1313

1414

1515
```
16-
> docker run -it --rm --name redis-search-2 \
16+
> docker run -it --rm --name redis-stack \
1717
-p 6379:6379 \
18-
redislabs/redisearch:2.0.2
18+
redis/redis-stack:latest
1919
```
2020

2121
*Note: The container will automatically be removed when it exits (`--rm` parameter).*

docs/010-application-development.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,10 @@ To run the application:
4040

4141
This Docker Compose will start:
4242

43-
1. RediSearch instance on port 6380, and import all movies, actors and create indexes
43+
1. A Redis Stack container on port 6379. The redis-cli can be used with this container once the ports are exposed
4444
1. The Java, Node and Python REST Services available on port 8085, 8086, 8087
4545
1. The frontend on port 8084
46+
1. A second RediStack container will start on port 6380 just to load the sample data to the redis stack instance running on port 6379. This container exits once the sample data has been loaded to the 6379 container
4647

4748
Once started you can access the application and its services using the following URLs:
4849

sample-app/docker-compose.yaml

+38-17
Original file line numberDiff line numberDiff line change
@@ -1,68 +1,89 @@
1-
version: '3.7'
1+
version: '3.10'
22
services:
33

4-
# Start RediSearch and import data/indexes
5-
redisearch:
6-
build:
7-
context: ./redisearch-docker
8-
dockerfile: Dockerfile
4+
# Start RediSearch
5+
redis-stack:
6+
image: redis/redis-stack:latest
7+
container_name: redis-stack
8+
ports:
9+
- "6379:6379"
10+
- "8001:8001"
11+
networks:
12+
- redisearch-gettingstarted
13+
volumes:
14+
- ./redisearch-docker/dataset:/dataset
15+
- ./redis:/data`
16+
17+
# Start redis-stack to run load script and exit
18+
redis-stack-2:
19+
image: redis/redis-stack:latest
20+
container_name: redis-stack-2
921
ports:
10-
# using 6380 as public port to avoid conflict with local process
1122
- "6380:6379"
1223
networks:
1324
- redisearch-gettingstarted
14-
restart: always
15-
25+
volumes:
26+
- ./redisearch-docker/dataset:/dataset
27+
command:
28+
[ "sh", "./dataset/import-data.sh" ]
29+
depends_on:
30+
- redis-stack
31+
1632
rest-java:
1733
build:
1834
context: ./redisearch-jedis-rest
1935
dockerfile: Dockerfile
36+
container_name: rest-java
2037
ports:
2138
- "8085:8085"
2239
environment:
23-
- REDIS_URL=redis://redisearch:6379
40+
- REDIS_URL=redis://redis-stack:6379
2441
- REDIS_INDEX=idx:movie
2542
networks:
2643
- redisearch-gettingstarted
2744
restart: always
2845
depends_on:
29-
- redisearch
46+
- redis-stack
3047

3148
rest-node:
3249
build:
3350
context: ./redisearch-node-rest
3451
dockerfile: Dockerfile
52+
container_name: rest-node
3553
ports:
3654
- "8086:8086"
3755
environment:
38-
- REDIS_URL=redis://redisearch:6379
56+
- REDIS_URL=redis://redis-stack:6379
3957
- REDIS_INDEX=idx:movie
4058
networks:
4159
- redisearch-gettingstarted
4260
restart: always
4361
depends_on:
44-
- redisearch
62+
- redis-stack
4563

4664

4765
rest-python:
4866
build:
4967
context: ./redisearch-python-rest
5068
dockerfile: Dockerfile
69+
container_name: rest-python
5170
ports:
5271
- "8087:8087"
5372
environment:
54-
- REDIS_URL=redis://redisearch:6379
73+
- REDIS_SERVER=redis-stack
74+
- REDIS_PORT=6379
5575
- REDIS_INDEX=idx:movie
5676
networks:
5777
- redisearch-gettingstarted
5878
restart: always
5979
depends_on:
60-
- redisearch
80+
- redis-stack
6181

6282
search-frontend:
6383
build:
6484
context: ./front-end
6585
dockerfile: Dockerfile
86+
container_name: search-frontend
6687
ports:
6788
- "8084:8084"
6889
environment:
@@ -73,11 +94,11 @@ services:
7394
- redisearch-gettingstarted
7495
restart: always
7596
depends_on:
76-
- redisearch
97+
- redis-stack
7798
- rest-java
7899
- rest-node
79100
- rest-python
80101

81102
networks:
82103
redisearch-gettingstarted:
83-
driver: bridge
104+
driver: bridge

sample-app/redisearch-docker/Dockerfile

-9
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
sleep 15
2+
redis-cli -h redis-stack -p 6379 < /dataset/import_actors.redis
3+
redis-cli -h redis-stack -p 6379 < /dataset/import_movies.redis
4+
redis-cli -h redis-stack -p 6379 < /dataset/import_users.redis
5+
redis-cli -h redis-stack -p 6379 < /dataset/import_create_index.redis

sample-app/redisearch-docker/import-data.sh

-17
This file was deleted.

sample-app/redisearch-jedis-rest/Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,4 @@ COPY --from=build ${DEPENDENCY}/BOOT-INF/classes /app
1818

1919
EXPOSE 8085
2020

21-
ENTRYPOINT ["java","-cp","app:app/lib/*","com.redislabs.search.demo.jedis.RedisearchJedisRestApplication"]
21+
ENTRYPOINT ["java","-cp","app:app/lib/*","com.redislabs.search.demo.jedis.RedisearchJedisRestApplication"]

sample-app/redisearch-jedis-rest/README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,13 @@ This command will create a new image and build the maven project into it.
2828

2929
```shell script
3030
> docker run --rm \
31-
--env "REDIS_URL=redis://host.docker.internal:6379" \
31+
--env "REDIS_URL=redis://redis-stack:6379" \
3232
--env "REDIS_INDEX=idx:movie" \
3333
--name "redisearch-backend-java"\
3434
-p 8085:8085 redis/search-backend-java
3535
```
3636

3737
You can now access the REST Search service using the following URL:
3838

39-
* http://localhost:8085/api/1.0/search?q=man&limit=10&offset=20
39+
* http://localhost:8085/api/1.0/movies/search?q=man&limit=10&offset=20
4040

sample-app/redisearch-jedis-rest/pom.xml

+7-7
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<groupId>org.springframework.boot</groupId>
77
<artifactId>spring-boot-starter-parent</artifactId>
8-
<version>2.3.3.RELEASE</version>
8+
<version>2.7.0</version>
99
<relativePath/> <!-- lookup parent from repository -->
1010
</parent>
1111
<groupId>com.redislabs.search</groupId>
@@ -16,7 +16,7 @@
1616

1717
<properties>
1818
<java.version>1.8</java.version>
19-
<version.jredisearch>2.0.0</version.jredisearch>
19+
<version.jedis>4.2.2</version.jedis>
2020
<version.javax.inject>1</version.javax.inject>
2121
</properties>
2222

@@ -30,9 +30,9 @@
3030
<dependencies>
3131

3232
<dependency>
33-
<groupId>com.redislabs</groupId>
34-
<artifactId>jredisearch</artifactId>
35-
<version>${version.jredisearch}</version>
33+
<groupId>redis.clients</groupId>
34+
<artifactId>jedis</artifactId>
35+
<version>${version.jedis}</version>
3636
</dependency>
3737

3838

@@ -78,7 +78,7 @@
7878
<plugin>
7979
<groupId>org.apache.maven.plugins</groupId>
8080
<artifactId>maven-compiler-plugin</artifactId>
81-
<version>3.8.1</version>
81+
<version>3.10.1</version>
8282
<configuration>
8383
<source>1.8</source>
8484
<target>1.8</target>
@@ -87,7 +87,7 @@
8787
<path>
8888
<groupId>org.projectlombok</groupId>
8989
<artifactId>lombok</artifactId>
90-
<version>1.18.12</version>
90+
<version>1.18.24</version>
9191
</path>
9292
</annotationProcessorPaths>
9393
</configuration>

0 commit comments

Comments
 (0)