Skip to content

Commit

Permalink
Merge branch 'v3' into Release-3-0-0-GA
Browse files Browse the repository at this point in the history
  • Loading branch information
ademidoff authored Jan 9, 2025
2 parents d829cc4 + 438aff4 commit be419d1
Show file tree
Hide file tree
Showing 77 changed files with 405 additions and 1,733 deletions.
15 changes: 14 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,21 @@ jobs:
go env | sort
git status
typos_check:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0
- name: Check spelling of md files
uses: crate-ci/typos@9d890159570d5018df91fedfa40b4730cd4a81b1 # v1.28.4
with:
files: "**/*.md ./documentation/**/*.md"

merge-gatekeeper:
needs: [ check ]
needs: [ check, typos_check ]
name: Merge Gatekeeper
if: ${{ always() }}
runs-on: ubuntu-22.04
Expand Down
79 changes: 0 additions & 79 deletions .github/workflows/update.yml

This file was deleted.

3 changes: 0 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@ agent/agents/mysql/slowlog/parser/crashers/
agent/agents/mysql/slowlog/parser/suppressions/
agent/agents/mysql/slowlog/parser/parser-fuzz.zip

update/*.runcover.out
update/*.test

fuzzing/
*-fuzz.zip
*.bench
Expand Down
6 changes: 6 additions & 0 deletions .typos.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[default]
extend-ignore-identifiers-re = [
"LKE",
"ue",
"ba"
]
3 changes: 1 addition & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ This project is built from several repositories:

* [percona/pmm-managed](https://github.com/percona/pmm/tree/main/managed) manages configuration of PMM server components (VictoriaMetrics, Grafana, etc.) and exposes API for that. APIs are used by [pmm-admin](https://github.com/percona/pmm/tree/main/admin)
* [percona/qan-api](https://github.com/percona/pmm/tree/main/qan-api2) query analytics API
* [percona/pmm-update](https://github.com/percona/pmm/tree/main/update) is a tool for updating packages and OS configuration for PMM

#### Frontends

Expand Down Expand Up @@ -127,7 +126,7 @@ Since PMM has a lot of components, we will mention only three big parts of it.
* This command will register local pmm-agent to PMM Server and generate config file `pmm-agent-dev.yaml`
* Once it's connected just use `make run` to run pmm-agent.
* To work correctly, pmm-agent needs vmagent and exporters installed on the system.
* The first option is to install pmm-client using this instrucion https://docs.percona.com/percona-monitoring-and-management/setting-up/client/index.html#install. It will install all exporters as well.
* The first option is to install pmm-client using this instruction https://docs.percona.com/percona-monitoring-and-management/setting-up/client/index.html#install. It will install all exporters as well.
* Another option is to do it manually
* vmagent and exporters can be installed by building each of them or by downloading the pmm-client tarball from [percona.com](https://www.percona.com/downloads/pmm2/) and copying binaries to the exporters_base directory configured in `pmm-agent-dev.yaml` file.
* All paths to exporter binaries are configured in `pmm-agent-dev.yaml`, so they can be changed manually if necessary.
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ See the [PMM Documentation](https://www.percona.com/doc/percona-monitoring-and-m

Please check our [Documentation](https://docs.percona.com/percona-monitoring-and-management/details/architecture.html) for the actual architecture.

![Overal Architecture](https://docs.percona.com/percona-monitoring-and-management/_images/C_S_Architecture.jpg "Client Server Architecture")
![Overall Architecture](https://docs.percona.com/percona-monitoring-and-management/_images/C_S_Architecture.jpg "Client Server Architecture")


![PMM Server](https://docs.percona.com/percona-monitoring-and-management/_images/PMM-Server-Component-Based-View.jpg 'PMM Server Architecture')
Expand Down
2 changes: 1 addition & 1 deletion api-tests/server/logs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@ func TestDownloadLogs(t *testing.T) {
"nginx.log",
"pmm-agent.log",
"pmm-agent.yaml",
"pmm-init.log",
"pmm-managed.log",
"pmm-ssl.conf",
"pmm-update-perform-init.log",
"pmm-version.txt",
"pmm.conf",
"pmm.ini",
Expand Down
2 changes: 1 addition & 1 deletion api/MIGRATION_TO_V3.md
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@
POST /v1/management/Role/SetDefault POST /v1/accesscontrol/roles:setDefault
POST /v1/management/Role/Update PUT /v1/accesscontrol/roles/{role_id} ✅

**Management:: Intergrated Alerting**
**Management:: Integrated Alerting**
POST /v1/management/ia/Alerts/List N/A ❌ Deprecated in v2 and removed in v3
POST /v1/management/ia/Alerts/Toggle N/A ❌ Deprecated in v2 and removed in v3
POST /v1/management/ia/Channels/Add N/A ❌ Deprecated in v2 and removed in v3
Expand Down
10 changes: 8 additions & 2 deletions build/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ export PACKER_CACHE_DIR := .cache
export PACKER_VERSION := 1.9.4
export BOX_VERSION := 202407.23.0
export PMM_SERVER_IMAGE ?= docker.io/perconalab/pmm-server:3-dev-latest
export WATCHTOWER_IMAGE ?= docker.io/perconalab/watchtower:dev-latest
export CENTOS_ISO := 2004.01

## ----------------- PACKER ------------------
Expand All @@ -25,7 +26,10 @@ deps:
unzip -o ${PACKER_CACHE_DIR}/packer.zip -d ~/bin

pmm-ovf: fetch
/usr/bin/packer build -var 'pmm_server_image_name=${PMM_SERVER_IMAGE}' -only virtualbox-ovf -color=false packer/pmm.json | tee build.log
/usr/bin/packer build \
-var 'pmm_server_image_name=${PMM_SERVER_IMAGE}' \
-var 'watchtower_image_name=${WATCHTOWER_IMAGE}' \
-only virtualbox-ovf -color=false packer/pmm.json | tee build.log

pmm-digitalocean:
packer build -only digitalocean -var 'single_disk=true' packer/pmm.json
Expand All @@ -35,7 +39,9 @@ pmm-azure:

pmm-ami:
docker run --rm -v ${HOME}/.aws:/root/.aws -v `pwd`:/build -w /build \hashicorp/packer:${PACKER_VERSION} \
build -var 'pmm_server_image_name=${PMM_SERVER_IMAGE}' -only amazon-ebs -color=false packer/pmm.json | tee build.log
build -var 'pmm_server_image_name=${PMM_SERVER_IMAGE}' \
-var 'watchtower_image_name=${WATCHTOWER_IMAGE}' \
-only amazon-ebs -color=false packer/pmm.json | tee build.log
## ----------------- PACKER ------------------

check:
Expand Down
2 changes: 1 addition & 1 deletion build/ansible/pmm-docker/init.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
# This playbook gets executed by pmm-update-perform-init
# This playbook is run by the `pmm-init` supervisord process
- hosts: all
become: true
become_method: su
Expand Down
5 changes: 2 additions & 3 deletions build/ansible/roles/pmm-images/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@
- percona-qan-api2
- percona-dashboards
- pmm-managed
- pmm-update
- pmm-dump
- vmproxy
state: installed
Expand Down Expand Up @@ -150,10 +149,10 @@
register: managed_init_result
changed_when: True

- name: Disable pmm-update-perform-init
- name: Disable pmm-init
ini_file:
path: /etc/supervisord.d/pmm.ini
section: program:pmm-update-perform-init
section: program:pmm-init
option: autostart
value: "false"

Expand Down
8 changes: 4 additions & 4 deletions build/ansible/roles/supervisord/files/pmm.ini
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ username = dummy
password = dummy

; we rewrite autostart to true during update or build.
[program:pmm-update-perform-init]
command = /usr/sbin/pmm-update -run-playbook -playbook=/opt/ansible/pmm-docker/init.yml
[program:pmm-init]
command = /usr/bin/ansible-playbook /opt/ansible/pmm-docker/init.yml
user = pmm
directory = /
autorestart = unexpected
Expand All @@ -20,8 +20,8 @@ startretries = 3
startsecs = 1
stopsignal = TERM
stopwaitsecs = 300
stdout_logfile = /srv/logs/pmm-update-perform-init.log
stdout_logfile_maxbytes = 50MB
stdout_logfile = /srv/logs/pmm-init.log
stdout_logfile_maxbytes = 20MB
stdout_logfile_backups = 3
redirect_stderr = true

Expand Down
37 changes: 26 additions & 11 deletions build/packages/rpm/client/pmm-client.spec
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,22 @@ if [ -f /usr/local/percona/pmm2/config/pmm-agent.yaml.bak ]; then
/^[^[:space:]]/!d
}' "/usr/local/percona/pmm/config/pmm-agent.yaml" > "/usr/local/percona/pmm/config/pmm-agent.yaml.tmp" && mv "/usr/local/percona/pmm/config/pmm-agent.yaml.tmp" "/usr/local/percona/pmm/config/pmm-agent.yaml"

if [ -d /usr/local/percona/pmm2/config ] && [ ! "$(ls -A /usr/local/percona/pmm2/config)" ]; then
if [ -d /usr/local/percona/pmm2/config ] && [ -z "$(ls -A /usr/local/percona/pmm2/config)" ]; then
rmdir /usr/local/percona/pmm2/config
fi

if [ -d /usr/local/percona/pmm2 ] && [ ! "$(ls -A /usr/local/percona/pmm2)" ]; then
if [ -d /usr/local/percona/pmm2 ] && [ -z "$(ls -A /usr/local/percona/pmm2)" ]; then
rmdir /usr/local/percona/pmm2
fi

if ! getent passwd pmm-agent > /dev/null 2>&1; then
/usr/sbin/groupadd -r pmm-agent
/usr/sbin/useradd -M -r -g pmm-agent -d /usr/local/percona/ -s /bin/false -c "PMM Agent User" pmm-agent
chown -R pmm-agent:pmm-agent /usr/local/percona/pmm
fi
/usr/bin/systemctl enable pmm-agent >/dev/null 2>&1 || :
/usr/bin/systemctl daemon-reload
/usr/bin/systemctl start pmm-agent.service
fi

%build
Expand Down Expand Up @@ -122,7 +131,7 @@ install -m 0644 config/pmm-agent.service %{buildroot}/%{_unitdir}/pmm-agent.serv
rm -rf $RPM_BUILD_ROOT

%pre
if [ $1 == 1 ]; then
if [ $1 -eq 1 ]; then
if ! getent passwd pmm-agent > /dev/null 2>&1; then
/usr/sbin/groupadd -r pmm-agent
/usr/sbin/useradd -M -r -g pmm-agent -d /usr/local/percona/ -s /bin/false -c pmm-agent pmm-agent > /dev/null 2>&1
Expand All @@ -132,15 +141,14 @@ if [ $1 -eq 2 ]; then
/usr/bin/systemctl stop pmm-agent.service >/dev/null 2>&1 ||:
fi


%post
for file in pmm-admin pmm-agent
do
%{__ln_s} -f /usr/local/percona/pmm/bin/$file /usr/bin/$file
%{__ln_s} -f /usr/local/percona/pmm/bin/$file /usr/sbin/$file
done
%systemd_post pmm-agent.service
if [ $1 == 1 ]; then
if [ $1 -eq 1 ]; then
if [ ! -f /usr/local/percona/pmm/config/pmm-agent.yaml ]; then
install -d -m 0755 /usr/local/percona/pmm/config
install -m 0660 -o pmm-agent -g pmm-agent /dev/null /usr/local/percona/pmm/config/pmm-agent.yaml
Expand All @@ -164,21 +172,29 @@ fi

%postun
case "$1" in
0) # This is a yum remove.
/usr/sbin/userdel pmm-agent
%systemd_postun_with_restart pmm-agent.service
;;
1) # This is a yum upgrade.
%systemd_postun_with_restart pmm-agent.service
;;
esac
if [ $1 == 0 ]; then
if [ $1 -eq 0 ]; then
%systemd_postun_with_restart pmm-agent.service
if /usr/bin/id -g pmm-agent > /dev/null 2>&1; then
/usr/sbin/userdel pmm-agent > /dev/null 2>&1
/usr/sbin/groupdel pmm-agent > /dev/null 2>&1 || true
if [ -f /usr/local/percona/pmm/config/pmm-agent.yaml ]; then
rm -r /usr/local/percona/pmm/config/pmm-agent.yaml
fi
if [ -f /usr/local/percona/pmm/config/pmm-agent.yaml.bak ]; then
rm -r /usr/local/percona/pmm/config/pmm-agent.yaml.bak
fi
if [ -d /usr/local/percona/pmm/config ] && [ -z "$(ls -A /usr/local/percona/pmm/config)" ]; then
rmdir /usr/local/percona/pmm/config
fi

if [ -d /usr/local/percona/pmm ] && [ -z "$(ls -A /usr/local/percona/pmm)" ]; then
rmdir /usr/local/percona/pmm
fi

for file in pmm-admin pmm-agent
do
if [ -L /usr/sbin/$file ]; then
Expand All @@ -191,7 +207,6 @@ if [ $1 == 0 ]; then
fi
fi


%files
%config %{_unitdir}/pmm-agent.service
%attr(0660,pmm-agent,pmm-agent) %ghost /usr/local/percona/pmm/config/pmm-agent.yaml
Expand Down
Loading

0 comments on commit be419d1

Please sign in to comment.