An open API service indexing awesome lists of open source software.

https://github.com/krisrang/dokku-psql

Plugin for dokku that provides a Postgresql server in a single container
https://github.com/krisrang/dokku-psql

Last synced: 3 months ago
JSON representation

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

Awesome Lists containing this project

README

          

dokku-psql [![Build Status](https://travis-ci.org/krisrang/dokku-psql.svg?branch=master)](https://travis-ci.org/krisrang/dokku-psql)
================

dokku-psql is a plugin for [dokku][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 Launch a psql cli for
psql:create Create a psql database for
psql:delete Delete psql database for
psql:url Get DATABASE_URL for
psql:dump > Dump database to dump file
psql:restore < Restore database to 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 `):

* 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 # Server side
$ ssh dokku@server psql:create # Client side
```

### Dump database:
```
$ dokku psql:dump > filename.dump # Server side
```

### Restore database from dump:
```
$ dokku psql:restore < filename.dump # Server side
```

### Copy database foo to database bar using pipe:
```
$ dokku psql:dump | dokku psql:restore # Server side
```

## Acknowledgements

This plugin is based originally on the [dokku-psql-single-container](https://github.com/Flink/dokku-psql-single-container).

## License

This plugin is released under the MIT license. See the file [LICENSE](LICENSE).

[dokku]: https://github.com/progrium/dokku