Skip to content

Commit

Permalink
roles/all: make it easier to use enterprise version for binary deploy…
Browse files Browse the repository at this point in the history
…ments

- add configuration parameter to enable enterprise binaries
- add configuration parameters to provide license key
- add MoM vmagent for cluster integration molecule

Signed-off-by: Zakhar Bessarab <[email protected]>
  • Loading branch information
zekker6 committed May 21, 2024
1 parent 0b60888 commit 5f073ca
Show file tree
Hide file tree
Showing 62 changed files with 1,627 additions and 23 deletions.
78 changes: 73 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
init-venv:
python3 -m venv .venv
. .venv/bin/activate
pip install -r requirements.txt
python3 -m venv .venv; \
. .venv/bin/activate; \
pip install -r requirements.txt; \
ansible-galaxy collection install community.general==8.3.0

lint:
Expand Down Expand Up @@ -40,13 +40,47 @@ molecule-converge-vmauth:
make activate-venv; \
cd roles/vmauth && molecule converge

molecule-converge-single-enterprise:
make activate-venv; \
cd roles/single && molecule converge -s docker-enterprise

molecule-converge-vmagent-enterprise:
make activate-venv; \
cd roles/vmagent && molecule converge -s docker-enterprise

molecule-converge-vmalert-enterprise:
make activate-venv; \
cd roles/vmalert && molecule converge -s docker-enterprise

molecule-converge-vminsert-enterprise:
make activate-venv; \
cd roles/vminsert && molecule converge -s enterprise

molecule-converge-vmstorage-enterprise:
make activate-venv; \
cd roles/vmstorage && molecule converge -s enterprise

molecule-converge-vmselect-enterprise:
make activate-venv; \
cd roles/vmselect && molecule converge -s enterprise

molecule-converge-vmauth-enterprise:
make activate-venv; \
cd roles/vmauth && molecule converge -s enterprise

molecule-converge-cluster-integration:
make activate-venv; \
cd playbooks/ && molecule converge -s cluster

molecule-converge-cluster-integration-enterprise:
make activate-venv; \
cd playbooks/ && molecule converge -s cluster-enterprise

molecule-converge: molecule-converge-single molecule-converge-vmagent molecule-converge-vmalert molecule-converge-vminsert molecule-converge-vmstorage molecule-converge-vmselect molecule-converge-vmauth

molecule-converge-integration: molecule-converge-cluster-integration
molecule-converge-enterprise: molecule-converge-single-enterprise molecule-converge-vmagent-enterprise molecule-converge-vmalert-enterprise molecule-converge-vminsert-enterprise molecule-converge-vmstorage-enterprise molecule-converge-vmselect-enterprise molecule-converge-vmauth-enterprise

molecule-converge-integration: molecule-converge-cluster-integration molecule-converge-cluster-integration-enterprise

molecule-destroy-single:
make activate-venv; \
Expand Down Expand Up @@ -76,10 +110,44 @@ molecule-destroy-vmauth:
make activate-venv; \
cd roles/vmauth && molecule destroy

molecule-destroy-single-enterprise:
make activate-venv; \
cd roles/single && molecule destroy -s docker-enterprise

molecule-destroy-vmagent-enterprise:
make activate-venv; \
cd roles/vmagent && molecule destroy -s docker-enterprise

molecule-destroy-vmalert-enterprise:
make activate-venv; \
cd roles/vmalert && molecule destroy -s docker-enterprise

molecule-destroy-vminsert-enterprise:
make activate-venv; \
cd roles/vminsert && molecule destroy -s enterprise

molecule-destroy-vmstorage-enterprise:
make activate-venv; \
cd roles/vmstorage && molecule destroy -s enterprise

molecule-destroy-vmselect-enterprise:
make activate-venv; \
cd roles/vmselect && molecule destroy -s enterprise

molecule-destroy-vmauth-enterprise:
make activate-venv; \
cd roles/vmauth && molecule destroy -s enterprise

molecule-destroy-cluster-integration:
make activate-venv; \
cd playbooks/ && molecule destroy -s cluster

molecule-destroy-cluster-integration-enterprise:
make activate-venv; \
cd playbooks/ && molecule destroy -s cluster-enterprise

molecule-destroy: molecule-destroy-single molecule-destroy-vmagent molecule-destroy-vmalert molecule-destroy-vminsert molecule-destroy-vmstorage molecule-destroy-vmselect molecule-destroy-vmauth molecule-destroy-cluster-integration

molecule-destroy-integration: molecule-destroy-cluster-integration
molecule-destroy-enterprise: molecule-destroy-single-enterprise molecule-destroy-vmagent-enterprise molecule-destroy-vmalert-enterprise molecule-destroy-vminsert-enterprise molecule-destroy-vmstorage-enterprise molecule-destroy-vmselect-enterprise molecule-destroy-vmauth-enterprise molecule-destroy-cluster-integration

molecule-destroy-integration: molecule-destroy-cluster-integration molecule-destroy-cluster-integration-enterprise
117 changes: 117 additions & 0 deletions playbooks/molecule/cluster-enterprise/converge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
---
- name: Setup storage
become: true
hosts: vmstorage
vars:
vmstorage_enterprise: "true"
vmstorage_license_key: "fake"
vmstorage_config:
retentionPeriod: "12"
storageDataPath: "/var/lib/vmstorage"
dedup.minScrapeInterval: "1ms"
roles:
- vmstorage

- name: Setup vmselect
become: true
hosts: vmselect
vars:
vmselect_enterprise: "true"
vmselect_license_key: "fake"
vmselect_cache_dir: "/var/lib/vmselect"
vmselect_config:
cacheDataPath: "/var/lib/vmselect"
storageNode: "{{ groups['vmstorage'] | join(',') }}"
dedup.minScrapeInterval: 1ms
roles:
- vmselect

- name: Setup vminsert
become: true
hosts: vminsert
vars:
vminsert_enterprise: "true"
vminsert_license_key: "fake"
vminsert_config:
replicationFactor: 1
storageNode: "{{ groups['vmstorage'] | join(',') }}"
roles:
- vminsert

- name: Setup vmauth
become: true
hosts: vmauth
vars:
# See: https://docs.victoriametrics.com/vmauth/#load-balancer-for-victoriametrics-cluster
vmauth_auth_config: |-
unauthorized_user:
url_map:
- src_paths:
- "/insert/.+"
url_prefix:
{% for insert in groups['vminsert'] %}
- "http://{{ insert }}:8480/"
{% endfor %}
- src_paths:
- "/select/.+"
url_prefix:
{% for select in groups['vmselect'] %}
- "http://{{ select }}:8481/"
{% endfor %}
roles:
- vmauth

- name: Setup vmagent MoM
become: true
hosts: vmagent-mom
vars:
vmstorage_targets: [ ]
vminsert_targets: [ ]
vmselect_targets: [ ]

vmagent_mom_targets: [ ]
vmagent_enterprise: true
vmagent_license_key: "fake"
vmagent_service_args:
"remoteWrite.url": "http://{{ groups['vmauth'] | first }}:8427/insert/10/prometheus/api/v1/write"
"promscrape.config": "{{ vmagent_config_dir }}/config.yml"
"remoteWrite.tmpDataPath": "{{ vmagent_tmp_data_path }}"
vmagent_scrape_config:
scrape_configs:
- job_name: vmagent
static_configs:
- targets: "{{ vmagent_mom_targets }}"
- job_name: vmstorage
static_configs:
- targets: "{{ vmstorage_targets }}"

- job_name: vmselect
static_configs:
- targets: "{{ vmselect_targets }}"

- job_name: vminsert
static_configs:
- targets: "{{ vminsert_targets }}"
pre_tasks:
- name: Prepare vmstorage list
ansible.builtin.set_fact:
vmstorage_targets: "{{ vmstorage_targets + [item + ':8482'] }}"
loop: "{{ groups['vmstorage'] }}"

- name: Prepare vminsert list
ansible.builtin.set_fact:
vminsert_targets: "{{ vminsert_targets + [item + ':8480'] }}"
loop: "{{ groups['vminsert'] }}"

- name: Prepare vmselect list
ansible.builtin.set_fact:
vmselect_targets: "{{ vmselect_targets + [item + ':8481'] }}"
loop: "{{ groups['vmselect'] }}"

- name: Prepare vmagent-mom list
ansible.builtin.set_fact:
vmagent_mom_targets: "{{ vmagent_mom_targets + [item + ':8429'] }}"
loop: "{{ groups['vmagent-mom'] }}"
roles:
- vmagent
157 changes: 157 additions & 0 deletions playbooks/molecule/cluster-enterprise/molecule.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,157 @@
---
lint: |
yamllint .
ansible-lint .
dependency:
name: galaxy
driver:
name: docker

platforms:
- name: vmstorage-1-enterprise
image: "geerlingguy/docker-${MOLECULE_DISTRO:-debian11}-ansible:latest"
command: ${MOLECULE_DOCKER_COMMAND:-""}
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:rw
cgroupns_mode: host
privileged: true
pre_build_image: true
networks:
- name: cluster
groups:
- vmstorage
- name: vmstorage-2-enterprise
image: "geerlingguy/docker-${MOLECULE_DISTRO:-debian11}-ansible:latest"
command: ${MOLECULE_DOCKER_COMMAND:-""}
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:rw
cgroupns_mode: host
privileged: true
pre_build_image: true
networks:
- name: cluster
groups:
- vmstorage
- name: vmstorage-3-enterprise
image: "geerlingguy/docker-${MOLECULE_DISTRO:-debian11}-ansible:latest"
command: ${MOLECULE_DOCKER_COMMAND:-""}
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:rw
cgroupns_mode: host
privileged: true
pre_build_image: true
networks:
- name: cluster
groups:
- vmstorage

- name: vminsert-1-enterprise
image: "geerlingguy/docker-${MOLECULE_DISTRO:-debian11}-ansible:latest"
command: ${MOLECULE_DOCKER_COMMAND:-""}
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:rw
cgroupns_mode: host
privileged: true
pre_build_image: true
networks:
- name: cluster
groups:
- vminsert
- name: vminsert-2-enterprise
image: "geerlingguy/docker-${MOLECULE_DISTRO:-debian11}-ansible:latest"
command: ${MOLECULE_DOCKER_COMMAND:-""}
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:rw
cgroupns_mode: host
privileged: true
pre_build_image: true
networks:
- name: cluster
groups:
- vminsert

- name: vmselect-1-enterprise
image: "geerlingguy/docker-${MOLECULE_DISTRO:-debian11}-ansible:latest"
command: ${MOLECULE_DOCKER_COMMAND:-""}
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:rw
cgroupns_mode: host
privileged: true
pre_build_image: true
networks:
- name: cluster
groups:
- vmselect
- name: vmselect-2-enterprise
image: "geerlingguy/docker-${MOLECULE_DISTRO:-debian11}-ansible:latest"
command: ${MOLECULE_DOCKER_COMMAND:-""}
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:rw
cgroupns_mode: host
privileged: true
pre_build_image: true
networks:
- name: cluster
groups:
- vmselect

- name: vmauth-1-enterprise
image: "geerlingguy/docker-${MOLECULE_DISTRO:-debian11}-ansible:latest"
command: ${MOLECULE_DOCKER_COMMAND:-""}
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:rw
cgroupns_mode: host
privileged: true
pre_build_image: true
networks:
- name: cluster
groups:
- vmauth
- name: vmauth-2-enterprise
image: "geerlingguy/docker-${MOLECULE_DISTRO:-debian11}-ansible:latest"
command: ${MOLECULE_DOCKER_COMMAND:-""}
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:rw
cgroupns_mode: host
privileged: true
pre_build_image: true
networks:
- name: cluster
groups:
- vmauth

- name: vmagent-1-enterprise
image: "geerlingguy/docker-${MOLECULE_DISTRO:-debian11}-ansible:latest"
command: ${MOLECULE_DOCKER_COMMAND:-""}
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:rw
cgroupns_mode: host
privileged: true
pre_build_image: true
networks:
- name: cluster
groups:
- vmagent-mom
- name: vmagent-2-enterprise
image: "geerlingguy/docker-${MOLECULE_DISTRO:-debian11}-ansible:latest"
command: ${MOLECULE_DOCKER_COMMAND:-""}
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:rw
cgroupns_mode: host
privileged: true
pre_build_image: true
networks:
- name: cluster
groups:
- vmagent-mom


provisioner:
name: ansible
env:
ANSIBLE_ROLES_PATH: "../../../roles"
ANSIBLE_CONFIG: ../../../ansible.cfg
verifier:
name: ansible
4 changes: 4 additions & 0 deletions playbooks/molecule/cluster-enterprise/tests/test_default.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
service:
"vmauth":
enabled: true
running: true
Loading

0 comments on commit 5f073ca

Please sign in to comment.