quinzee.cloud

Development edition · 16 November 2026. Commands using repository paths, Make targets or sample projects require access to the Quinzee source checkout. No public installer is available. Examples use disposable local environments.

Developer’s guide

10. Use PostgreSQL, MySQL and Redis

Quinzee provisions real PostgreSQL 18, MySQL 8.4 and Valkey servers. ARM/Bicep manages their lifecycle; native clients execute SQL or Redis commands. Npgsql, MySqlConnector and StackExchange.Redis are independent .NET libraries, not Microsoft Azure management SDKs.

Complete chapters 5, 6 and 8 first. Keep the application environment terminal running: the supervisor reconciles engines and serves their signed certificate revocation list. The SDK container trusts the engine CA and can resolve the hostnames in outputs.json. Database ports are not published on the host.

Step 1: insert a document into PostgreSQL

Replace Program.cs and run it:

using Azure.Security.KeyVault.Secrets;
using Azure.Storage.Blobs;
using Npgsql;

var book = BookContext.Load();
var outputs = book.Outputs();
var vault = new SecretClient(new Uri(outputs["vaultEndpoint"]), book.Credential);
var password = (await vault.GetSecretAsync("database-password")).Value.Value;
var blob = new BlobClient(new Uri(new Uri(outputs["blobEndpoint"]), "documents/hello.txt"), book.Credential);
var body = (await blob.DownloadContentAsync()).Value.Content.ToString();
var options = new NpgsqlConnectionStringBuilder
{
    Host = outputs["postgresHost"], Database = "application", Username = "appadmin",
    Password = password, SslMode = SslMode.VerifyFull,
    RootCertificate = "/run/book/engine-ca.crt", Timeout = 15, CommandTimeout = 15
};
await using var connection = new NpgsqlConnection(options.ConnectionString);
await connection.OpenAsync();
await using (var create = new NpgsqlCommand(
    "CREATE TABLE IF NOT EXISTS book_documents (id varchar(64) PRIMARY KEY, body text NOT NULL)", connection))
    await create.ExecuteNonQueryAsync();
await using (var insert = new NpgsqlCommand(
    "INSERT INTO book_documents(id,body) VALUES (@id,@body) ON CONFLICT(id) DO UPDATE SET body=EXCLUDED.body", connection))
{
    insert.Parameters.AddWithValue("id", "hello");
    insert.Parameters.AddWithValue("body", body);
    await insert.ExecuteNonQueryAsync();
}
await using var read = new NpgsqlCommand("SELECT body FROM book_documents WHERE id=@id", connection);
read.Parameters.AddWithValue("id", "hello");
Console.WriteLine(await read.ExecuteScalarAsync());

Expect Hello from Quinzee.. The primary key and upsert make repeated delivery of this example work item safe. Values are SQL parameters; never concatenate a queue message or document into SQL text. VerifyFull validates both the certificate chain and hostname.

Step 2: do the same with MySQL

Replace Program.cs with:

using Azure.Security.KeyVault.Secrets;
using Azure.Storage.Blobs;
using MySqlConnector;

var book = BookContext.Load();
var outputs = book.Outputs();
var vault = new SecretClient(new Uri(outputs["vaultEndpoint"]), book.Credential);
var password = (await vault.GetSecretAsync("database-password")).Value.Value;
var blob = new BlobClient(new Uri(new Uri(outputs["blobEndpoint"]), "documents/hello.txt"), book.Credential);
var body = (await blob.DownloadContentAsync()).Value.Content.ToString();
var options = new MySqlConnectionStringBuilder
{
    Server = outputs["mysqlHost"], Database = "application", UserID = "appadmin",
    Password = password, SslMode = MySqlSslMode.VerifyFull,
    SslCa = "/run/book/engine-ca.crt", ConnectionTimeout = 15, DefaultCommandTimeout = 15
};
await using var connection = new MySqlConnection(options.ConnectionString);
await connection.OpenAsync();
await using (var create = new MySqlCommand(
    "CREATE TABLE IF NOT EXISTS book_documents (id varchar(64) PRIMARY KEY, body text NOT NULL)", connection))
    await create.ExecuteNonQueryAsync();
await using (var insert = new MySqlCommand(
    "INSERT INTO book_documents(id,body) VALUES (@id,@body) ON DUPLICATE KEY UPDATE body=@body", connection))
{
    insert.Parameters.AddWithValue("id", "hello");
    insert.Parameters.AddWithValue("body", body);
    await insert.ExecuteNonQueryAsync();
}
await using var read = new MySqlCommand("SELECT body FROM book_documents WHERE id=@id", connection);
read.Parameters.AddWithValue("id", "hello");
Console.WriteLine(await read.ExecuteScalarAsync());

MySqlConnector retains certificate revocation checks. A TLS failure after the supervisor has been stopped can therefore be a CRL availability problem, even if the database container itself is still running. Restart the supervisor; do not replace validation with an always-true callback.

Step 3: cache a result through the Redis protocol

Replace Program.cs with:

using StackExchange.Redis;

var book = BookContext.Load();
var outputs = book.Outputs();
using var keys = await book.PostArmAsync(
    $"Microsoft.Cache/redisEnterprise/{book.Settings.Prefix}-cache/databases/default/listKeys",
    "2025-04-01");
var options = new ConfigurationOptions
{
    Ssl = true, SslHost = outputs["cacheHost"],
    Password = keys.RootElement.GetProperty("primaryKey").GetString(),
    AbortOnConnectFail = true, ConnectTimeout = 10000,
    SyncTimeout = 10000, AsyncTimeout = 10000
};
options.EndPoints.Add(outputs["cacheHost"], 10000);
using var connection = await ConnectionMultiplexer.ConnectAsync(options);
var cache = connection.GetDatabase();
await cache.StringSetAsync("book:hello:status", "processed", TimeSpan.FromMinutes(5));
Console.WriteLine(await cache.StringGetAsync("book:hello:status"));

Expect processed. The access key stays in memory; the connection verifies the server name and uses the public CA bundle mounted in chapter 3. Treat a cache miss as a normal case and recover from your authoritative data store.

Step 4: manage lifecycle and data

Use QHQ Databases and cache → PostgreSQL/MySQL to inspect servers and children and request start, stop or restart. ARM supports the corresponding operations. A provisioning operation waits for real native-client readiness; if the supervisor cannot complete it within 180 seconds, it fails explicitly. Fix the underlying issue and resubmit rather than assuming that an ARM object means the database is already ready.

SQL stop and restart preserve data. Resource deletion removes the labelled data volume. A resource-group deletion is therefore destructive even if the engine is currently stopped. The application helper's Ctrl+C shutdown preserves native volumes for its next start; a standalone engine helper's Ctrl+C leaves its engine containers running, so manage those resources explicitly.

Each engine has local Docker limits of 1 GiB RAM, two CPUs and 256 processes. SKU names are metadata, not simulated Azure performance. No HA, replicas, backup/restore, engine upgrades, administrator credential rotation or managed- identity SQL login is implemented. The cache uses databases/default, encrypted connections and NoCluster; it is not a Redis cluster test environment.