-
Notifications
You must be signed in to change notification settings - Fork 190
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
126 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
## Redis Service | ||
|
||
### Setup | ||
|
||
Copy the index file in this folder to the project root: | ||
|
||
```bash | ||
cd <project_folder>/ | ||
|
||
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`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |