MySQL
Databases are automatically provisioned for each environment.
Developers are allowed to provision multiple MySQL databases per environment.
Usage
The following example demonstrates how a D8 upgrade project might provision two databases to test migrations:
- Default database for the application.
- Secondary database containing D7 version of the site.
.skpr/defaults.yml
services:
mysql:
default:
image:
schedule: "0 20 * * *"
suspend: false
migrate_d7:
image:
schedule: "0 20 * * *"
suspend: false
Apply this configuration by running skpr deploy
.
Config
The Skpr platform provides connection details via the config system.
$ skpr config list prod
──────────────────────── ─────────────────────────────────────────────────────────────────────────────
KEY (20) VALUE
──────────────────────── ─────────────────────────────────────────────────────────────────────────────
mysql.default.ca.crt /etc/skpr/certs/mysql.default.ca.crt
mysql.default.database xxxxxxxxxxxx
mysql.default.hostname xxxxxx.yyyyyy.ap-southeast-2.rds.amazonaws.com
mysql.default.password [secret]
mysql.default.port 3306
mysql.default.readonly xxxxxx.yyyyyy.ap-southeast-2.rds.amazonaws.com
mysql.default.username [secret]
──────────────────────── ─────────────────────────────────────────────────────────────────────────────
Read-only Endpoint
Skpr provides a read-only endpoint which can we used for database intensive queries.
Scenarios might include:
- Analytics
- Dashboards
- Backups
This endpoint is provided by the mysql.*.readonly
config.
More Information
$ skpr mysql --help
usage: skpr mysql <command> [<args> ...]
MySQL commands
Flags:
--help Show context-sensitive help (also try --help-long and --help-man).
Subcommands:
mysql pull <environment>
Pulls a database image associated with an environment.
mysql create <environment>
Creates a new database image for an environment.