DEV Community

Cover image for PostgreSQL Fast deploy and Easy Remote Admin
cGIfl300
cGIfl300

Posted on

2 2

PostgreSQL Fast deploy and Easy Remote Admin

Image description

PostgreSQL managed servers are expansive, why not just using your own VPS to add one?

This is a really short memo, the purpose is to have a PostgreSQL server running on a single computer as fast as possible to start dev things.

PostgreSQL

Installation

To allow connexions from any host on the internet

Edit the postgresql.conf file

sudo pico /etc/postgresql/13/main/postgresql.conf
Enter fullscreen mode Exit fullscreen mode
# - Connection Settings -

listen_addresses = '*'          # what IP address(es) to listen on;
Enter fullscreen mode Exit fullscreen mode

Add users authentification

sudo pico /etc/postgresql/13/main/pg_hba.conf
Enter fullscreen mode Exit fullscreen mode
host    all             all              0.0.0.0/0                       md5
host    all             all              ::/0                            md5
Enter fullscreen mode Exit fullscreen mode

Create your first remotely allowed superuser

sudo -u postgres psql
Enter fullscreen mode Exit fullscreen mode
postgres=# CREATE USER username WITH PASSWORD 'password' CREATEDB SUPERUSER CREATEROLE INHERIT LOGIN REPLICATION BYPASSRLS;
CREATE ROLE
postgres=# \q
Enter fullscreen mode Exit fullscreen mode
sudo service postgresql restart
Enter fullscreen mode Exit fullscreen mode

Admin

The best way to admin the database will be to remotely use pgAdmin you
could add users, change passwords and add databases on demand.

Enought reading here, start reading on My Blog

Image of Timescale

Timescale – the developer's data platform for modern apps, built on PostgreSQL

Timescale Cloud is PostgreSQL optimized for speed, scale, and performance. Over 3 million IoT, AI, crypto, and dev tool apps are powered by Timescale. Try it free today! No credit card required.

Try free

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Discover a treasure trove of wisdom within this insightful piece, highly respected in the nurturing DEV Community enviroment. Developers, whether novice or expert, are encouraged to participate and add to our shared knowledge basin.

A simple "thank you" can illuminate someone's day. Express your appreciation in the comments section!

On DEV, sharing ideas smoothens our journey and strengthens our community ties. Learn something useful? Offering a quick thanks to the author is deeply appreciated.

Okay