Update to 2022-03-15 15:00

This commit is contained in:
Daniel Berteaud 2022-03-15 15:00:07 +01:00
parent 9f0d84a006
commit b9d7ee0d76
10 changed files with 114 additions and 8 deletions

View File

@ -1,11 +1,11 @@
---
# Version to install
gitea_version: 1.16.3
gitea_version: 1.16.4
# URL to the binary
gitea_bin_url: https://dl.gitea.io/gitea/{{ gitea_version }}/gitea-{{ gitea_version }}-linux-amd64
# sha256 of the binary
gitea_bin_sha256: ae6af3a29aa2e7420fb7dc7f57e417b079d1d587387bb76f7193b7bf9716df26
gitea_bin_sha256: 49f2469a7aabe3f5dc432b2c967e2d2c6c5c4fad6aae4c1ab4197ebbd159ddd1
# Handle updates. If set to false, ansible will only install
# Gitea and then won't touch an existing installation
gitea_manage_upgrade: True

View File

@ -4,8 +4,12 @@
metabase_version: 0.42.2
# URL to fetch the jar
metabase_jar_url: https://downloads.metabase.com/v{{ metabase_version }}/metabase.jar
# Expected sha1 of the jar
# Expected sha256 of the jar
metabase_jar_sha256: d74f9b67a0017ffa377dbaad2426bd02cff2af72b69982d8b3f2c1596fe1455f
# When building from source
metabase_archive_url: https://github.com/metabase/metabase/archive/refs/tags/v{{ metabase_version }}.tar.gz
# Expected sha256 of the archive
metabase_archive_sha256: b99f84e3c4ff0ffaf2023dd522a668fcbe8d6352746cc8e8f62e01df7bd9d4d1
# Should ansible handle upgrades ? If set to false, only the initial install (and the config) will be handled
metabase_manage_upgrade: True
@ -54,3 +58,7 @@ metabase_public_url: http://{{ inventory_hostname }}:{{ metabase_port }}/
# Enable or disable big queries cache in metabase DB
metabase_enable_cache: True
# If defined, will override the default, hardcoded 2000 limit for the number of rows to send in email reports
# It'll rebuild metabase from source, with a patch applied, instead of just downloading the pre-built jar
# metabase_rows_limit: 20000

View File

@ -5,3 +5,7 @@ dependencies:
when: metabase_db_server in ['localhost','127.0.0.1'] and metabase_db_engine == 'mysql'
- role: postgresql_server
when: metabase_db_server in ['localhost','127.0.0.1'] and metabase_db_engine == 'postgres'
- role: nodejs
when: metabase_rows_limit is defined
- role: clojure
when: metabase_rows_limit is defined

View File

@ -3,6 +3,12 @@
- name: Remove tmp and unused files
file: path={{ item }} state=absent
loop:
- "{{ metabase_root_dir }}/archives/{{ metabase_current_version }}"
- "{{ metabase_root_dir }}/tmp/metabase.jar"
- "{{ metabase_root_dir }}/tmp/metabase-{{ metabase_version }}.tar.gz"
- "{{ metabase_root_dir }}/tmp/metabase-{{ metabase_version }}"
tags: metabase
- name: Remove archive tmp dir
file: path={{ metabase_root_dir }}/archives/{{ metabase_current_version }} state=absent
when: metabase_install_mode == 'upgrade'
tags: metabase

View File

@ -3,8 +3,14 @@
- name: Create needed directories
file: path={{ item.dir }} state=directory owner={{ item.owner | default(omit) }} group={{ item.group | default(omit) }} mode={{ item.mode | default(omit) }}
loop:
- dir: "{{ metabase_root_dir }}"
owner: "{{ metabase_user }}"
group: "{{ metabase_user }}"
- dir: "{{ metabase_root_dir }}/app"
- dir: "{{ metabase_root_dir }}/tmp"
owner: "{{ metabase_user }}"
group: "{{ metabase_user }}"
mode: 700
- dir: "{{ metabase_root_dir }}/data"
owner: "{{ metabase_user }}"
mode: 700

View File

@ -1,5 +1,14 @@
---
# Load distribution specific vars
- include_vars: "{{ item }}"
with_first_found:
- "{{ role_path }}/vars/{{ ansible_distribution }}-{{ ansible_distribution_major_version }}.yml"
- "{{ role_path }}/vars/{{ ansible_os_family }}-{{ ansible_distribution_major_version }}.yml"
- "{{ role_path }}/vars/{{ ansible_distribution }}.yml"
- "{{ role_path }}/vars/{{ ansible_os_family }}.yml"
tags: metabase
# Detect installed version (if any)
- block:
- import_tasks: ../includes/webapps_set_install_mode.yml

View File

@ -1,9 +1,7 @@
---
- name: Install dependencies
yum:
name:
- java-11-openjdk
yum: name={{ metabase_packages }}
tags: metabase
- name: Stop the service during upgrades
@ -11,7 +9,7 @@
when: metabase_install_mode == 'upgrade'
tags: metabase
- when: metabase_install_mode != 'none'
- when: metabase_install_mode != 'none' and metabase_rows_limit is not defined
block:
- name: Download metabase JAR file
get_url:
@ -25,6 +23,55 @@
tags: metabase
# When rows limit is supplied, download the source tarball and rebuild metabase from source
- when: metabase_install_mode != 'none' and metabase_rows_limit is defined
block:
- name: Install build dependencies
package: name={{ metabase_build_packages }}
- name: Download metabase archive
get_url:
url: "{{ metabase_archive_url }}"
dest: "{{ metabase_root_dir }}/tmp/"
checksum: sha256:{{ metabase_archive_sha256 }}
- name: Install yarn
npm:
name: yarn
global: True
- name: Extract metabase archive
unarchive:
src: "{{ metabase_root_dir }}/tmp/metabase-{{ metabase_version }}.tar.gz"
dest: "{{ metabase_root_dir }}/tmp/"
remote_src: True
- name: Render rows limit patch from template
template: src=metabase_rows_limit.diff.j2 dest={{ metabase_root_dir }}/tmp/metabase_rows_limit.diff
- name: Patch metabase to customize rows limit
patch:
src: "{{ metabase_root_dir }}/tmp/metabase_rows_limit.diff"
dest: "{{ metabase_root_dir }}/tmp/metabase-{{ metabase_version }}/src/metabase/query_processor/middleware/constraints.clj"
remote_src: True
- name: Ensure metabase user can write in the source tree
file: path={{ metabase_root_dir }}/tmp/metabase-{{ metabase_version }}/ owner={{ metabase_user }} recurse=True
- name: Build metabase uberjar
command: ./bin/build
args:
chdir: "{{ metabase_root_dir }}/tmp/metabase-{{ metabase_version }}/"
become_user: "{{ metabase_user }}"
- name: Move the freshly built JAR to the app dir
copy: src={{ metabase_root_dir }}/tmp/metabase-{{ metabase_version }}/target/uberjar/metabase.jar dest={{ metabase_root_dir }}/app/ mode=644 remote_src=True
notify: restart metabase
tags: metabase
- name: Deploy systemd unit
template: src=metabase.service.j2 dest=/etc/systemd/system/metabase.service
register: metabase_unit

View File

@ -0,0 +1,13 @@
diff --git a/src/metabase/query_processor/middleware/constraints.clj b/src/metabase/query_processor/middleware/constraints.clj
index 7602295804..0b43a8f3b3 100644
--- a/src/metabase/query_processor/middleware/constraints.clj
+++ b/src/metabase/query_processor/middleware/constraints.clj
@@ -4,7 +4,7 @@
(def ^:private max-results-bare-rows
"Maximum number of rows to return specifically on :rows type queries via the API."
- 2000)
+ {{ metabase_rows_limit }})
(def ^:private max-results
"General maximum number of rows to return from an API query."

View File

@ -0,0 +1,9 @@
---
metabase_packages:
- java-11-openjdk
metabase_build_packages:
- java-11-openjdk-devel
- patch
- nodejs

View File

@ -9,6 +9,10 @@
- /usr/local/lib/site_perl/Zabbix/Agent/Addons
tags: zabbix
- name: Install git
package: name=git
tags: zabbix
- name: Checkout Addons script
git:
repo: https://git.lapiole.org/dani/zabbix-agent-addons.git