This change allows folks to change where dokku mounts data from for all official plugins, removing the need to specify the configuration on a one-off basis.
Refs dokku/dokku#5468
This was used to delete an errant '*' service that was accidentally created during service deletion. That was fixed in dokku/dokku-redis#126 - and the respective PRs for each service - and is thus no longer necessary.
The fix was done by utilizing pushd when iterating over folders instead of trying to get a subdirectory with a partially quoted path.
Closesdokku/dokku-redis#130
This pull request switches testing to use an actual docker daemon, vs mocking everything out.
It may also catch actual breaking issues in our tests, which is great!
We run Dokku, and therefore dokku redis, in its own Docker container.
In order to make this work we map a path from the host into the
container as `/var/lib/dokku/services/redis`. Unfortunately the path
on the host is user-configurable, and generally _won't_ be the same
as the path in the container. This means that when we run `docker`
commands (e.g. to spin up Redis containers), the directory used for
bind mounts (the `-v` option) needs to be different.
This commit allows us to do this, but keeps the existing behaviour
(the redis root for Docker binds is the same as the redis root for
other uses) by default.
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)
If using multiple official dokku datastorage plugins, it is possible to get into a case where the `PLUGIN_DATA_ROOT` would be set incorrectly for other plugins.
Refs dokku/dokku-redis#20
`expose` and `unexpose` commands are now fully functionnal using the
ambassador pattern. This has the advantage to be a 100% docker solution
and to not have to restart the service container. Multiple ports are
exposed when service specify them.
`start` and `stop` commands have been made more robust. When calling
`start` or `stop` on an already started (or stopped) service, an error
will be printed out instead of issuing failing commands.
Exposed services will still be exposed after a `restart`. Also the
service containers (and ambassador containers) will start automatically
when docker boot up.