From 77a69515fb3437b23615f7ac644b4fa97abcec31 Mon Sep 17 00:00:00 2001 From: Nurlan Moldomurov Date: Tue, 19 Sep 2023 09:56:41 +0300 Subject: [PATCH 1/2] PMM-7 Fix UI upgrade. --- update/ansible/playbook/tasks/update.yml | 46 ++++++++++++------------ 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/update/ansible/playbook/tasks/update.yml b/update/ansible/playbook/tasks/update.yml index eb5b440227..ffddbc123e 100644 --- a/update/ansible/playbook/tasks/update.yml +++ b/update/ansible/playbook/tasks/update.yml @@ -397,6 +397,29 @@ - /etc/yum/yum-cron-hourly.conf - /etc/yum/yum-cron.conf + - name: Check that the SQLite grafana database exists + stat: + path: /srv/grafana/grafana.db + register: is_database_sqlite + + - name: Migrate Grafana database from SQLite to Postgresql + include_role: + name: sqlite-to-postgres + when: is_database_sqlite.stat.exists + tags: + - skip_ansible_lint # '503 Tasks that run when changed should likely be handlers'. + + - name: Fix grafana fields type + postgresql_query: + db: grafana + query: "{{ item }}" + loop: + - ALTER TABLE tag ALTER COLUMN key TYPE text; + - ALTER TABLE tag ALTER COLUMN value TYPE text; + - ALTER TABLE api_key ALTER COLUMN key TYPE text; + - ALTER TABLE api_key ALTER COLUMN name TYPE text; + when: not ansible_check_mode + # Regenerating to enable pmm-update-perform-init - name: Generate new supervisor config command: pmm-managed-init @@ -430,29 +453,6 @@ - name: Print other services's logs debug: var=update_result.stdout_lines - - name: Check that the SQLite grafana database exists - stat: - path: /srv/grafana/grafana.db - register: is_database_sqlite - - - name: Migrate Grafana database from SQLite to Postgresql - include_role: - name: sqlite-to-postgres - when: is_database_sqlite.stat.exists - tags: - - skip_ansible_lint # '503 Tasks that run when changed should likely be handlers'. - - - name: Fix grafana fields type - postgresql_query: - db: grafana - query: "{{ item }}" - loop: - - ALTER TABLE tag ALTER COLUMN key TYPE text; - - ALTER TABLE tag ALTER COLUMN value TYPE text; - - ALTER TABLE api_key ALTER COLUMN key TYPE text; - - ALTER TABLE api_key ALTER COLUMN name TYPE text; - when: not ansible_check_mode - - name: Wait for PMM to be ready ansible.builtin.uri: url: "http://127.0.0.1:7772/v1/readyz" From e2d31c64b4ca4af24055c937a4ca85c5971b22ba Mon Sep 17 00:00:00 2001 From: Nurlan Moldomurov Date: Tue, 19 Sep 2023 09:59:27 +0300 Subject: [PATCH 2/2] PMM-7 Fix UI upgrade. --- .../ansible/playbook/tasks/roles/initialization/tasks/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/update/ansible/playbook/tasks/roles/initialization/tasks/main.yml b/update/ansible/playbook/tasks/roles/initialization/tasks/main.yml index 15cba26e6f..2476b13d68 100644 --- a/update/ansible/playbook/tasks/roles/initialization/tasks/main.yml +++ b/update/ansible/playbook/tasks/roles/initialization/tasks/main.yml @@ -173,6 +173,6 @@ state: absent path: /usr/share/pmm-server/maintenance/maintenance.html # We use current_version_file['failed'] because we don't want to run this on creating container - when: not ui_upgrade and current_version_file['failed'] == false + when: not ui_upgrade and current_version_file['failed'] == false and not pmm_current_version is version(pmm_image_version, '>=')