Configure MySQL

Specify the version

The default version is 8.0.

To override the version, update the server’s Pillar file:

mysql:
  version: '8.0'

Add users, groups and databases

To configure the database for an application:

  1. Add a user for the application, in a private Pillar file, replacing PASSWORD with a strong password (uncheck Symbols) and USERNAME with a recognizable username:

    mysql:
      users:
        USERNAME:
          password: "PASSWORD"
    
  2. Create the database for the application and grant all privileges to the new user. Replace DATABASE and USERNAME:

    mysql:
      users:
        USERNAME:
          password: "PASSWORD"
      databases:
        DATABASE:
          user: USERNAME
    
  3. Add the private Pillar file to the top file entry for the application.

Configure MySQL

Note

Even if you don’t need to configure MySQL, you must still set the following, in order for its SLS file to be automatically included:

mysql:
  configuration: False
  1. Put your configuration file in the salt/mysql/files/conf directory.

  2. Set mysql.configuration in the server’s Pillar file:

    mysql:
      configuration: redmine
    
  3. Deploy the service

The configuration file will be in the /etc/mysql/conf.d directory on the server.

Set up backups

  1. Create and configure a S3 backup bucket

  2. Configure the AWS CLI

  3. Set mysql.backup.location in the server’s Pillar file, for example:

    mysql:
      backup:
        location: ocp-redmine-backups/database
    
  4. Deploy the service