logo
icon

PostgreSQL with TLS

A free and open-source relational database management system emphasizing extensibility and SQL compliance with self-signed TLS certificate

template cover
Deployed7 times
Publisherpan93412
Created2024-10-25
Services
service icon
Tags
Database

A free and open-source relational database management system that emphasizes extensibility and SQL compliance.

This image is based on railwayapp-templates/postgres-ssl with some modification for Zeabur (see zeabur/postgres-ssl). Thanks a lot to them!

Configuration

It is a one-click deployment, so you rarely need to configure PostgreSQL after deployment.

It contains a self-signed TLS certificate and might be much safer than connecting directly.

You can configure PostgreSQL by editing the file /etc/postgresql/postgresql.conf with Config Editor. We have pre-configured some of the essential settings for you.

Connection

The "Instruction" section contains the root username, password, and the default database of your PostgreSQL instance. It also provides the connection string and command for you to connect from outside.

If you want to access your PostgreSQL in your other services (inter-service), you can reference the exposed variable POSTGRES_CONNECTION_STRING in your service with ${POSTGRES_CONNECTION_STRING}. For more flexible cases, you can reference these variables:

  • POSTGRES_HOST: The hostname of this PostgreSQL instance for private networking.
  • POSTGRES_PORT: The port of this PostgreSQL instance for private networking.
  • POSTGRES_DATABASE: The default database of this PostgreSQL instance.
  • POSTGRES_USERNAME: The default root username of this PostgreSQL instance.
  • POSTGRES_PASSWORD: The default root password of this PostgreSQL instance.

If your project contains multiple PostgreSQL instances, the reference variable might be unreliable (it may pick the exposed variable of another PostgreSQL instance). In this case, manually specifying the PostgreSQL instance's hostname and port is recommended.

To find your PostgreSQL instance's hostname and port for private networking, check the "Networking" tab of your PostgreSQL instance, and you will see the hostname suffixed with zeabur.internal and the port that you can use to connect to this PostgreSQL instance.