Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@ module.exports = {
// Server to run redis on.
servers: { one: {} },
// Version of redis. Add '-alpine' to use a much smaller docker image
version: '3.2.10-alpine'
version: '3.2.10-alpine',

host: '127.0.0.1', // external redis host (optional) (default: 127.0.0.1)
port: 6379, // external redis port (optional) (default: 6379)
}
}
```
Expand Down
4 changes: 3 additions & 1 deletion assets/redis-start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

REDIS_VERSION=<%= redisVersion %>
REDIS_DIR=<%= redisDir %>
REDIS_HOST=<%= redisHost %>
REDIS_PORT=<%= redisPort %>

set -e
sudo docker pull redis:$REDIS_VERSION
Expand All @@ -18,7 +20,7 @@ echo "Starting redis:$REDIS_VERSION"
sudo docker run \
-d \
--restart=always \
--publish=127.0.0.1:6379:6379 \
--publish=$REDIS_HOST:$REDIS_PORT:6379 \
--volume $REDIS_DIR/data:/data \
--name=redis \
redis:$REDIS_VERSION \
Expand Down
4 changes: 4 additions & 0 deletions command-handlers.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ module.exports = {
script: api.resolvePath(__dirname, 'assets/redis-setup.sh'),
vars: {
redisVersion: redisConfig.version || '3.2.10-alpine',
redisHost: redisConfig.host || '127.0.0.1',
redisPort: redisConfig.port || '6379',
redisDir: '/opt/redis'
}
});
Expand All @@ -53,6 +55,8 @@ module.exports = {
script: api.resolvePath(__dirname, 'assets/redis-start.sh'),
vars: {
redisVersion: config.version || '3.2.10-alpine',
redisHost: config.host || '127.0.0.1',
redisPort: config.port || '6379',
redisDir: '/opt/redis'
}
});
Expand Down
2 changes: 2 additions & 0 deletions validate.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ var joi = require('joi');

var schema = joi.object().keys({
version: joi.string(),
host: joi.string().optional(),
port: joi.string().optional(),
servers: joi.object().keys().required()
});

Expand Down