Flux - set of continuous and progressive delivery solutions for Kubernetes
Database
Managed solution
Aidbox supports all popular managed Postgresql databases. Supported versions - 13 and higher. See more details in this article — Run Aidbox on managed PostgreSQL.
For a self-managed solution, we recommend using the AidboxDB image. This image contains all required extensions, backup tools, and pre-build replication support. Read more information in the documentation — AidboxDB.
To streamline the deployment process, our DevOps engineers have prepared Helm charts that you may find helpful.
First step — create volume
Persistent Volume
apiVersion:v1kind:PersistentVolumeClaimmetadata:name:db-master-datanamespace:prodspec:accessModes: - ReadWriteOnceresources:requests:storage:300Gi# depend on your cloud provider. Use SSD volumesstorageClassName:managed-premium
Next - create all required configs, like postgresql.conf, required container parameters and credentials.
For backups and WAL archiving we recommend a cloud-native solution WAL-G. Full information about its configuration and usage is on this documentation page.
Configure storage access — WAL-G can store backups in S3, Google Cloud Storage, Azure, or a local file system.
Recommended backup policy — Full backup every week, incremental backup every day.
Alternative solutions
A set of tools to perform HA PostgreSQL with fail and switchover, automated backups.
Patroni — A Template for PostgreSQL HA with ZooKeeper, ETCD or Consul.
Postgres operator — The Postgres Operator delivers an easy-to-run HA PostgreSQL clusters on Kubernetes.
You might want to use the Helm charts prepared by our DevOps engineers to make the deployment experience smoother.
Create ConfigMap with all required config and database connection
This ConfigMap example uses our default Aidbox Configuration Project Template. It's recommended to clone this template and bind your Aidbox installation with it.
apiVersion:v1kind:Secretmetadata:name:aidboxnamespace:proddata:AIDBOX_ADMIN_PASSWORD:<admin_password>AIDBOX_CLIENT_SECRET:<root_client_password>AIDBOX_LICENSE:<JWT-LICENSE># JWT license from the Aidbox user portalPGUSER:<db_user># database usernamePGPASSWORD:<db_password># database passwordBOX_AUTH_KEYS_SECRET:<random_string_auth_secret>BOX_AUTH_KEYS_PRIVATE:<rsa_private_key>BOX_AUTH_KEYS_PUBLIC:<rsa_public_key># or just use our samples for non-production installation# BOX_AUTH_KEYS_SECRET: "auth-key-secret" # BOX_AUTH_KEYS_PRIVATE: "-----BEGIN RSA PRIVATE KEY-----\nMIICXAIB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dridDFSHkkplJFjDuQbYjfQzb\nSNECA31ME/GI9rGomQIDAQAB\n-----END PUBLIC KEY-----\n"
When Aidbox starts for the first time, resolving all the dependencies takes longer. If you encounter startupProbe failure, you might want to consider increasing the initialDelaySeconds and failureThreshold under the startupProbe spec in the config above.
All additional information about HA Aidbox configuration can be found in this article — HA Aidbox.
To verify that Aidbox started correctly you can check the logs:
To provide a secure HTTPS connection you can use paid SSL certificates, issued for your domain, or use LetsEncrypt-issued certificates. In the case of using LetsEcrypt, we recommend installing and configuring Cert Manager Operator
Install Cert Manager
helmrepoaddjetstackhttps://charts.jetstack.iohelmrepoupdatehelminstall \cert-managerjetstack/cert-manager \--namespacecert-manager \--create-namespace \--versionv1.10.0 \ # Or latest available version--setinstallCRDs=true
Configure Cluster Issuer:
apiVersion:cert-manager.io/v1kind:ClusterIssuermetadata:name:letsencryptspec:acme:email:hello@my-domain.compreferredChain:''privateKeySecretRef:name:issuer-keyserver:https://acme-v02.api.letsencrypt.org/directorysolvers: - http01:ingress:class:nginx# Ingress class name
If you use Multibox image and want to use cert manger — you should configure DNS01 authorization to provide wildcard certificates
pg_exporter — Prometheus exporter for PostgreSQL server metrics
Alerting
Alerting rules allow you to define alert conditions based on Prometheus expression language expressions and to send notifications about firing alerts to an external service.
Alert rules
Alert for long-running HTTP queries with P99 > 5s in 5m interval