Skip to content

Commit

Permalink
PMM-12641 Optimize PMM build scripts (#3239)
Browse files Browse the repository at this point in the history
* PMM-12641 update ansible configs

* PMM-12641 remove redundant playbooks/tasks

* PMM-12641 optimize the structure of playbooks, make update.yml redundant

* PMM-12641 trigger the build

* PMM-12641 fix the playbook name

* PMM-12641 pre-pull rpmbuild:3 to the agent

* PMM-12641 remove randomwait=1 for faster builds

* PMM-12641 put back the init.yml playbook

* PMM-12641 remove the unused nginx repository

* PMM-12641 fix pid location for nginx

* PMM-12641 remove a redundant repository

* PMM-12641 fix the startup logic

* PMM-12641 simplify version detection

* PMM-12641 fix an error

* PMM-12641 fix the client user name

* PMM-12641 fix nginx being unable to start

* PMM-12641 install Goreleaser on the agent

* PMM-12641 cleanup RH7 tweaks

* PMM-12641 stop Grafana before reinstalling the plugins

* PMM-12641 move nginx's pid to /tmp

* PMM-12641 stop grafana before provisioning plugins

* PMM-12641 remove redundant pkg provisioning

* PMM-12641 revert moving nginx's pid

* PMM-12641 remove redundant config reread

* PMM-12641 do not start grafana initially

* PMM-12641 cleanup the comments

* PMM-12641 move post-build.yml to the same playbook

* PMM-12641 cleanup the docs

* PMM-12641 remove space around block:

* PMM-12641 remove another redundant playbook

* PMM-12641 add an ssh key for a team member

* PMM-12641 remove redundant build script

* PMM-12641 fix the padding

* PMM-12641 don't add ssh keys to the agent

* Apply suggestions from code review

Co-authored-by: Catalina A <[email protected]>

* PMM-12641 Refine the task descriptions

* PMM-12641 Refine the task descriptions

* Update build/docker/client/Dockerfile

Co-authored-by: Nurlan Moldomurov <[email protected]>

* PMM-12641 Remove the encryption key

* PMM-12641 Fix duplicate psycopg2 installation

* PMM-12641 move psycopg2 installation to pg playbook

---------

Co-authored-by: Catalina A <[email protected]>
Co-authored-by: Nurlan Moldomurov <[email protected]>
  • Loading branch information
3 people authored Nov 8, 2024
1 parent 883604e commit c3a9e56
Show file tree
Hide file tree
Showing 37 changed files with 127 additions and 1,055 deletions.
9 changes: 5 additions & 4 deletions build/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,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
Original file line number Diff line number Diff line change
Expand Up @@ -27,38 +27,19 @@
--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
- name: Remove pmm-managed database from PostgreSQL
postgresql_db:
login_user: postgres
name: pmm-managed
force: true
state: absent

- name: Remove pmm-managed role from postgres
- name: Remove pmm-managed role from PostgreSQL database
postgresql_user:
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 @@ -87,6 +68,7 @@
- /var/log/clickhouse-server
- /var/log/nginx
- /var/lib/pgsql
- /srv/pmm-encryption.key

- name: Remove users created by installers
user:
Expand All @@ -106,7 +88,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 Down
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.

Loading

0 comments on commit c3a9e56

Please sign in to comment.