Provisioning a Scalingo for PostgreSQL® Dedicated Resources Database
Once you have chosen the right plan for your needs, you are ready to provision the database. This can be done via our dashboard, our CLI tool, our Terraform Provider, or via our Kubernetes Operator.
Provisioning
Using the Dashboard
- From your web browser, open your dashboard
- Select the Project where you want to create the database
- Click the arrow next to Create an application, then click Database Dedicated Resources
- In the Databases engines section, select PostgreSQL Dedicated Resources and confirm your choice
- Enter a database name, then select or confirm the appropriate Project and Region
- Select the plan you want to provision and confirm your selection
- Click the Create database button
- Database provisioning typically takes 15–30 minutes
Using the Command Line (Preview)
Because Dedicated Resources databases are not yet generally available, you must first enable preview features to use the related CLI commands:
export SCALINGO_PREVIEW_FEATURES=true
- Make sure you have correctly setup the Scalingo command line tool
- From the command line, list the plans available for
postgresql-ng:scalingo database-list-plans postgresql-ngThe output should look like this:
┌─────────────────────────────────┬─────────────────┐ │ ID │ NAME │ ├─────────────────────────────────┼─────────────────┤ │ postgresql-dr-starter-4096 │ Starter 4G │ │ postgresql-dr-starter-8192 │ Starter 8G │ │ postgresql-dr-starter-16384 │ Starter 16G │ ... - Locate the
IDcorresponding to the plan you want to deploy (for examplepostgresql-dr-starter-4096) - Provision the database:
scalingo database-create --type postgresql-ng --plan <plan_ID> <database_name>The output should look like this:
-----> Your postgresql-ng database 698e082f968c27dfb8a27521 ('my-dedicated-database') is being provisioned… - Database provisioning typically takes 15–30 minutes
Optionally you can use --wait in order to make the command synchronous.
scalingo database-create --type postgresql-ng --plan <plan_ID> --wait <database_name>
Using the Terraform Provider
- Place the following
resourceblock in your Terraform file to create the database and attach it to your app:resource "scalingo_database" "my-dedicated-database" { name = "my-dedicated-database" technology = "postgresql-ng" plan = "postgresql-dr-starter-4096" }In this example, we create a dedicated PostgreSQL Starter 4096 database named
my-dedicated-database. We could have done the same with another plan. - Run
terraform planand check if the result looks good - If so, run
terraform apply - Database provisioning typically takes 15–30 minutes
Using the Kubernetes Operator
- Deploy the Scalingo Kubernetes Operator in your cluster
using the installation manifest
install.yamlfrom the latest release. - Create a Scalingo API token and store it in a Kubernetes Secret, as documented in Create Secret.
- Create a custom resource to provision your dedicated PostgreSQL database:
apiVersion: databases.scalingo.com/v1alpha1 kind: PostgreSQL metadata: labels: app.kubernetes.io/name: scalingo-operator app.kubernetes.io/managed-by: kustomize name: my-dedicated-database spec: # Secret read by operator authSecret: name: scalingo key: api_token # Secret written by operator connInfoSecretTarget: name: my-dedicated-database-secret prefix: PG name: my-dedicated-database plan: postgresql-dr-starter-4096 region: osc-fr1This example provisions a dedicated PostgreSQL database named
my-dedicated-databaseon thepostgresql-dr-starter-4096plan and writes its connection information to themy-dedicated-database-secretKubernetes Secret. You can use anotherpostgresql-dr-*plan instead. - Apply the resource and wait for provisioning to complete:
kubectl apply -f my-dedicated-database.yaml - Database provisioning typically takes 15–30 minutes
To read the database URL from the generated secret:
kubectl describe secret my-dedicated-database-secret
kubectl get secret my-dedicated-database-secret -o jsonpath='{.data}' | grep PG
For a complete manifest (including all available fields), use the official PostgreSQL sample resource.
Accessing the Scalingo for PostgreSQL® Dashboard
Every PostgreSQL® database comes with its dedicated dashboard, generally referred to as database dashboard, which is the central place for administrative tasks such as:
- Monitoring the database through logs, metrics and statistics
- Upgrading the database engine version
- Enabling specific features
- Managing database users
- Managing Collaborators
- Managing backups
You can access the database dashboard from the main dashboard:
- From your web browser, open your dashboard
- Open the Project containing the database you want to manage
- In the Databases section, click the database name