Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for official mysql 8 packages #212

Conversation

waynegemmell
Copy link
Contributor

I've added support for the official mysql 8.0 packages and the relevant repositories.
Package names are mysql-community-server and mysql-community-client.
I know the repo setting breaks convention a bit but it is compulsory so I'm not sure how else to properly include it.

This change requires the salt pull request I created saltstack/salt#51240 to be able to grant users.

I've added support for the official mysql 8.0 packages and the relevant repositories.
Package names are mysql-community-server and mysql-community-client.
I know the repo setting breaks convention a bit but it is compulsory so I'm not sure how else to properly include it.

This change requires the salt pull request I created saltstack/salt#51240 to be able to grant users.
mysql/server.sls Outdated
mysql_password_debconf:
debconf.set:
- name: mysql-server
- name: {{ mysql.serverpkg }}
Copy link
Member

@aboe76 aboe76 Jan 18, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wasn't there an issue with mariadb-server which has the same debconf settings as mysql-server?
see: #160

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll revert that change, it wasn't really necessary after I realised that mysql-community-server has it's own set of debconf settings.

@noelmcloughlin
Copy link
Member

In #186 I added standardized mapping files but unfortunately skipped the codenamemap.yaml. This PR suggests its needed.

Hi @waynegemmell any chance you could introduce a codenamemap.yaml for this PR?

@waynegemmell
Copy link
Contributor Author

I'll have a look at the codenamemap.yaml. Not sure what that entails. I'll let you know if I can't come right.

@waynegemmell
Copy link
Contributor Author

Sorry, can you please explain the purpose of the codenamemap.yaml file in this context?

@noelmcloughlin
Copy link
Member

I understand the purpose of the codenamemap is to handle OS release specific differences. So if you need to handle an official repo from some distro this method scales best.

                merge=salt['grains.filter_by'](
                    osfamilymap,
                    grain='os_family',
                    merge=salt['grains.filter_by'](
                        oscodenames,
                        grain='oscodename',
                        merge=salt['pillar.get']

Here are three examples of implementations people done.

$ for f in $( find . | grep codenamemap ); do echo $f;cat $f; done


./docker-formula/docker/codenamemap.yaml
# vim: sts=2 ts=2 sw=2 et ai

wheezy:
  kernel:
    pkg:
      name: linux-image-amd64
      fromrepo: wheezy-backports
    pkgrepo:
      name: deb http://http.debian.net/debian wheezy-backports main
      humanname: Wheezy Backports
      dist: wheezy-backports
    pkgs: []

jessie:
  kernel:
    pkg:
      name: linux-image-amd64
      fromrepo: jessie-backports
    pkgrepo:
      name: deb http://http.debian.net/debian jessie-backports main
      humanname: Jessie Backports
      dist: jessie-backports
    pkgs: []

trusty:
  kernel:
    pkgs:
      - linux-image-extra-virtual
      - linux-image-extra-{{ grains.kernelrelease }}

precise:
  kernel:
    pkgs:
      - linux-image-generic-lts-raring
      - linux-headers-generic-lts-raring

./postgres-formula/postgres/codenamemap.yaml
### Set parameters based on PostgreSQL version supplied with particular distro

{% import_yaml "postgres/repo.yaml" as repo %}
  {# Generate lookup dictionary map for OS and derivative distributions
    name: distro codename
    version: PostgreSQL release version
    codename: optional grain value if `name` does not match the one returned by `oscodename` grain
  #}

{% macro debian_codename(name, version, codename=none) %}

  {% if repo.use_upstream_repo == true %}
    {% set version = repo.version %}
    {% set fromrepo = repo.fromrepo|default(name ~ '-pgdg', true) %}
  {% else %}
    {% set fromrepo = name %}
  {% endif %}
  {% set cluster_name = repo.cluster_name %}
  {% set conf_dir = '/etc/postgresql/{0}/{1}'.format(version, cluster_name) %}
  {% set data_dir = '/var/lib/postgresql/{0}/{1}'.format(version, cluster_name) %}

{{ codename|default(name, true) }}:
  # PostgreSQL packages are mostly downloaded from `main` repo component
  conf_dir: {{ conf_dir }}
  data_dir: {{ data_dir }}
  fromrepo: {{ fromrepo }}
  pkg_repo:
    name: 'deb http://apt.postgresql.org/pub/repos/apt {{ name }}-pgdg main'
  pkg: postgresql-{{ version }}
  pkg_client: postgresql-client-{{ version }}
  prepare_cluster:
    pgcommand: pg_createcluster {{ version }} {{ cluster_name }} -d
    user: root

{% endmacro %}


{% macro fedora_codename(name, version, codename=none) %}

  {# use upstream version if configured #}
  {% if repo.use_upstream_repo == true %}
    {% set version = repo.version %}
  {% endif %}

{{ codename|default(name, true) }}:
  # PostgreSQL packages are mostly downloaded from `main` repo component
  pkg_repo:
    baseurl: 'https://download.postgresql.org/pub/repos/yum/{{ version }}/fedora/fedora-$releasever-$basearch'

{% endmacro %}

## Debian GNU/Linux
{{ debian_codename('wheezy', '9.1') }}
{{ debian_codename('jessie', '9.4') }}
{{ debian_codename('stretch', '9.6') }}

# `oscodename` grain has long distro name
# if `lsb-release` package not installed
{{ debian_codename('wheezy', '9.1', 'Debian GNU/Linux 7 (wheezy)') }}
{{ debian_codename('jessie', '9.4', 'Debian GNU/Linux 8 (jessie)') }}
{{ debian_codename('stretch', '9.6', 'Debian GNU/Linux 9 (stretch)') }}

## Ubuntu
{{ debian_codename('trusty', '9.3') }}
{{ debian_codename('xenial', '9.5') }}
{{ debian_codename('artful', '9.6') }}
{{ debian_codename('bionic', '10') }}
{{ debian_codename('cosmic', '10') }}

## Fedora
# `oscodename` grain has long distro name
{{ fedora_codename('Fedora-27', '9.6', 'Fedora 27 (Twenty Seven)') }}
{{ fedora_codename('Fedora-26', '9.6', 'Fedora 26 (Twenty Six)') }}

# vim: ft=sls

./tomcat-formula/tomcat/codenamemap.yaml
trusty:
  ver: 7
  pkg: tomcat7
  manager_pkg: tomcat7-admin
  conf_dir: /etc/tomcat7
  main_config: /etc/default/tomcat7
  main_config_template: salt://tomcat/files/tomcat-default-Debian.template
  service: tomcat7
  user: tomcat7
  group: tomcat7
wheezy:
  pkg: tomcat7
  manager_pkg: tomcat7-admin
  conf_dir: /etc/tomcat7
  main_config: /etc/default/tomcat7
  main_config_template: salt://tomcat/files/tomcat-default-Debian.template
  service: tomcat7
  user: tomcat7
  group: tomcat7

Copy link
Member

@noelmcloughlin noelmcloughlin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs some work to fix conflicts.

@noelmcloughlin
Copy link
Member

I fixed the conflicts and merging. This PR is causing a backlog.

@noelmcloughlin noelmcloughlin merged commit b2821d5 into saltstack-formulas:master Dec 3, 2020
@saltstack-formulas-travis

🎉 This PR is included in version 0.55.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants