added clickhouse-backup state
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
6e410e9123
commit
046de339c8
14
states/clickhouse-backup/config.sls
Normal file
14
states/clickhouse-backup/config.sls
Normal file
@ -0,0 +1,14 @@
|
||||
---
|
||||
{%- from "clickhouse-backup/map.jinja" import clickhousebackup with context %}
|
||||
clickhouse-backup-config-dir:
|
||||
file.directory:
|
||||
- name: {{ clickhousebackup.config_dir }}
|
||||
- user: root
|
||||
- group: root
|
||||
- mode: 700
|
||||
|
||||
clickhouse-backup-config-file:
|
||||
file.managed:
|
||||
- name: {{ clickhousebackup.config_dir }}/config.yml
|
||||
- source: salt://clickhouse-backup/templates/config.yml.j2
|
||||
- template: jinja
|
28
states/clickhouse-backup/defaults.yaml
Normal file
28
states/clickhouse-backup/defaults.yaml
Normal file
@ -0,0 +1,28 @@
|
||||
---
|
||||
clickhouse-backup:
|
||||
enabled: true
|
||||
release_dir: /usr/local/apps/releases
|
||||
install_dir: /usr/local/apps
|
||||
mirror: https://github.com/Altinity/clickhouse-backup/releases/download
|
||||
config_dir: /etc/clickhouse-backup
|
||||
version: 2.4.14
|
||||
os: linux
|
||||
arch: x64
|
||||
config:
|
||||
general:
|
||||
disable_progress_bar: false
|
||||
backups_to_keep_local: 3
|
||||
backups_to_keep_remote: 7
|
||||
#remote_storage: custom
|
||||
#use_embedded_backup_restore: true
|
||||
use_resumable_state: false
|
||||
restore_as_attach: false
|
||||
restore_database_mapping: {}
|
||||
clickhouse:
|
||||
host: localhost
|
||||
port: 9000
|
||||
username: default
|
||||
password: ""
|
||||
sync_replicated_tables: true
|
||||
timeout: 5s
|
||||
restart_command: "sql:SYSTEM RELOAD USERS; sql:SYSTEM RELOAD CONFIG; sql:SYSTEM SHUTDOWN"
|
4
states/clickhouse-backup/init.sls
Normal file
4
states/clickhouse-backup/init.sls
Normal file
@ -0,0 +1,4 @@
|
||||
---
|
||||
include:
|
||||
- .install
|
||||
- .config
|
38
states/clickhouse-backup/install.sls
Normal file
38
states/clickhouse-backup/install.sls
Normal file
@ -0,0 +1,38 @@
|
||||
---
|
||||
{%- from "clickhouse-backup/map.jinja" import clickhousebackup with context %}
|
||||
clickhouse-backup-archive-extract:
|
||||
archive.extracted:
|
||||
- name: {{ clickhousebackup.release_dir }}/clickhouse-backup-{{ clickhousebackup.version }}
|
||||
- source: {{ clickhousebackup.mirror }}/v{{ clickhousebackup.version }}/clickhouse-backup-{{ clickhousebackup.os }}-{{ clickhousebackup.arch }}.tar.gz
|
||||
- enforce_toplevel: false
|
||||
- options: >
|
||||
--strip 3
|
||||
- skip_verify: true
|
||||
- archive_format: tar
|
||||
- if_missing: {{ clickhousebackup.release_dir }}/clickhouse-backup-{{ clickhousebackup.version }}/clickhouse-backup
|
||||
|
||||
clickhouse-backup-bin-perm:
|
||||
file.managed:
|
||||
- name: {{ clickhousebackup.release_dir }}/clickhouse-backup-{{ clickhousebackup.version }}/clickhouse-backup
|
||||
- user: root
|
||||
- group: root
|
||||
- replace: False
|
||||
- require:
|
||||
- archive: clickhouse-backup-archive-extract
|
||||
|
||||
clickhouse-backup-bin-symlink:
|
||||
file.symlink:
|
||||
- name: /usr/local/sbin/clickhouse-backup
|
||||
- target: {{ clickhousebackup.release_dir }}/clickhouse-backup-{{ clickhousebackup.version }}/clickhouse-backup
|
||||
- user: root
|
||||
- group: root
|
||||
- mode: 0755
|
||||
- force: true
|
||||
- require:
|
||||
- archive: clickhouse-backup-archive-extract
|
||||
|
||||
clickhouse-backup-cleanup:
|
||||
software.cleanup:
|
||||
- name: clickhouse-backup
|
||||
- path: {{ clickhousebackup.release_dir }}
|
||||
- version: "{{ clickhousebackup.version }}"
|
3
states/clickhouse-backup/kernelmap.yaml
Normal file
3
states/clickhouse-backup/kernelmap.yaml
Normal file
@ -0,0 +1,3 @@
|
||||
---
|
||||
Linux:
|
||||
os: "linux"
|
14
states/clickhouse-backup/map.jinja
Normal file
14
states/clickhouse-backup/map.jinja
Normal file
@ -0,0 +1,14 @@
|
||||
{%- import_yaml "clickhouse-backup/defaults.yaml" as default_settings -%}
|
||||
|
||||
{%- import_yaml "clickhouse-backup/kernelmap.yaml" as kernelmap -%}
|
||||
{%- import_yaml "clickhouse-backup/osarchmap.yaml" as osarchmap -%}
|
||||
|
||||
{%- set defaults = salt['grains.filter_by'](default_settings,
|
||||
default='clickhouse-backup',
|
||||
merge=salt['grains.filter_by'](osarchmap, grain='osarch',
|
||||
merge=salt['grains.filter_by'](kernelmap, grain='kernel')
|
||||
)
|
||||
)
|
||||
-%}
|
||||
|
||||
{%- set clickhousebackup = salt['pillar.get']('clickhouse-backup', default=defaults, merge=True) -%}
|
24
states/clickhouse-backup/osarchmap.yaml
Normal file
24
states/clickhouse-backup/osarchmap.yaml
Normal file
@ -0,0 +1,24 @@
|
||||
---
|
||||
amd64:
|
||||
arch: "amd64"
|
||||
|
||||
x86_64:
|
||||
arch: "amd64"
|
||||
|
||||
386:
|
||||
arch: "386"
|
||||
|
||||
arm64:
|
||||
arch: "arm64"
|
||||
|
||||
aarch64:
|
||||
arch: "arm64"
|
||||
|
||||
armv6l:
|
||||
arch: "arm"
|
||||
|
||||
armv7l:
|
||||
arch: "arm"
|
||||
|
||||
armhf:
|
||||
arch: "arm"
|
4
states/clickhouse-backup/templates/config.yml.j2
Normal file
4
states/clickhouse-backup/templates/config.yml.j2
Normal file
@ -0,0 +1,4 @@
|
||||
{%- from "clickhouse-backup/map.jinja" import clickhousebackup with context -%}
|
||||
# {{ salt['pillar.get']('salt_managed', default='Salt Managed') }}
|
||||
---
|
||||
{{ clickhousebackup.config|yaml(False) }}
|
Loading…
Reference in New Issue
Block a user