Postgraas is a super simple PostgreSQL-as-a-service
Project description
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file postgraas_server-1.0.0b1.tar.gz
.
File metadata
- Download URL: postgraas_server-1.0.0b1.tar.gz
- Upload date:
- Size: 37.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | eb2364ad913a9abb3aebb4f33233228ef9bfd9074fec5bae87b12bc379513449 |
|
MD5 | dfe927c3ab7a3b26ed12b804efad812d |
|
BLAKE2b-256 | a4fcf0db8cf2b5b9929ba10fe2292d9a844a95f30648613bb3e89cf10069a9ed |
File details
Details for the file postgraas_server-1.0.0b1-py2.py3-none-any.whl
.
File metadata
- Download URL: postgraas_server-1.0.0b1-py2.py3-none-any.whl
- Upload date:
- Size: 17.5 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | de4da2a6b217892964cabca790badcf1162fa0d32d2ee856b8dfbbf1d64beb29 |
|
MD5 | 481f27dd4287def66709f3403b805f18 |
|
BLAKE2b-256 | 71c3123c5880a2d5d126372925e15720402a9d72af02a2409070cb0199971a1e |