Skip to content

Commit

Permalink
Merge pull request redislabs-training#26 from redislabs-training/add-…
Browse files Browse the repository at this point in the history
…docker-compose-instructions

Added Docker instructions / Discord call to action.
  • Loading branch information
Simon Prickett authored Jun 22, 2022
2 parents 0cc6f37 + 5c1b969 commit e1bffbc
Showing 1 changed file with 50 additions and 7 deletions.
57 changes: 50 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
Introduction
---

![Screenshot](screenshot.png)

This is the sample application codebase for RU102J, [Redis for Java Developers](https://university.redis.com/courses/ru102j/) at [Redis University](https://university.redis.com).

Solutions to the course programming challenges can be found on the `solutions` branch.
Expand All @@ -13,22 +15,62 @@ Prerequisites
In order to start and run this application, you will need:

* Java 8 JDK or higher
* Maven
* Access to a local or remote installation of [Redis](https://redis.io/download) version 5 or newer (local preferred)
* If you want to try the RedisTimeSeries exercises, you'll need to make sure that your Redis installation also has the [RedisTimeSeries Module](https://oss.redis.com/redistimeseries/) installed
* [Maven](https://maven.apache.org/)
* Access to a local or remote installation of [Redis](https://redis.io/download) version 5 or newer (local preferred, Docker is a good option - see instructions below)
* If you want to try the RedisTimeSeries exercises, you'll need to make sure that your Redis installation also has the [RedisTimeSeries Module](https://oss.redis.com/redistimeseries/) installed (or use the provided Docker Compose file which gives you Redis with RedisTimeSeries)
* Optional: [Docker](https://www.docker.com/get-started/)
* Optional but recommended: [RedisInsight](https://redis.com/redis-enterprise/redis-insight/) to visualize the data in Redis. This is a graphical alternative to the `redis-cli` command

If you're using Windows, check out the following resources for help with running Redis:

* [Redis Labs Blog - Running Redis on Windows 10](https://redis.com/blog/redis-on-windows-10/)
* [Redis Blog - Running Redis on Windows 10](https://redis.com/blog/redis-on-windows-10/)
* [Microsoft - Windows Subsystem for Linux Installation Guide for Windows 10](https://docs.microsoft.com/en-us/windows/wsl/install-win10)

Running Redis with Docker
---

We've provided a Docker Compose file as part of this repo, so to start Redis with the RedisTimeSeries module installed, use the following command:

```bash
docker-compose up -d
```

This will start a Redis with RedisTimeSeries container on localhost port 6379 with no password and you should see output similar to the following:

```
Creating network "ru102j_default" with the default driver
Creating redis_ru102j ... done
```

Connect to Redis using either RedisInsight, or the `redis-cli` command. When using `redis-cli` you can invoke it from the Docker container like this:

```bash
docker exec -it redis_ru102j redis-cli
```

When you see this prompt:

```
127.0.0.1:6379>
```

you are connected to Redis. Type `quit` to exit the Redis CLI.

When you are finished working with Redis, shut down the server like so:

```bash
docker-compose down
```

Redis saves your data in an append only file in the `redisdata` folder, and will re-load it next time you start the container.

How to Start the RediSolar Application
---

### When using Redis on localhost, port 6379 with no password:

1. Run `mvn package` to build your application.
2. Load the sample data: `java -jar target/redisolar-1.0.jar load`. If you want to erase everything in Redis before loading the data, use `java -jar target/redisolar-1.0.jar load --flush true`, but be aware that this will delete ALL keys in your Redis database.
2. Load the sample data: `java -jar target/redisolar-1.0.jar load`. If you want to erase everything in Redis before loading the data, use `java -jar target/redisolar-1.0.jar load --flush true`, but be aware that this will delete ALL keys in your Redis database. Note that loading the data may take a few minutes.
3. Start the application with `java -jar target/redisolar-1.0.jar server config.yml`
4. To check that your application is running enter url `http://localhost:8081`, substituting `localhost` for the hostname that you're running the application on if necessary.

Expand Down Expand Up @@ -71,9 +113,10 @@ To rebuild the application without running the tests:
mvn package -DskipTests
```

Application Screenshot
Need Help / Join our Community
---
![Screenshot](screenshot.png)

If you need help with the course or want to chat to your fellow students and the wider Redis community, please [join us on our Discord server](https://discord.gg/jucCB8h).

Subscribe to our YouTube Channel / Follow us on Twitch
---
Expand Down

0 comments on commit e1bffbc

Please sign in to comment.