Coder Social home page Coder Social logo

panubo / docker-postgres-toolbox Goto Github PK

View Code? Open in Web Editor NEW
4.0 5.0 2.0 70 KB

PostgreSQL Toolbox for Docker

Home Page: https://hub.docker.com/r/panubo/postgres-toolbox/

License: MIT License

Makefile 2.11% Shell 88.44% Dockerfile 9.45%
postgresql postgresql-backup docker-image devops automation gcp-cloud-sql amazon-rds

docker-postgres-toolbox's Introduction

PostgreSQL Toolbox

A collection of PostgreSQL scripts for automating common DBA tasks in a Docker-centric way.

Documentation

Documentation for each subcommand:

General Usage

Using Docker links to postgres container. This will display the usage information:

docker run --rm -i -t --link myserver:postgres docker.io/panubo/postgres-toolbox

To run the subcommand:

docker run --rm -i -t --link myserver:postgres docker.io/panubo/postgres-toolbox <subcommand>

Configuration

Use --link <postgres container name>:postgres to automatically specify the required variables.

Or alternatively specify the environment variables:

Name Description
DATABASE_HOST IP / hostname of PostgreSQL server.
DATABASE_PORT TCP Port of PostgreSQL service.
DATABASE_USERNAME Administrative user eg postgres with SUPERUSER privileges.
DATABASE_PASSWORD Password of administrative user.

Some subcommands require additional environment parameters.

Testing

bats is used for testing. To test the image and commands bats and docker are required. Use the following commands to run all of the tests.

make build-with-cache # or make build
make test

All tests are kept in tests/ and all of the extension .bats. test_functions.bash is also loaded by each test. The functions include a setup and teardown (see bats docs) which creates and destroys a postgres target server.

Using bats setup and teardown and avoiding exposing postgres ports etc should allow tests to be run in parallel.

Status

Feature incomplete. Work in progress.

Local Testing

  • Example - Create user

docker run --rm -i -t -e DATABASE_HOST=localhost -e DATABASE_USERNAME=postgres -e DATABASE_PASSWORD=mysecretpassword -e DATABASE_PORT=5432 --network=host docker.io/panubo/postgres-toolbox create-user-db test test

docker-postgres-toolbox's People

Contributors

chaopanubo avatar macropin avatar pragmatic avatar trnubo avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Forkers

xit-camp uncleweb

docker-postgres-toolbox's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.