baeea9673129eb4f2536f2cfe7cc064216883c17
Previously we were exporting `REDIS_URL` via the docker-args* hooks. This seems to confuse our users (since the env var is not displayed when calling `dokku config`) and in some cases it also seems that the env var is not correctly set. Another problem is if several services are linked to the same app and if they are exporting `REDIS_URL` as well. Then we don’t know what will be set. To resolve theses issues, this patch changes the way we manage the env vars. We use standard dokku commands (`config` and `docker-options`) so config is set on the linked application and can be reviewed by the user easily. We also handle the case where `REDIS_URL` is already set on the linked application. When it’s the case, we automatically generate another env var based on the following pattern: DOKKU_<service name>_<random unused color>_URL. For example, this can give: DOKKU_REDIS_BLACK_URL. Since naming is now handled automatically, the `alias` command has been removed. If the user wants to set a different env var on her app, it’s just a matter of using `dokku config:set` and pasting the wanted value. IP in DSN has been removed in favor of host name exported by docker in the container. This is more robust and simpler since the IP can change but the name will remain the same if the service container restarts for instance. With all those changes, a new command has been introduced: `promote`. The goal of this command is to easily set a service as the primary one when several are linked to an app. (see README for an example)
dokku redis (beta)

Official redis plugin for dokku. Currently defaults to installing redis 3.0.4.
requirements
- dokku 0.4.0+
- docker 1.8.x
installation
# on 0.3.x
cd /var/lib/dokku/plugins
git clone https://github.com/dokku/dokku-redis.git redis
dokku plugins-install
# on 0.4.x
dokku plugin:install https://github.com/dokku/dokku-redis.git redis
commands
redis:clone <name> <new-name> Create container <new-name> then copy data from <name> into <new-name>
redis:connect <name> Connect via redis-cli to a redis service
redis:create <name> Create a redis service
redis:destroy <name> Delete the service and stop its container if there are no links left
redis:export <name> Export a dump of the redis service database
redis:expose <name> [port] Expose a redis service on custom port if provided (random port otherwise)
redis:import <name> <file> Import a dump into the redis service database
redis:info <name> Print the connection information
redis:link <name> <app> Link the redis service to the app
redis:list List all redis services
redis:logs <name> [-t] Print the most recent log(s) for this service
redis:promote <name> <app> Promote service <name> as REDIS_URL in <app>
redis:restart <name> Graceful shutdown and restart of the redis service container
redis:start <name> Start a previously stopped redis service
redis:stop <name> Stop a running redis service
redis:unexpose <name> Unexpose a previously exposed redis service
redis:unlink <name> <app> Unlink the redis service from the app
usage
# create a redis service named lolipop
dokku redis:create lolipop
# you can also specify the image and image
# version to use for the service
# it *must* be compatible with the
# official redis image
export REDIS_IMAGE="redis"
export REDIS_IMAGE_VERSION="2.8.21"
dokku redis:create lolipop
# get connection information as follows
dokku redis:info lolipop
# a redis service can be linked to a
# container this will use native docker
# links via the docker-options plugin
# here we link it to our 'playground' app
# NOTE: this will restart your app
dokku redis:link lolipop playground
# the above will expose the following environment variables
#
# DOKKU_REDIS_LOLIPOP_NAME=/lolipop/DATABASE
# DOKKU_REDIS_LOLIPOP_PORT=tcp://172.17.0.1:6379
# DOKKU_REDIS_LOLIPOP_PORT_6379_TCP=tcp://172.17.0.1:6379
# DOKKU_REDIS_LOLIPOP_PORT_6379_TCP_PROTO=tcp
# DOKKU_REDIS_LOLIPOP_PORT_6379_TCP_PORT=6379
# DOKKU_REDIS_LOLIPOP_PORT_6379_TCP_ADDR=172.17.0.1
#
# and the following will be set on the linked application by default
#
# REDIS_URL=redis://dokku-redis-lolipop:6379/0
#
# NOTE: the host exposed here only works internally in docker containers. If
# you want your container to be reachable from outside, you should use `expose`.
# another service can be linked to your app
dokku redis:link other_service playground
# since REDIS_URL is already in use, another environment variable will be
# generated automatically
#
# DOKKU_REDIS_BLUE_URL=redis://dokku-redis-other-service:6379/0
# you can then promote the new service to be the primary one
# NOTE: this will restart your app
dokku redis:promote other_service playground
# this will replace REDIS_URL with the url from other_service and generate
# another environment variable to hold the previous value if necessary.
# you could end up with the following for example:
#
# REDIS_URL=redis://dokku-redis-other-service:6379/0
# DOKKU_REDIS_BLUE_URL=redis://dokku-redis-other-service:6379/0
# DOKKU_REDIS_SILVER_URL=redis://dokku-redis-lolipop:6379/lolipop
# you can also unlink a redis service
# NOTE: this will restart your app and unset related environment variables
dokku redis:unlink lolipop playground
# you can tail logs for a particular service
dokku redis:logs lolipop
dokku redis:logs lolipop -t # to tail
# you can dump the database
dokku redis:export lolipop > lolipop.rdb
# you can import a dump
dokku redis:import lolipop < database.rdb
# you can clone an existing database to a new one
dokku redis:clone lolipop new_database
# finally, you can destroy the container
dokku redis:destroy lolipop
Description
Languages
Shell
82.9%
Python
14.8%
Makefile
1.7%
Dockerfile
0.6%