krisrang / dokku-psql

Plugin for dokku that provides a Postgresql server in a single container

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

dokku-psql Build Status

dokku-psql is a plugin for dokku that provides PostgreSQL servers for your applications.

It uses the official PostgreSQL docker image (version 9.4).

This version is tested against dokku 0.3.18.

Installation

git clone https://github.com/krisrang/dokku-psql /var/lib/dokku/plugins/psqlkr
dokku plugins-install

Commands

$ dokku help
    psql:admin_console                              Launch a psql admin cli
    psql:console     <app>                          Launch a psql cli for <app>
    psql:create      <app>                          Create a psql database for <app>
    psql:delete      <app>                          Delete psql database for <app>
    psql:url         <app>                          Get DATABASE_URL for <app>
    psql:dump        <app> > <filename.dump>        Dump <app> database to dump file
    psql:restore     <app> < <filename.*>           Restore database to <app> from file
    psql:list                                       List all databases
    psql:restart                                    Restart the psql docker container
    psql:start                                      Start the psql docker container if it isn't running
    psql:status                                     Shows status of psql
    psql:stop                                       Stop the psql docker container

Info

This plugin adds the following environment variables to your app via config vars (they are available via dokku config <app>):

  • DATABASE_URL
  • POSTGRESQL_URL
  • DB_HOST
  • DB_NAME
  • DB_DB
  • DB_USER
  • DB_PASS
  • DB_PORT

Usage

Start PostgreSQL:

$ dokku psql:start               # Server side
$ ssh dokku@server psql:start    # Client side

Stop PostgreSQL:

$ dokku psql:stop                # Server side
$ ssh dokku@server psql:stop     # Client side

Restart PostgreSQL:

$ dokku psql:restart             # Server side
$ ssh dokku@server psql:restart  # Client side

Create a new database for an existing app:

$ dokku psql:create <app>              # Server side
$ ssh dokku@server psql:create <app>   # Client side

Dump database:

$ dokku psql:dump <app> > filename.dump # Server side

Restore database from dump:

$ dokku psql:restore <app> < filename.dump # Server side

Copy database foo to database bar using pipe:

$ dokku psql:dump <app> | dokku psql:restore <app> # Server side

Acknowledgements

This plugin is based originally on the dokku-psql-single-container.

License

This plugin is released under the MIT license. See the file LICENSE.

About

Plugin for dokku that provides a Postgresql server in a single container

License:MIT License


Languages

Language:Shell 99.3%Language:Makefile 0.7%