Skip to main content

Postgraas is a super simple PostgreSQL-as-a-service

Project description

https://travis-ci.org/blue-yonder/postgraas_server.svg?branch=master https://coveralls.io/repos/github/blue-yonder/postgraas_server/badge.svg?branch=master

Postgraas is a super simple PostgreSQL-as-a-service

What is Postgraas?

Postgraas offers CRUD operations for complete PostgreSQL database instances via a simple REST api. The database instances are docker containers and the api server is a few hundred LoC Flask application. It is of not meant as a production ready solution, but more a proof-of-concept to spread the idea of creating “as-a-service” services easily yourself and should inspire you to start working on your own cloud infrastructure today. But in fact, it proofs the concept very well and it turned out to be super useful for delivering a PostgreSQL instance if you need one fast: for integration tests, for playing around with fancy ShowHN projects or other experiments. The CRUD management via REST api is of course also a necessary prequisite for building an automated continuous delivery pipeline for a modern software project.

Installation

You can find detailed instructions in the docs

Install via pip:

pip install postgraas_server

And start the wsgi api server for example with gunicorn:

gunicorn -w 4 -b 0.0.0.0:8080 postgraas_server.postgraas_api:app

Usage

We need to send all the required parameters for the creation as an http request. This is quite convenient by creating a file e.g. my_postgraas.json:

{
    "postgraas_instance_name": "my_postgraas",
    "db_name": "my_db",
    "db_username": "db_user",
    "db_pwd": "secret"
}

and making a POST request to the collection resource with curl:

curl -H "Content-Type: application/json" -X POST --data @my_postgraas.json http://localhost:8080/api/v2/postgraas_instances

now your instance is created and as a response you get the details of your instance:

{
     "postgraas_instance_id": 1,
     "container_id": "193f0d94d49fa26626fdbdb583e9453f923468b01eac59207b4852831a105c03",
     "db_pwd": "secret",
     "host": "not imlemented yet",
     "db_name": "my_db",
     "db_username": "db_user",
     "port": 54648
}

We are now able to connect to the database for exaple with psql:

psql -h localhost -p 54648 -U db_user my_db

Awesome, isn’t it?

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

postgraas_server-0.1.10.tar.gz (27.8 kB view details)

Uploaded Source

Built Distribution

postgraas_server-0.1.10-py2.py3-none-any.whl (11.9 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file postgraas_server-0.1.10.tar.gz.

File metadata

File hashes

Hashes for postgraas_server-0.1.10.tar.gz
Algorithm Hash digest
SHA256 0713a261fda529064fee04884b6826d8f824cd296be336723380e877055f6cd9
MD5 7163e2feb02b2a9937099d0c8e21409a
BLAKE2b-256 6c8e565a4dcf39dd9080af47f85cd84b2c53c7daab8a3a3eb260cf093aa0e414

See more details on using hashes here.

File details

Details for the file postgraas_server-0.1.10-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for postgraas_server-0.1.10-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 e03537a98b6ad6528f7dc062472d5fcfd319a8ca275aaffe22787e8942a149c1
MD5 a2faca069d044e9ecdf038936d687125
BLAKE2b-256 07306ce8ed53ef768f50727c79ba93898b439a1112f17d5c7af0316869946caa

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page