Connect to KeyDB in Zerops
Copy access details from Zerops GUI​
You will find the KeyDB access details under the Access details button in the project dashboard page.
// TODO screenshot (Access detail popover)
The same information is available in the service detail page in the left menu under the Peek access details button.
KeyDB access parameters:​
Parameter | Description |
---|---|
Hostname | The service hostname specified when the KeyDB service was created. |
Port | 6379 This port is fixed for all KeyDB services and cannot be customised. |
Connection string | The connection string for KeyDB service is:redis://{hostname}:6379 |
Connect to KeyDB from runtime services of the same project​
Projects in Zerops represent a group of one or more services. Services can be of different types (runtime services, databases, message brokers, object storage, etc.). All services of the same project share a dedicated private network. To connect to a service within the same project, just use the service hostname and its internal port.
// TODO image (project example diagram)
Example​
To connect to KeyDB database1
service, set
You will find the password under the Access details button in Zerops GUI.
Do not use SSL/TLS protocols when connecting to KeyDB from other runtime services in the same project. Zerops KeyDB is not configured to support these protocols. The security is assured by the project private network. Due to security reasons Zerops doesn't allow exposing KeyDB service to the internet.
Use KeyDB environment variables​
Zerops creates default environment variables for each KeyDB service to help you with connection from runtime services in the same project. To avoid the need to copy database access parameters manually, use environment variables in your [runtime service].
Prefix the environment variable key​
All services of the same project can reference environment variables from other services. To use an environment variable from one service in another service in the same project, you must prefix the environment variable key with the service hostname and underscore.
Example​
To access the connectionString
env variable of the keydb1
service, use keudb1_connectionString
as the env variable key.
KeyDB environment variables​
List of service environment variables is available in Zerops GUI. Go to a KeyDB service detail and choose Environment variables in the left menu.
// TODO screenshot (Service env variables table page in the KeyDB detail)
Zerops creates following environment variables when the KeyDB service is created:
Variable | Description |
---|---|
Hostname | The service hostname specified when the KeyDB service was created. |
Port | 5432 This port is fixed for all KeyDB services and cannot be customised. |
projectId | ID of the project. Generated by Zerops. |
serviceId | ID of the KeyDB service. Generated by Zerops. |
Connection string | The connection string for KeyDB service is:redis://{hostname}:6379 |
You can create own custom environment variables for the KeyDB service in Zerops GUI and use them in the same way as the default variables.
Connect to KeyDB in Zerops remotely​
Due to security reasons Zerops doesn't allow exposing KeyDB service directly to the internet.
Start VPN connection​
You can securely connect to KeyDB 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:
Access KeyDB through VPN​
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 KeyDB in Zerops you have to copy the access details manually from Zerops GUI.
Do not use SSL/TLS protocols when connecting to KeyDB over VPN. Zerops KeyDB is not configured to support these protocols. The security is assured by the VPN.
Stop VPN connection​
Stop the Zerops VPN in zCLI.
Connect to KeyDB from another Zerops project​
All services of the same project share a dedicated private network. You can use the service hostname to connect from one service to another within the same project.
Different Zerops projects have no special connection. They can communicate with each other only via the internet. If you need to connect to a KeyDB service in a Zerops project from a runtime service in another project, you need to use the Zerops VPN. Due to security reasons Zerops doesn't allow exposing KeyDB service directly to the internet.