Skip to content

Commit

Permalink
Merge pull request #16 from tmayr/master
Browse files Browse the repository at this point in the history
Updated docs to clarify tunnel-ssh options
  • Loading branch information
LevelbossMike committed Jun 13, 2015
2 parents 21a1f1e + 8958161 commit e364432
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 6 deletions.
27 changes: 23 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ This is the redis-adapter implementation to use [Redis](http://redis.io) with

## Securely deploying your app

If your redis instance is isolated in a local intranet for security purposes, there is an option to open a SSH tunnel to the redis instance. To configure your ssh tunnel, provide the configuration in your environment:
If your redis instance is isolated in a local intranet for security purposes, there is an option to open a SSH tunnel to the redis instance. To configure your ssh tunnel, provide the configuration in your environment.

### Deploying to a local machine

```javascript
module.exports = {
Expand All @@ -14,14 +16,31 @@ module.exports = {
store: {
type: 'redis',
host: '10.12.0.0',
port: 6379,
port: 6379
}
}
};
```

### Deploying to external machine (reachable through ssh)

The ssh object will pass directly to [tunnel-ssh](https://github.com/Finanzchef24-GmbH/tunnel-ssh) so you can add any options to configure the tunnel destination host (dstHost) and port (dstPort), useful for instances where the default localhost isn't where your redis lives.

```javascript
module.exports = {
development: {
buildEnv: 'production',
store: {
type: 'redis',
ssh: {
host: 'ember-deploy-redis.com',
username: 'deploy',
privateKey: '~/.ssh/id_rsa'
privateKey: '~/.ssh/id_rsa',
dstPort: 6379, // redis port
dstHost: 'localhost' // redis host
}
}
}
};
```

Note that the `privateKey` is a path to the SSH private key to access the machine that your redis instance is on, not a full blown key.
4 changes: 2 additions & 2 deletions lib/redis-client.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ function RedisClient(config) {
return error('Port ' + localPort + ' is not available to open a SSH connection on.\n' +
'Please choose a port between ' + MIN_PORT_NUMBER + ' and ' + MAX_PORT_NUMBER + '.');
}
sshConfig.host = config.host;
sshConfig.dstPort = config.port;
sshConfig.host = sshConfig.host || config.host;
sshConfig.dstPort = sshConfig.dstPort || config.port;
sshConfig.localPort = localPort;
if (sshConfig.privateKey) {
sshConfig.privateKey = fs.readFileSync(untildify(sshConfig.privateKey));
Expand Down

0 comments on commit e364432

Please sign in to comment.