GithubHelp home page GithubHelp logo

rlindooren / pg_dumper Goto Github PK

View Code? Open in Web Editor NEW
0.0 3.0 0.0 86 KB

A "http-wrapper" around pg_dump written in GoLang - Allowing to easily trigger (by invoking an HTTP endpoint) the creation and restoring of database dumps.

Dockerfile 0.07% Shell 0.03% PLpgSQL 95.97% Go 3.75% Makefile 0.18%

pg_dumper's Introduction

pg_dumper

A small "HTTP-wrapper" around pg_dump.

It can be used to trigger dumping and restoring of a Postgres database.

This can be useful to reset or prepare a database during automated tests that don't have control over, for example, the transactions (e.g. during Black-box testing).

An automated test can then simply control the database state by means of an HTTP "signal".

Usage example

Using the example docker-compose.yaml. It also contains configuration hints.

In a terminal window: docker-compose up

Hint: use docker-compose down --volumes to clean up any data that might exist for the example postgres database.

Then, in a different terminal window:

List all dumps

curl "localhost:9999/list"

The response should be empty initially (since no dump was made yet).

Dump the current database state

curl "localhost:9999/dump?name=some-state"

The response should look something like this:

SUCCESS
Succesfully executed pg_dump with arguments: [--clean --format=plain -f /dumps/some-state.dump.sql]):

List again

curl "localhost:9999/list"

The response should now contain the dump that was just created, in the previous step. E.g.:

some-state (/dumps/some-state.dump.sql @ 2022-10-04 12:33:27.316599119 +0000 UTC)

Restore an earlier made dump

curl "localhost:9999/restore?name=some-state"

The response should look something like this:

SUCCESS
Succesfully executed psql with arguments: [-f /dumps/some-state.dump.sql]):

pg_dumper's People

Contributors

ricardo-kh avatar

Watchers

 avatar  avatar  avatar

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.