Git Product home page Git Product logo

pg-proxy's Introduction

Omnistrate Postgres Proxy Example

This is a simple example to show how to leverage postgres proxy with Omnistrate platform to build serverless product. This code is not intended for production use but can be used as reference.

Build Example Proxy Docker Image

make docker-build

Setup Simple Postgres Serverless With Omnistrate

Pre-requisite: Please follow https://github.com/omnistrate/account-setup to setup AWS bootstrap account/role

Step 1: Import Service Definition From Docker Compose

Sample docker compose file exist in /dockercompose/postgres_demo.yaml folder

You can import the docker image using the UI using the Import docker compose option

image

The docker compose example uses two images:

Setup Service Name to Postgres Serverless. Using this name is important as the following commands will reference the service with this name.

Step 2: Setup Postgres Instance

In Omnistrate console access page, provision a Postgres instance

Screenshot 2023-11-16 at 2 54 52 PM

Step 3: Access Postgres instance

Once Postgres instance is up and running, check the connectivity from access page and get the endpoint/port for connection. Note that the endpoint shown in the page is pointing to the proxy and not directly to the provisioned instance.

Screenshot 2023-11-16 at 3 07 26 PM

Note that if the instance is not used for some time it will be stopped automatically.

psql -U postgres -W -h <endpoint> postgres -p <port>

The default password for the demo is postgres

Once we attempt to start the connection the instance will be automatically started, it will take a few minutes for the server to start and then you can operate on the open connection.

While the connection is open the instance will be Running and after the connection is close the instance will be Stopped automatically. Auto stop in this example relies on prometheus metrics pg_stat_database_num_backends. If you want to use other metrics, please update docker compose.

pg-proxy's People

Contributors

dependabot[bot] avatar kkgupta avatar pberton avatar yyh-nj avatar

Stargazers

 avatar

Watchers

 avatar  avatar

pg-proxy's Issues

[serverless] MySQL proxy revamp

  • add subfolders and cleanup
  • cleanup proxy repo
  • add pipeline support to release new versions
  • define logic to patch the fleet

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.