From 5c1b9691152b21fa9f773f47c809f0a708ce7e84 Mon Sep 17 00:00:00 2001 From: Simon Prickett Date: Wed, 22 Jun 2022 13:42:26 +0100 Subject: [PATCH] Added Docker instructions / Discord call to action. --- README.md | 57 ++++++++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 50 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index ce425b7..469bef1 100644 --- a/README.md +++ b/README.md @@ -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. @@ -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. @@ -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 ---