Giter VIP home page Giter VIP logo

spring-boot-redis-docker's Introduction

Demo: Spring Boot - Redis - Docker

This is a small demo project of building and running a Spring Boot application and some additional services in Docker containers. It should be relatively easy to adapt the structure to other similar architectures.

  1. Build environment: The build-backend.sh script uses the official Docker image for Gradle to build the backend code.

  2. Development runtime environment: Built using Docker Compose. The multi-container setup runs the following containers:

Requirements

This project requires only Docker and Docker Compose, as it is compiled and run in containers.

Building and Running

First build the backend:

./build-backend.sh

Build containers and run:

docker-compose up

Verify that the app answers at http://localhost:8080/users/123.

Running in the Background

Start detached:

docker-compose up -d

List containers:

docker container ls

Run Redis CLI:

docker exec -it spring-boot-redis-docker_redis_1 redis-cli

Stop containers:

docker-compose down

Test

# Spring boot cURL Test
## Example : curl http://localhost:8080/users/<id>
## <id> is Integer or Long type Number
curl http://localhost:8080/users/131000001

# Get redis key and values
docker exec -it springbootredisdocker_redis_1 redis-cli

# Write command into redis-cli
127.0.0.1:6379> keys *
1) "users::123"
2) "users::12"
3) "users::12314"
4) "users::131000001"
127.0.0.1:6379> get users::131000001
"\xac\xed\x00\x05sr\x00\x1bcom.example.demo.model.User\xff\x1c]\xa8\xa3\t\x13\a\x02\x00\x02J\x00\x02idL\x00\x04namet\x00\x12Ljava/lang/String;xp\x00\x00\x00\x00\a\xce\xe6\xc1t\x00\x0eUser 131000001"
127.0.0.1:6379>

spring-boot-redis-docker's People

Contributors

hsarkka avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.