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

PMM-12641 Optimize PMM build scripts #3239

Draft
wants to merge 27 commits into
base: v3
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
0ab11ab
PMM-12641 update ansible configs
ademidoff Oct 15, 2024
8595533
PMM-12641 remove redundant playbooks/tasks
ademidoff Oct 15, 2024
3d832bd
PMM-12641 optimize the structure of playbooks, make update.yml redundant
ademidoff Oct 15, 2024
f9a4a59
PMM-12641 trigger the build
ademidoff Oct 15, 2024
66fc782
PMM-12641 fix the playbook name
ademidoff Oct 15, 2024
ae642a6
PMM-12641 pre-pull rpmbuild:3 to the agent
ademidoff Oct 15, 2024
d91a37f
PMM-12641 remove randomwait=1 for faster builds
ademidoff Oct 15, 2024
37efb2f
PMM-12641 put back the init.yml playbook
ademidoff Oct 15, 2024
c66e390
PMM-12641 remove the unused nginx repository
ademidoff Oct 15, 2024
67cb334
PMM-12641 fix pid location for nginx
ademidoff Oct 15, 2024
81d4442
PMM-12641 remove a redundant repository
ademidoff Oct 15, 2024
034c9c8
PMM-12641 fix the startup logic
ademidoff Oct 15, 2024
6c8f698
PMM-12641 simplify version detection
ademidoff Oct 15, 2024
7b77053
PMM-12641 fix an error
ademidoff Oct 15, 2024
aaaf9ee
PMM-12641 fix the client user name
ademidoff Oct 18, 2024
fb31170
Merge branch 'v3' into PMM-12641-optimize-pmm-build-scripts
ademidoff Oct 18, 2024
ef68a7f
PMM-12641 fix nginx being unable to start
ademidoff Oct 18, 2024
6a15fd4
PMM-12641 install Goreleaser on the agent
ademidoff Oct 18, 2024
e7751f3
PMM-12641 cleanup RH7 tweaks
ademidoff Oct 18, 2024
1e1d5a4
PMM-12641 stop Grafana before reinstalling the plugins
ademidoff Oct 18, 2024
5f680d9
PMM-12641 move nginx's pid to /tmp
ademidoff Oct 18, 2024
574ce2f
PMM-12641 stop grafana before provisioning plugins
ademidoff Oct 18, 2024
09c2887
PMM-12641 remove redundant pkg provisioning
ademidoff Oct 18, 2024
f355f5e
PMM-12641 revert moving nginx's pid
ademidoff Oct 18, 2024
5ffd5fc
PMM-12641 remove redundant config reread
ademidoff Oct 18, 2024
e3e9e03
PMM-12641 do not start grafana initially
ademidoff Oct 18, 2024
d3af10c
PMM-12641 cleanup the comments
ademidoff Oct 18, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions build/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ pmm-ami:
build -var 'pmm_server_image_name=${PMM_SERVER_IMAGE}' -only amazon-ebs -color=false packer/pmm.json | tee build.log
## ----------------- PACKER ------------------

check: ## Run required checks and linters
ansible-playbook --syntax-check ansible/pmm-docker/update.yml
ansible-playbook --check ansible/pmm-docker/update.yml
ansible-lint ansible/pmm-docker/update.yml
check:
echo "TODO: Since update.yml has been deprecated, see if other playbooks need to be linted"
# ansible-playbook --syntax-check ansible/pmm-docker/update.yml
# ansible-playbook --check ansible/pmm-docker/update.yml
# ansible-lint ansible/pmm-docker/update.yml
1 change: 1 addition & 0 deletions build/ansible/ansible.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# Otherwise, it will fail with 'Permission denied' error since the default paths are '/root/.ansible/tmp'
# Ref: https://github.com/ansible/ansible/blob/stable-2.9/examples/ansible.cfg
[defaults]
interpreter_python = /usr/bin/python

remote_tmp = /tmp
local_tmp = /tmp
Expand Down
11 changes: 11 additions & 0 deletions build/ansible/hosts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# This is the default ansible 'hosts' file.
#
# It should live in /etc/ansible/hosts
#
# - Comments begin with the '#' character
# - Blank lines are ignored
# - Groups of hosts are delimited by [header] elements
# - You can enter hostnames or ip addresses
# - A hostname/ip can be a member of multiple groups

127.0.0.1 ansible_connection=local
4 changes: 2 additions & 2 deletions build/ansible/pmm-docker/init.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
# This playbook contains tasks executed during initialization PMM Server
- hosts: localhost
# This playbook gets executed by pmm-update-perform-init
- hosts: all
become: true
become_method: su
become_user: pmm
Expand Down
1 change: 1 addition & 0 deletions build/ansible/pmm-docker/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
- hosts: all
become: yes
gather_facts: yes

roles:
- pmm-images
172 changes: 0 additions & 172 deletions build/ansible/pmm-docker/update.yml

This file was deleted.

65 changes: 0 additions & 65 deletions build/ansible/pmm/create-lvm.yml

This file was deleted.

3 changes: 1 addition & 2 deletions build/ansible/pmm/main.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
---
# This playbook is frozen after 2.0.0 GA release.
# All new plays should be added into pmm-update playbook. It is invoked after this one.
# TODO: Remove as this playbook does not seem to be used anywhere.

- hosts: all
become: yes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,25 +27,6 @@
--server-address=127.0.0.1:8443
--server-insecure-tls

- name: Reread supervisord configuration
command: supervisorctl reread
become: true
become_user: pmm
become_method: su
register: reread_result
changed_when: "'No config updates to processes' not in reread_result.stdout"

- name: See which service configs changed
debug: var=reread_result.stdout_lines

- name: Stop pmm-managed before deleting the database
supervisorctl:
name: pmm-managed
state: stopped
become: true
become_user: pmm
become_method: su

- name: Remove pmm-managed database
postgresql_db:
login_user: postgres
Expand All @@ -58,7 +39,7 @@
name: pmm-managed
state: absent

- name: Stop supervisord service for docker
- name: Stop supervisord service
command: supervisorctl shutdown
become: true
become_user: pmm
Expand Down Expand Up @@ -106,7 +87,7 @@
# This is due to the way OverlayFS and kernel works. More info https://github.com/moby/moby/issues/25409
# This step ensures the directory is empty on startup and the contents are recreated.
# This is not an issue if the folder is in a volume or mounted from the host OS.
- name: Recreate /srv/victoriametrics folder
- name: Recreate '/srv/victoriametrics' directory
file:
state: "{{ item }}"
path: /srv/victoriametrics
Expand All @@ -124,12 +105,3 @@
owner: pmm
group: pmm
mode: 0775

# nginx needs to be able to write to /var/lib/nginx, but it's owned by root.
- name: Change ownership of nginx dirs
file:
path: /var/lib/nginx
state: directory
group: pmm
owner: pmm
recurse: yes
43 changes: 0 additions & 43 deletions build/ansible/pmm/systemd.yml

This file was deleted.

Loading
Loading