Skip to content

Commit

Permalink
Enhanced file sharing b/w containers in Docker Compose project and re…
Browse files Browse the repository at this point in the history
…ad-only rootfs for Redis configuration generator container.
  • Loading branch information
mabrarov committed Nov 13, 2020
1 parent 4e01b47 commit 1f7db23
Show file tree
Hide file tree
Showing 11 changed files with 27 additions and 22 deletions.
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ mvnw.cmd clean package -Ddocker-maven-plugin.version=0.34-SNAPSHOT
1. Redis version

```bash
docker run --rm abrarov/redis:6.0.9-1.0.3
docker run --rm abrarov/redis:6.0.9-1.0.4
```

Expected output looks like:
Expand All @@ -53,7 +53,7 @@ mvnw.cmd clean package -Ddocker-maven-plugin.version=0.34-SNAPSHOT
1. [Redis CLI](https://github.com/redis/redis#playing-with-redis)

```bash
container_id="$(docker run -d abrarov/redis:6.0.9-1.0.3 redis-server)" && \
container_id="$(docker run -d abrarov/redis:6.0.9-1.0.4 redis-server)" && \
docker exec "${container_id}" redis-cli ping && \
docker rm -fv "${container_id}" > /dev/null
```
Expand All @@ -67,7 +67,7 @@ mvnw.cmd clean package -Ddocker-maven-plugin.version=0.34-SNAPSHOT
1. j2cli version

```bash
docker run --rm abrarov/j2cli:0.3.10-1.0.3
docker run --rm abrarov/j2cli:0.3.10-1.0.4
```

Expected output is:
Expand All @@ -89,7 +89,7 @@ Assuming the current directory is a directory where this repository is cloned.
* Test connection to Redis

```bash
docker run --rm --network redis_default abrarov/redis:6.0.9-1.0.3 redis-cli -h redis ping
docker run --rm --network redis_default abrarov/redis:6.0.9-1.0.4 redis-cli -h redis ping
```

Expected output is:
Expand All @@ -101,7 +101,7 @@ Assuming the current directory is a directory where this repository is cloned.
* Put some data into Redis

```bash
docker run --rm --network redis_default abrarov/redis:6.0.9-1.0.3 redis-cli -h redis set foo bar
docker run --rm --network redis_default abrarov/redis:6.0.9-1.0.4 redis-cli -h redis set foo bar
```

Expected output is:
Expand All @@ -125,7 +125,7 @@ Assuming the current directory is a directory where this repository is cloned.
* Test persistence of stored data

```bash
docker run --rm --network redis_default abrarov/redis:6.0.9-1.0.3 redis-cli -h redis get foo
docker run --rm --network redis_default abrarov/redis:6.0.9-1.0.4 redis-cli -h redis get foo
```

Expected output is:
Expand Down
19 changes: 12 additions & 7 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
version: '2.1'

x-redis-conf-dir: &redis-conf-dir '/config'
x-redis-conf-producer-volume: &redis-conf-producer-volume 'redis-config:/config:rw'
x-redis-conf-consumer-volume: &redis-conf-consumer-volume 'redis-config:/config:ro'
x-redis-conf-file: &redis-conf-file '/config/redis.conf'
x-redis-port: &redis-port '6379'
x-redis-port-mapping: &redis-port-mapping '6379:6379'
Expand All @@ -9,16 +10,18 @@ x-helper-dir: &helper-dir '/helper'
x-helper-wrapper-script: &helper-wrapper-script '/helper/run.sh'
x-helper-dockerize: &helper-dockerize '/helper/dockerize'

services:
volumes:
redis-config:

services:
helper:
image: '${IMAGE_REGISTRY:-abrarov}/redis-helper:${PROJECT_VERSION:-1.0.3}'
image: '${IMAGE_REGISTRY:-abrarov}/redis-helper:${PROJECT_VERSION:-1.0.4}'
read_only: true
volumes:
- *helper-dir

init:
image: '${IMAGE_REGISTRY:-abrarov}/redis-init:${PROJECT_VERSION:-1.0.3}'
image: '${IMAGE_REGISTRY:-abrarov}/redis-init:${PROJECT_VERSION:-1.0.4}'
command: *helper-wrapper-script
environment:
INIT_COMMAND: '/run.sh'
Expand All @@ -27,13 +30,15 @@ services:
REDIS_LISTEN_BACKLOG: '128'
REDIS_PROTECTED_MODE: 'no'
REDIS_DATA_DIR: *redis-data-dir
read_only: true
volumes:
- *redis-conf-dir
- '/tmp'
- *redis-conf-producer-volume
volumes_from:
- 'helper:ro'

redis:
image: '${IMAGE_REGISTRY:-abrarov}/redis:${REDIS_VERSION:-6.0.9}-${PROJECT_VERSION:-1.0.3}'
image: '${IMAGE_REGISTRY:-abrarov}/redis:${REDIS_VERSION:-6.0.9}-${PROJECT_VERSION:-1.0.4}'
command:
- *helper-dockerize
- '-wait'
Expand All @@ -57,9 +62,9 @@ services:
read_only: true
volumes:
- '/tmp'
- *redis-conf-consumer-volume
- *redis-data-dir
volumes_from:
- 'helper:ro'
- 'init:ro'
ports:
- *redis-port-mapping
2 changes: 1 addition & 1 deletion helper-image/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>io.fabric8.dmp.samples</groupId>
<artifactId>redis-builder-parent</artifactId>
<version>1.0.3</version>
<version>1.0.4</version>
</parent>

<artifactId>helper-image</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion j2cli-builder-image/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>io.fabric8.dmp.samples</groupId>
<artifactId>redis-builder-parent</artifactId>
<version>1.0.3</version>
<version>1.0.4</version>
</parent>

<artifactId>j2cli-builder-image</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion j2cli-dist/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>io.fabric8.dmp.samples</groupId>
<artifactId>redis-builder-parent</artifactId>
<version>1.0.3</version>
<version>1.0.4</version>
</parent>

<artifactId>j2cli-dist</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion j2cli-image/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>io.fabric8.dmp.samples</groupId>
<artifactId>redis-builder-parent</artifactId>
<version>1.0.3</version>
<version>1.0.4</version>
</parent>

<artifactId>j2cli-image</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>io.fabric8.dmp.samples</groupId>
<artifactId>redis-builder-parent</artifactId>
<version>1.0.3</version>
<version>1.0.4</version>
<packaging>pom</packaging>

<scm>
Expand Down
2 changes: 1 addition & 1 deletion redis-builder-image/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>io.fabric8.dmp.samples</groupId>
<artifactId>redis-builder-parent</artifactId>
<version>1.0.3</version>
<version>1.0.4</version>
</parent>

<artifactId>redis-builder-image</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion redis-dist/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>io.fabric8.dmp.samples</groupId>
<artifactId>redis-builder-parent</artifactId>
<version>1.0.3</version>
<version>1.0.4</version>
</parent>

<artifactId>redis-dist</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion redis-image/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>io.fabric8.dmp.samples</groupId>
<artifactId>redis-builder-parent</artifactId>
<version>1.0.3</version>
<version>1.0.4</version>
</parent>

<artifactId>redis-image</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion redis-init-image/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>io.fabric8.dmp.samples</groupId>
<artifactId>redis-builder-parent</artifactId>
<version>1.0.3</version>
<version>1.0.4</version>
</parent>

<artifactId>redis-init-image</artifactId>
Expand Down

0 comments on commit 1f7db23

Please sign in to comment.