diff --git a/README.md b/README.md
index b2f0488..1a1d3a5 100644
--- a/README.md
+++ b/README.md
@@ -1,6 +1,6 @@
![NoDock](https://raw.githubusercontent.com/Osedea/nodock/master/docs/images/logo.png)
-Docker Compose for Node projects with Node, MySQL, MongoDB, NGINX, Memcached, Certbot and RabbitMQ images
+Docker Compose for Node projects with Node, MySQL, MongoDB, NGINX, Memcached, Redis, Certbot and RabbitMQ images
![Node + Docker](https://raw.githubusercontent.com/Osedea/nodock/master/docs/images/nodock.jpg)
@@ -36,6 +36,7 @@ You can use NoDock for simple projects by using one of the [examples](#Examples)
- [Change the timezone](#Change-the-timezone)
- [Use RabbitMQ plugins](#Use-RabbitMQ-plugins)
- [Change the RabbitMQ user/password](#Change-RabbitMQ-User)
+ - [Modify Redis config](#Modify-Redis-Config)
- [Contributing](#Contributing)
- [License](#License)
- [Credits](#credits)
@@ -73,7 +74,7 @@ To overwrite the `docker-compose.yml` file you can use a `docker-compose.overrid
```yaml
# docker-compose.override.yml
-version: '2'
+version: '3'
services:
[...]
@@ -88,6 +89,7 @@ We provide examples of configurations you might use for a specific stack. Each e
* [Mongo](https://github.com/Osedea/nodock/tree/master/_examples/mongo) - MongoDB + Node + NGINX
* [RabbitMQ](https://github.com/Osedea/nodock/tree/master/_examples/rabbitmq) - RabbitMQ + Node + NGINX
* [Memcached](https://github.com/Osedea/nodock/tree/master/_examples/memcached) - Memcached + Node + NGINX
+* [Redis](https://github.com/Osedea/nodock/tree/master/_examples/redis) - Redis + Node + NGINX
* [RethinkDB](https://github.com/Osedea/nodock/tree/master/_examples/rethinkdb) - RethinkDB + Node + NGINX
* [2 Node Apps](https://github.com/Osedea/nodock/tree/master/_examples/2-nodes) - Node + Node + NGINX
@@ -339,6 +341,10 @@ To activate them, change their values to `true` in your docker-compose file:
- RABBITMQ_DEFAULT_USER=custom_user
- RABBITMQ_DEFAULT_PASS=custom_pass
```
+
+#### Modify the Redis config
+You can edit `redis/redis.conf` to modify the redis config.
+
## Contributing
Do not hesitate to contribute to NoDock by creating an issue, fixing a bug or bringing a new idea to the table.
diff --git a/_examples/redis/README.md b/_examples/redis/README.md
new file mode 100644
index 0000000..83db03c
--- /dev/null
+++ b/_examples/redis/README.md
@@ -0,0 +1,21 @@
+## Redis Service
+
+### Setup
+
+Copy the index file in this folder to the project root:
+
+```bash
+cd /
+
+cp -r nodock/_examples/redis/* .
+```
+
+### Usage
+
+```bash
+cd nodock/
+
+docker-compose up -d redis node nginx
+```
+
+By going to `127.0.0.1` in your browser you should be seeing a message indicating that `node` has successfully connected to `redis`.
diff --git a/_examples/redis/index.js b/_examples/redis/index.js
new file mode 100644
index 0000000..36f6c57
--- /dev/null
+++ b/_examples/redis/index.js
@@ -0,0 +1,21 @@
+var express = require('express');
+var app = express();
+var redis = require("redis");
+
+
+app.get('/', function(req, res) {
+ var client = redis.createClient({
+ host: 'redis',
+ port: '6379'
+ });
+
+ client.on("error", function (err) {
+ res.send('Could not connect to redis');
+ });
+
+ client.on('connect', function() {
+ res.send('Connected to redis');
+ });
+});
+
+app.listen(8000);
diff --git a/_examples/redis/package.json b/_examples/redis/package.json
new file mode 100644
index 0000000..2ba9710
--- /dev/null
+++ b/_examples/redis/package.json
@@ -0,0 +1,15 @@
+{
+ "name": "example-redis-node-docker",
+ "version": "1.0.0",
+ "description": "",
+ "main": "index.js",
+ "scripts": {
+ "test": "echo \"Error: no test specified\" && exit 1"
+ },
+ "author": "",
+ "license": "MIT",
+ "dependencies": {
+ "express": "^4.14.0",
+ "redis": "^2.8.0"
+ }
+}
diff --git a/docker-compose.yml b/docker-compose.yml
index 4736940..32647f8 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -105,6 +105,14 @@ services:
expose:
- "11211"
+ redis:
+ build:
+ context: ./redis
+ expose:
+ - "6379"
+ volumes:
+ - ./data/redis:/data
+
rethinkdb:
build:
context: ./rethinkdb
diff --git a/redis/Dockerfile b/redis/Dockerfile
new file mode 100644
index 0000000..09c81a9
--- /dev/null
+++ b/redis/Dockerfile
@@ -0,0 +1,5 @@
+FROM redis:4.0
+
+COPY redis.conf /usr/local/etc/redis/redis.conf
+
+CMD [ "redis-server", "/usr/local/etc/redis/redis.conf" ]
diff --git a/redis/redis.conf b/redis/redis.conf
new file mode 100644
index 0000000..f4cda6f
--- /dev/null
+++ b/redis/redis.conf
@@ -0,0 +1,48 @@
+daemonize no
+pidfile /var/run/redis.pid
+port 6379
+tcp-backlog 511
+timeout 0
+tcp-keepalive 0
+loglevel notice
+logfile ""
+databases 16
+save 900 1
+save 300 10
+save 60 10000
+stop-writes-on-bgsave-error yes
+rdbcompression yes
+rdbchecksum yes
+dbfilename dump.rdb
+slave-serve-stale-data yes
+slave-read-only yes
+repl-diskless-sync no
+repl-diskless-sync-delay 5
+repl-disable-tcp-nodelay no
+slave-priority 100
+appendonly no
+appendfilename "appendonly.aof"
+appendfsync everysec
+no-appendfsync-on-rewrite no
+auto-aof-rewrite-percentage 100
+auto-aof-rewrite-min-size 64mb
+aof-load-truncated yes
+lua-time-limit 5000
+slowlog-log-slower-than 10000
+slowlog-max-len 128
+latency-monitor-threshold 0
+notify-keyspace-events ""
+hash-max-ziplist-entries 512
+hash-max-ziplist-value 64
+list-max-ziplist-entries 512
+list-max-ziplist-value 64
+set-max-intset-entries 512
+zset-max-ziplist-entries 128
+zset-max-ziplist-value 64
+hll-sparse-max-bytes 3000
+activerehashing yes
+client-output-buffer-limit normal 0 0 0
+client-output-buffer-limit slave 256mb 64mb 60
+client-output-buffer-limit pubsub 32mb 8mb 60
+hz 10
+aof-rewrite-incremental-fsync yes