Manage PostgreSQL users and databases in Zerops
Default database and user​
Zerops creates a default database and a default user automatically when a new PostgreSQL service is created.
Database​
The default database name is identical to the service hostname. The default encoding is set to utf8mb4
.
DB user​
Default user name is identical to the service hostname. Default user password is generated randomly. You will find the password in Zerops GUI or you can use the environment variable.
Zerops creates a second DB user: zps
for maintenance reasons with full privileges. Do not delete, change the password or remove privileges from this user, it will disrupt Zerops ability to maintain the database cluster.
How to install Adminer to Zerops​
Adminer ↗ is a open source full-featured database management tool written in PHP.
Single-click installation​
To install Adminer into your project, open your project in Zerops GUI and select import services in the left menu.
Copy the following yaml file into the text area and start the import:
services:
- # Service will be accessible through zCLI VPN under: http://adminer
hostname: adminer
# Type and version of service used.
type: php-apache@8.0+2.4
# Whether the service will be run on one or multiple containers.
# Since this is a utility service, using a single container is fine.
minContainers: 1
maxContainers: 1
# Folder name used as the root of the publicly accessible web server content.
documentRoot: public
# Link to Zerops repository that contains Adminer code with Zerops build and deploy instructions.
buildFromGit: https://github.com/zeropsio/recipe-adminer@main
When the import is finished, Adminer will be running as a PHP service in your project.
How to access Adminer​
Use Zerops VPN​
By default Adminer service is private and is accessible from your local workstation over VPN.
You can securely connect to PostgreSQL from your local workspace via Zerops VPN. Zerops VPN client is included into zCLI, the Zerops command-line tool. To start a VPN connection to the selected Zerops project, follow these steps:
- Install & setup zCLI
- Start the Zerops VPN
- Type
http://adminer
into your browser
Do not use https when connecting to Adminer via VPN.
Enable public access​
You can enable the public access to the Adminer service via the [Zerops subdomain].
Or you can configure the [Public routing] on the Adminer service to make it accessible on your own domain.
How to install phpMyAdmin to Zerops​
phpMyAdmin ↗ is a free software tool written in PHP, intended to handle the administration of PostgreSQL over the Web.
Single-click installation​
To install phpMyAdmin into your project, open your project in Zerops GUI and select import services in the left menu.
Copy the following yaml file into the text area and start the import:
services:
- # Service will be accessible through zCLI VPN under: http://phpmyadmin
hostname: phpmyadmin
# Type and version of service used.
type: php-apache@8.1+2.4
# Whether the service will be run on one or multiple containers.
# Since this is a utility service, using a single container is fine.
minContainers: 1
maxContainers: 1
# Folder name used as the root of the publicly accessible web server content.
documentRoot: public
# Link to Zerops repository that contains Adminer code with Zerops build and deploy instructions.
buildFromGit: https://github.com/zeropsio/recipe-phpmyadmin@main
When the import is finished, phpMyAdmin will be running as a PHP service in your project.
How to access phpMyAdmin​
Use Zerops VPN​
By default phpMyAdmin service is private and is accessible from your local workstation over VPN.
You can securely connect to PostgreSQL from your local workspace via Zerops VPN. Zerops VPN client is included into zCLI, the Zerops command-line tool. To start a VPN connection to the selected Zerops project, follow these steps:
- Install & setup zCLI
- Start the Zerops VPN
- Type
http://phpmyadmin
into your browser
Do not use https when connecting to phpMyAdmin via VPN.
Enable public access​
You can enable the public access to the phpMyAdmin service via the [Zerops subdomain].
Or you can configure the [Public routing] on the phpMyAdmin service to make it accessible on your own domain.
How to use a database management tool on your workstation​
Do you already use a database management tool that supports PostgreSQL on your workstation? Connect it securely to PostgreSQL from your local workspace via Zerops VPN.
Zerops VPN client is included into zCLI, the Zerops command-line tool. To start the VPN connection, read how to connect to PostgreSQL remotely.
Do not use SSL/TLS protocols when connecting to PostgreSQL over VPN. Zerops PostgreSQL is not configured to support these protocols. The security is assured by the VPN.
How to use psql CLI on your workstation​
If you use the psql ↗ command-line client to manage your PostgreSQL on your local workspace, you can connect it securely to PostgreSQL via Zerops VPN.
Zerops VPN client is included into zCLI, the Zerops command-line tool. To start the VPN connection, read how to connect to PostgreSQL remotely.
Once the VPN session is established, you have the secured connection to the project's private network in Zerops. You can access all project services locally by using their hostname. The only difference is that no environment variables are available when connected through VPN. To connect to PostgreSQL in Zerops you have to copy the access details manually from Zerops GUI.
Use psql
command to connect to PostgreSQL in Zerops:
Do not use SSL/TLS protocols when connecting to PostgreSQL over VPN. Zerops PostgreSQL is not configured to support these protocols. The security is assured by the VPN.