Creating Database

It is possible to install PostgreSQL to a Droplet on a self managed basis, which is a cost effective and oftentimes preferable approach. The resources are available at the following location:

https://www.postgresql.org/download/

PostgreSQL is a remarkable database and is not especially difficult to maintain, although it has tendency to become more anxious when it comes to assuring backups and high availability. The maintenance of high availability and backups is the main value proposition of Managed PostgreSQL on DigitalOcean or alternative hosting provider.

For the purpose of this documentation, PostgreSQL Managed Database at DigitalOcean will be used.

In the DigitalOcean Control Panel, navigate to Databases on the left hand navigation:

Image

Click on the Database menu item to expose the page to begin database creation:

Image

Locate the prominent Create Database Cluster button:

Image

Click the button to expose the Create Database Cluster:

Image

Specify a datacenter nearby (in this case Frankfurt) and PostgreSQL version 14:

Image

Scroll down to size the server, selecting in this case 2vCPU and 4GB RAM:

Image

No standby is needed although it would be suggested given production use. Scroll down and note the Create Database Cluster button:

Image

Click the Create Database Cluster button to begin the process of database creation:

Image

Upon the database having been created note the availability of the connection settings:

Image

Clicking the show button will expose the password:

username = doadmin
password = *******
host = db-postgresql-fra1-34965-do-user-12376516-0.b.db.ondigitalocean.com
port = 25060
database = defaultdb
sslmode = require

The database settings which will be passed as an Environment Variable later in the documentation.

Network security is outside the scope of this documentation; however, note that it is sensible to restrict access to the database to only the remote IP address in use, although this will not affect connections via the local network:

Image


Jube™. © Jube Holdings Limited 2022 to present.