Technical Documentation
Configuration
To configure the environment variables for use with the render_cdk, you need to set the API_KEY environment variable. You can do this by creating a .env file in the root of your project with the following content:
API_KEY=rnd_xxxxXXXXxxxxXXXXxxxXX
Make sure to replace rnd_xxxxXXXXxxxxXXXXxxxXX with your actual Render API key.
Installation
Add render_cdk to your Cargo.toml:
[]
= "0.0.10"
- Alternatively, running at the
cargo add render_cdkroot of your project will also add render_cdk to your project.
Usage Examples
Here are basic examples of how to use the render_cdk crate to interact with Render Cloud:
1. Querying for Deployed Services
List All Services
use *;
use *;
use main;
async
List All Services by Name and Type
use *;
use *;
use main;
async
List All Services by Region
use *;
use *;
use main;
async
List All Services by Environment
use *;
use *;
use main;
async
2. Using Simple .conf Files for Resource Provisioning
.conffiles offer a convenient alternative to programmatic resource provisioning, allowing you to define and manage resources through simple configuration settings.
Configuration File Example
The following is a sample configuration_ file. This will be used to provision a managed Postgres instance and a managed Redis instance.
-
[database]section specifies the configuration for a managed Postgres instance. -
The
nameanduserfields should be filled with the desired database name and user.enable_high_availabilityindicates whether high availability should be enabled.planspecifies the pricing plan for the instance, andversionindicates the Postgres version.
[database]
name = "" # Replace with the desired database name
user = "" # Replace with the desired database user
enable_high_availability = false # Set to true to enable high availability
plan = "starter" # Pricing plan for the database instance
version = "11" # Postgres version
Note Blank fields will be autogenerated.
[redis]section specifies the configuration for a managed Redis instance.planspecifies the pricing plan for the instance.
[redis]
plan = "starter" # Pricing plan for the Redis instance`
Explanation
-
[database] Section:
-
name: The name of the Postgres database.
-
user: The user for the Postgres database.
-
enable_high_availability: Boolean value to enable or disable high availability for the database.
-
plan: The pricing plan for the Postgres instance. Options may include "starter", "standard", "premium", etc.
Note free plan will result in failed deployments.
-
version: The version of Postgres to be used.
-
-
[redis] Section:
-
plan: The pricing plan for the Redis instance. Options may include "free", "standard", "premium", etc.
Note free plan will result in failed deployments.
-
This configuration file allows you to easily set up managed database and caching services with specific plans and options suited to your project's needs.
`use config;
3. Retrieve a List of Authorized 'Users'
use *;
use *;
use main;
async
4. Creating Services
use *;
use ;
use main;
async