Commit Graph

48 Commits

Author SHA1 Message Date
Jose Diaz-Gonzalez
94d6f4cc8d fix read call 2016-05-08 15:01:42 -04:00
Jose Diaz-Gonzalez
0d41bf2d6f Move command check before DOKKU_TRACE to reduce trace output 2016-05-08 03:10:59 -04:00
Jose Diaz-Gonzalez
543fdaa633 Rework how config vars are sourced
- ensure we source config/functions from the correct directory
- move config sourcing up before DOKKU_TRACE to reduce trace output
2016-05-08 03:10:41 -04:00
Jose Diaz-Gonzalez
40d35160d3 create container if not exists on service:start 2016-05-04 01:55:56 -04:00
Trey Thomas
74b3e4f491 Fix indentation 2016-04-18 16:16:10 -06:00
Trey Thomas
14c5d5eea5 Automatically pull image if it's not already downloaded 2016-04-18 15:49:58 -06:00
Edgars Beigarts
b6240f7089 Fix exit code for postgres:export when SSH_TTY is not present 2016-02-21 23:35:14 +02:00
Jose Diaz-Gonzalez
21cb6dbc9d Remove invalid service directory during command runs
Refs dokku/dokku-mariadb#30
2016-01-17 21:29:51 -05:00
Loïc Guitaut
3441be809d Enable SSL for connections to database
Since the database can be exposed to the outer world, it seems better to
have an encrypted connection to it.
We automatically generate a self-signed certificate since it's only used
to encrypt the connection but one can easily replace it by a custom one,
just overwrite `server.crt` and `server.key` in the
/var/lib/dokku/services/postgres/DB_NAME/data directory.
2015-12-07 11:16:07 +01:00
Alexey Zagarin
4e4c5241f7 secure passwords 2015-12-01 15:22:53 +03:00
Jose Diaz-Gonzalez
80abdfca2a Reorder env-file argument 2015-11-05 01:22:10 -05:00
Jose Diaz-Gonzalez
d1cf7cb427 Fix reference to ENV file 2015-11-05 00:45:07 -05:00
Jose Diaz-Gonzalez
864e8123b0 Rename ENVIRONMENT to ENV
The `ENV` file name is more often used in dokku than `ENVIRONMENT`.
2015-11-05 00:44:40 -05:00
Matt Colyer
6c6b040f4a Rename to DOCKER_CUSTOM_ENV 2015-11-04 17:38:49 -08:00
Matt Colyer
c68ac3be25 Fix lint failures
Also correct ; to be the proper delimiter.
2015-11-02 21:23:58 -08:00
Matt Colyer
50f980ce03 Switch to POSTGRES_DOCKER_ARGS variable
Previously extra command line arguments were passed after the command,
based on the discussion in https://github.com/dokku/dokku-postgres/pull/40,
it was agreed that using a single environment variable was more clear.
2015-11-02 21:05:41 -08:00
Matt Colyer
a71847cc1e Move double quote 2015-10-27 07:09:47 -07:00
Matt Colyer
0a66e18ff3 Proceed on create if the database exists
This change is useful if the container image allows for you to restore
from a backup when starting.
2015-10-26 21:07:35 -07:00
Matt Colyer
3c1c8f9e80 Pass environment variables to docker container
This change allows arbitrary environment variables to be passed to the
underlying docker container. Useful when using postgres docker
containers which allow for additional configuration on top of the
official postgres image.

See https://github.com/mcolyer/docker-postgres-wale for an example.
2015-10-26 21:05:53 -07:00
Loïc Guitaut
e6338fdf56 Fix export when using ssh -t 2015-10-17 02:00:47 +02:00
Loïc Guitaut
b2dbd036fc Fix the destroy command
Checking for container with its service name instead of ID.
Doing a chmod 777 on `/data` before removing data from the service.
2015-10-08 23:00:21 +02:00
Edgars Beigarts
abbf0b6f3d Fix /var/lib/postgresql/data volume mount point 2015-10-05 09:49:50 +03:00
Loïc Guitaut
63047297ea Revamp link/unlink commands
Previously we were exporting `DATABASE_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 `DATABASE_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 `DATABASE_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_POSTGRES_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)
2015-09-28 18:21:52 +02:00
Jose Diaz-Gonzalez
98b6481274 Add postgres:help command 2015-09-27 17:18:21 -04:00
Loïc Guitaut
a6da4ea218 Use our own image to wait for services 2015-09-24 11:47:11 +02:00
Loïc Guitaut
06e075d3a1 Do not always allocate a tty on connect
To import SQL files `connect` has to be used instead of `import`. Doing
so can’t work with the `-t` docker option, so now we check for a tty
before using this option.

Fixes #18
2015-09-19 00:52:33 +02:00
Loïc Guitaut
88d92122c8 Fix compatibility with dokku 0.4+ 2015-09-16 23:51:06 +02:00
Loïc Guitaut
b2a83ca9a3 Compatibility with dokku 0.3.x & 0.4.x for help output 2015-09-11 23:30:55 +02:00
Loïc Guitaut
153b1b826e Implement postgres:clone command 2015-09-11 02:55:52 +02:00
Loïc Guitaut
35da137071 Implement postgres:import command 2015-09-11 02:09:45 +02:00
Loïc Guitaut
db3763aa83 Use openssl rand to generate password
It should be more secure than hashing the current time.
2015-09-09 23:39:29 +02:00
Loïc Guitaut
6741582b92 Use PG tools from image when creating new DB 2015-09-09 18:30:17 +02:00
Loïc Guitaut
1085a0a01f Use aanand/wait image to wait for service to be ready 2015-09-09 18:21:04 +02:00
Loïc Guitaut
32af344146 Remove call to docker kill 2015-09-09 18:15:53 +02:00
Loïc Guitaut
3ab22d6f6f Use PG tools from docker image
Instead of installing dependencies on the host, directly use the binary
shipped with the postgres docker image. This will also prevent possible
problems when API changes for example.
2015-09-09 10:31:17 +02:00
Loïc Guitaut
1be1ba34a7 Use $PLUGIN_PATH instead of dirname 2015-09-09 00:05:45 +02:00
Jose Diaz-Gonzalez
ad4fae1b2a Normalize database names in postgres. Closes #2 2015-09-07 01:49:28 -04:00
Jose Diaz-Gonzalez
ac2652fd92 make test 2015-09-06 22:53:02 -04:00
Jose Diaz-Gonzalez
2bc4c534b8 Properly implement port expose/unexpose 2015-09-06 22:10:16 -04:00
Jose Diaz-Gonzalez
5a4a87c62f Move alias, link, unlink and logs commands into functions 2015-08-29 03:19:44 -04:00
Jose Diaz-Gonzalez
46e4f6f4c8 Move service checks into commands file 2015-08-29 02:58:45 -04:00
Jose Diaz-Gonzalez
b160c88412 Move info and list commands into shared functions
Also add better output formatting for both commands
2015-08-29 02:53:11 -04:00
Jose Diaz-Gonzalez
aa99da13cc use config for ports 2015-08-29 02:37:43 -04:00
Jose Diaz-Gonzalez
972af5b984 Use central config for env vars 2015-08-29 01:53:34 -04:00
Jose Diaz-Gonzalez
54c984b5b6 quiet grep output 2015-08-28 23:25:53 -04:00
Jose Diaz-Gonzalez
c474ac0018 Ensure container exists before attempting to kill it 2015-08-25 17:21:27 -04:00
Jose Diaz-Gonzalez
788f8bec18 Fix logs subcommand 2015-08-23 22:07:03 -04:00
Jose Diaz-Gonzalez
e344e35144 initial commit 2015-08-23 18:56:23 -04:00