From 484f4c53dbae24e70a16c9e4498058f5a4da1011 Mon Sep 17 00:00:00 2001 From: Nurlan Moldomurov Date: Fri, 20 Dec 2024 18:48:34 +0300 Subject: [PATCH 1/9] PMM-12566 script to migrate from PMM 2 to PMM 3. (#3332) * PMM-12566 Update env variables and support data container installations. * PMM-12566 Update env variables and support data container installations. * PMM-12566 Update env variables and support data container installations. * Apply suggestions from code review * PMM-12566 Start 3.0.0 beta by default. * PMM-12566 Fix check. --- get-pmm.sh | 171 +++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 154 insertions(+), 17 deletions(-) diff --git a/get-pmm.sh b/get-pmm.sh index 1b498de6e9..a0fea34ea8 100755 --- a/get-pmm.sh +++ b/get-pmm.sh @@ -15,12 +15,13 @@ trap cleanup SIGINT SIGTERM ERR EXIT # Set defaults. network_name=${NETWORK_NAME:-pmm-net} -tag=${PMM_TAG:-3} -repo=${PMM_REPO:-percona/pmm-server} +tag=${PMM_TAG:-3.0.0-beta} +repo=${PMM_REPO:-perconalab/pmm-server} port=${PMM_PORT:-443} container_name=${CONTAINER_NAME:-pmm-server} docker_socket_path=${DOCKER_SOCKET_PATH:-/var/run/docker.sock} watchtower_token=${WATCHTOWER_TOKEN:-} +volume_name=${VOLUME_NAME:-pmm-data} backup_data=0 interactive=0 root_is_needed=no @@ -64,6 +65,9 @@ Available options: -net, --network-name Name of the network to create (default: pmm-net) + +-vn, --volume-name + Name of the volume to create (default: pmm-data) EOF exit } @@ -148,6 +152,10 @@ parse_params() { network_name="${2-}" shift ;; + -vn | --volume-name) + volume_name="${2-}" + shift + ;; -?*) die "Unknown option: $1" ;; *) break ;; esac @@ -310,14 +318,141 @@ migrate_pmm_data() { run_docker "stop $container_name" } +# Full Mapping of PMM v2 to v3 Environment Variables +# Simulated mapping using an indexed array +ENV_MAPPING=( + "DATA_RETENTION=PMM_DATA_RETENTION" + "DISABLE_ALERTING=PMM_ENABLE_ALERTING" + "DISABLE_UPDATES=PMM_ENABLE_UPDATES" + "DISABLE_TELEMETRY=PMM_ENABLE_TELEMETRY" + "PERCONA_PLATFORM_API_TIMEOUT=PMM_DEV_PERCONA_PLATFORM_API_TIMEOUT" + "DISABLE_BACKUP_MANAGEMENT=PMM_ENABLE_BACKUP_MANAGEMENT" + "ENABLE_AZUREDISCOVER=PMM_ENABLE_AZURE_DISCOVER" + "ENABLE_RBAC=PMM_ENABLE_ACCESS_CONTROL" + "METRICS_RESOLUTION=PMM_METRICS_RESOLUTION" + "METRICS_RESOLUTION_HR=PMM_METRICS_RESOLUTION_HR" + "METRICS_RESOLUTION_LR=PMM_METRICS_RESOLUTION_LR" + "METRICS_RESOLUTION_MR=PMM_METRICS_RESOLUTION_MR" + "OAUTH_PMM_CLIENT_ID=PMM_DEV_OAUTH_CLIENT_ID" + "OAUTH_PMM_CLIENT_SECRET=PMM_DEV_OAUTH_CLIENT_SECRET" + "PERCONA_TEST_AUTH_HOST=PMM_DEV_PERCONA_PLATFORM_ADDRESS" + "PERCONA_TEST_CHECKS_FILE=PMM_DEV_ADVISOR_CHECKS_FILE" + "PERCONA_TEST_CHECKS_HOST=PMM_DEV_PERCONA_PLATFORM_ADDRESS" + "PERCONA_TEST_CHECKS_PUBLIC_KEY=PMM_DEV_PERCONA_PLATFORM_PUBLIC_KEY" + "PERCONA_TEST_PLATFORM_ADDRESS=PMM_DEV_PERCONA_PLATFORM_ADDRESS" + "PERCONA_TEST_PLATFORM_INSECURE=PMM_DEV_PERCONA_PLATFORM_INSECURE" + "PERCONA_TEST_PLATFORM_PUBLIC_KEY=PMM_DEV_PERCONA_PLATFORM_PUBLIC_KEY" + "PERCONA_TEST_SAAS_HOST=PMM_DEV_PERCONA_PLATFORM_ADDRESS" + "PERCONA_TEST_POSTGRES_ADDR=PMM_POSTGRES_ADDR" + "PERCONA_TEST_POSTGRES_DBNAME=PMM_POSTGRES_DBNAME" + "PERCONA_TEST_POSTGRES_SSL_CA_PATH=PMM_POSTGRES_SSL_CA_PATH" + "PERCONA_TEST_POSTGRES_SSL_CERT_PATH=PMM_POSTGRES_SSL_CERT_PATH" + "PERCONA_TEST_POSTGRES_SSL_KEY_PATH=PMM_POSTGRES_SSL_KEY_PATH" + "PERCONA_TEST_POSTGRES_SSL_MODE=PMM_POSTGRES_SSL_MODE" + "PERCONA_TEST_POSTGRES_USERNAME=PMM_POSTGRES_USERNAME" + "PERCONA_TEST_POSTGRES_DBPASSWORD=PMM_POSTGRES_DBPASSWORD" + "PMM_TEST_TELEMETRY_DISABLE_SEND=PMM_DEV_TELEMETRY_DISABLE_SEND" + "PERCONA_TEST_TELEMETRY_DISABLE_START_DELAY=PMM_DEV_TELEMETRY_DISABLE_START_DELAY" + "PERCONA_TEST_PMM_CLICKHOUSE_ADDR=PMM_CLICKHOUSE_ADDR" + "PERCONA_TEST_PMM_CLICKHOUSE_DATABASE=PMM_CLICKHOUSE_DATABASE" + "PERCONA_TEST_PMM_CLICKHOUSE_DATASOURCE=PMM_CLICKHOUSE_DATASOURCE" + "PERCONA_TEST_PMM_CLICKHOUSE_HOST=PMM_CLICKHOUSE_HOST" + "PERCONA_TEST_PMM_CLICKHOUSE_PORT=PMM_CLICKHOUSE_PORT" + "PERCONA_TEST_PMM_DISABLE_BUILTIN_CLICKHOUSE=PMM_DISABLE_BUILTIN_CLICKHOUSE" + "PERCONA_TEST_PMM_DISABLE_BUILTIN_POSTGRES=PMM_DISABLE_BUILTIN_POSTGRES" + "PERCONA_TEST_INTERFACE_TO_BIND=PMM_INTERFACE_TO_BIND" + "PERCONA_TEST_VERSION_SERVICE_URL=PMM_DEV_PERCONA_PLATFORM_ADDRESS" + "PMM_TEST_TELEMETRY_FILE=PMM_DEV_TELEMETRY_FILE" + "PERCONA_TEST_TELEMETRY_HOST=PMM_DEV_TELEMETRY_HOST" + "PERCONA_TEST_TELEMETRY_INTERVAL=PMM_DEV_TELEMETRY_INTERVAL" + "PERCONA_TEST_TELEMETRY_RETRY_BACKOFF=PMM_DEV_TELEMETRY_RETRY_BACKOFF" + "PERCONA_TEST_STARLARK_ALLOW_RECURSION=PMM_DEV_ADVISOR_STARLARK_ALLOW_RECURSION" +) + +ENV_TO_DROP=( +"PATH" +"LANG" +"LC_ALL" +"GF_PLUGIN_DIR" +"PS1" +"LESS_LOG_NOISE" +"PERCONA_TEST_CHECKS_INTERVAL" +"PERCONA_TEST_NICER_API" +"PERCONA_TEST_PMM_CLICKHOUSE_BLOCK_SIZE" +"PERCONA_TEST_PMM_CLICKHOUSE_POOL_SIZE" +) + +# Function to get the new key from the mapping +get_mapped_key() { + local key="$1" + for mapping in "${ENV_MAPPING[@]}"; do + local old_key="${mapping%%=*}" + local new_key="${mapping#*=}" + if [[ "$old_key" == "$key" ]]; then + echo "$new_key" + return + fi + done + echo "" +} + +needs_to_drop() { + local key="$1" + for drop_key in "${ENV_TO_DROP[@]}"; do + if [[ "$drop_key" == "$key" ]]; then + return 0 + fi + done + return 1 +} + +# Function to migrate environment variables +migrate_env_vars() { + local current_env + IFS=$'\n' current_env=$(run_docker "inspect --format '{{range .Config.Env}}{{println .}}{{end}}' $container_name") + local docker_env_flags=$1 + + for env in $current_env; do + local key="${env%%=*}" + local value="${env#*=}" + + if [[ -z "$value" ]]; then + continue + fi + + local new_key + new_key=$(get_mapped_key "$key") + + local needs_drop + needs_drop=$(needs_to_drop "$key") + + if [[ -n "$new_key" ]]; then + msg "Migrating env variable $key to $new_key" + # Handle DISABLE_* to ENABLE_* boolean reversal + if [[ "$key" =~ ^DISABLE_ ]]; then + value=$((1 - value)) # Reverse the boolean + fi + + docker_env_flags+="--env $new_key=\"$value\" " + elif [[ "$needs_drop" -eq 0 ]]; then + docker_env_flags+="--env $key=\"$value\" " + else + msg "Dropping env variable $key" + fi + done + + echo "$docker_env_flags" +} + + ####################################### # Backs up existing PMM Data Volume. ####################################### backup_pmm_data() { - pmm_volume_archive="pmm-data-$(date "+%F-%H%M%S")" + pmm_volume_archive="$volume_name-$(date "+%F-%H%M%S")" msg "Backing up existing PMM Data Volume to $pmm_volume_archive" run_docker "volume create $pmm_volume_archive 1> /dev/null" - run_docker "run --rm -v pmm-data:/from -v $pmm_volume_archive:/to alpine ash -c 'cd /from ; cp -av . /to'" + run_docker "run --rm -v $volume_name:/from -v $pmm_volume_archive:/to alpine ash -c 'cd /from ; cp -av . /to'" msg "Successfully backed up existing PMM Data Volume to $pmm_volume_archive" } @@ -326,16 +461,10 @@ backup_pmm_data() { # If a PMM Server instance is running - stop and back it up. ####################################### start_pmm() { - msg "Starting PMM Server..." + msg "Pulling $repo:$tag" run_docker "pull $repo:$tag 1> /dev/null" - if ! run_docker "inspect pmm-data 1> /dev/null 2> /dev/null"; then - if ! run_docker "volume create pmm-data 1> /dev/null"; then - die "${RED}ERROR: cannot create PMM Data Volume${NOFORMAT}" - fi - msg "Created PMM Data Volume: pmm-data" - fi - + docker_env_flags="-e PMM_WATCHTOWER_HOST=http://watchtower:8080 -e PMM_WATCHTOWER_TOKEN=$watchtower_token " if run_docker "inspect $container_name 1> /dev/null 2> /dev/null"; then pmm_archive="$container_name-$(date "+%F-%H%M%S")" msg "\tExisting PMM Server found, renaming to $pmm_archive\n" @@ -346,12 +475,23 @@ start_pmm() { # get container tag from inspect old_version=$(run_docker "inspect --format='{{.Config.Image}}' $container_name | cut -d':' -f2") # if tag starts with 2.x, we need to migrate data - if [[ "$old_version" == 2.* ]]; then + if [[ "$old_version" == "2" || "$old_version" == 2.* || "$old_version" == "dev-latest" ]]; then + docker_env_flags=$(migrate_env_vars "$docker_env_flags") migrate_pmm_data fi + volume_name=$(run_docker "inspect -f '{{ range .Mounts }}{{ if and (eq .Type \"volume\") (eq .Destination \"/srv\" )}}{{ .Name }}{{ \"\n\" }}{{ end }}{{ end }}' $container_name") run_docker "rename $container_name $pmm_archive\n" fi - run_pmm="run -d -p $port:8443 --volume pmm-data:/srv --name $container_name --network $network_name -e PMM_WATCHTOWER_HOST=http://watchtower:8080 -e PMM_WATCHTOWER_TOKEN=$watchtower_token --restart always $repo:$tag" + + if ! run_docker "volume inspect $volume_name 1> /dev/null 2> /dev/null"; then + if ! run_docker "volume create $volume_name 1> /dev/null"; then + die "${RED}ERROR: cannot create PMM Data Volume${NOFORMAT}" + fi + msg "Created PMM Data Volume: $volume_name" + fi + msg "Starting PMM Server..." + + run_pmm="run -d -p $port:8443 --volume $volume_name:/srv --name $container_name --network $network_name $docker_env_flags --restart always $repo:$tag" run_docker "$run_pmm 1> /dev/null" msg "Created PMM Server: $container_name" @@ -402,6 +542,3 @@ parse_params "$@" main die "Enjoy Percona Monitoring and Management!" 0 -# TODO: Update script from PMM 2 to PMM 3 - -}# TODO: reuse watchtower token from older pmm instance or watchtower \ No newline at end of file From b7885f1103eab8b7e88403e0600e889f37fb1bf1 Mon Sep 17 00:00:00 2001 From: Nurlan Moldomurov Date: Mon, 23 Dec 2024 11:02:28 +0300 Subject: [PATCH 2/9] PMM-7 typos check job (#3407) * PMM-7 typos check job. * PMM-7 Update main.yml to clean up fetch-depth comment Removed an unnecessary comment in the GitHub Actions workflow file. This change simplifies the configuration by eliminating redundant information without affecting functionality. * PMM-7 Update typos action to include markdown files Extended the typos action configuration to check `.md` files for spelling errors. This ensures consistency and correctness across documentation files in the repository. * PMM-7 Fix typos across documentation and workflows Corrected multiple spelling mistakes in markdown files and updated the workflow file to check spellings in all .md files. This improves documentation clarity and ensures consistency in future contributions. * PMM-7 Try to fix typos job to include documentations folder * PMM-7 Try to fix typos job to include documentations folder * PMM-7 Fix typos across documentation and add typos config. Corrected a range of spelling mistakes in documentation files to improve clarity and professionalism. Added `.typos.toml` to configure typo checks and modified workflow to include documentation in typo scanning. --- .github/workflows/main.yml | 15 ++++++++++++++- .typos.toml | 6 ++++++ CONTRIBUTING.md | 2 +- README.md | 2 +- api/MIGRATION_TO_V3.md | 2 +- docs/api/inventory/change-agent.md | 2 +- .../account-management/change-admin-password.md | 4 ++-- .../account-management/create-user-accounts.md | 2 +- docs/managed/data-model.md | 2 +- docs/managed/update-process.md | 2 +- docs/process/best_practices.md | 2 +- documentation/docs/alert/contact_points.md | 2 +- documentation/docs/alert/silence_alerts.md | 2 +- documentation/docs/install-pmm/HA.md | 14 +++++++------- .../connect-database/mongodb.md | 2 +- .../plan-pmm-installation/hardware_and_system.md | 2 +- .../plan-pmm-installation/network_and_firewall.md | 2 +- ...ummary.md => dashboard-environment-summary.md} | 0 ...d-postgresql-vacuum-monitoring-experimental.md | 2 +- .../docs/reference/personal_data_handling.md | 2 +- documentation/docs/reference/ui/ui_components.md | 2 +- documentation/docs/troubleshoot/index.md | 2 +- documentation/docs/use/dashboard-inventory.md | 4 ++-- .../manage-dashboards/manage-folders.md | 4 ++-- .../use/dashboards/dashboard-manage-dashboards.md | 2 +- documentation/docs/use/dashboards/index.md | 2 +- managed/CONTRIBUTING.md | 2 +- qan-api2/README.md | 4 ++-- 28 files changed, 55 insertions(+), 36 deletions(-) create mode 100644 .typos.toml rename documentation/docs/reference/dashboards/{dashboard-environent-summary.md => dashboard-environment-summary.md} (100%) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index ea82dd0430..8c965b6086 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -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 diff --git a/.typos.toml b/.typos.toml new file mode 100644 index 0000000000..2f7002d330 --- /dev/null +++ b/.typos.toml @@ -0,0 +1,6 @@ +[default] +extend-ignore-identifiers-re = [ + "LKE", + "ue", + "ba" +] \ No newline at end of file diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 1920ed3c99..954fc9b906 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -127,7 +127,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. diff --git a/README.md b/README.md index e6228d4e36..a2cad08312 100644 --- a/README.md +++ b/README.md @@ -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') diff --git a/api/MIGRATION_TO_V3.md b/api/MIGRATION_TO_V3.md index 230f367ffc..00c5a29062 100644 --- a/api/MIGRATION_TO_V3.md +++ b/api/MIGRATION_TO_V3.md @@ -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 diff --git a/docs/api/inventory/change-agent.md b/docs/api/inventory/change-agent.md index 30fe571cae..d5c646ef3a 100644 --- a/docs/api/inventory/change-agent.md +++ b/docs/api/inventory/change-agent.md @@ -10,7 +10,7 @@ This section describes how to change Agent attributes. > 📘 Info > -> Not all attrbutes can be chaged. For example, you cannot change the Agent type nor its ID. +> Not all attributes can be changed. For example, you cannot change the Agent type nor its ID. In PMM versions prior to 3.0.0, we featured a separate API call for each Agent type. Starting with PMM 3.0.0, we have streamlined the process by offering a single API endpoint for all Agent types. diff --git a/docs/api/pmm-server-config/account-management/change-admin-password.md b/docs/api/pmm-server-config/account-management/change-admin-password.md index a793b84375..bbedb7c0f3 100644 --- a/docs/api/pmm-server-config/account-management/change-admin-password.md +++ b/docs/api/pmm-server-config/account-management/change-admin-password.md @@ -10,7 +10,7 @@ order: 0 Your new PMM Server will start up with a default set of credentials for the administrator account. When you first login via the UI, you will be prompted to change this to a new password in order to secure the account. -When automating the deployment and/or management of your PMM Server, it is prefereable to use the available APIs instead of relying upon human interaction. +When automating the deployment and/or management of your PMM Server, it is preferable to use the available APIs instead of relying upon human interaction. The [authentication](authentication) overview explains the different ways that you can programmatically access the API, using either [basic](authentication#basic-http-authentication), or [token-based](authentication#bearer-authentication) authentication. **Note:** for basic authentication, you can use the same approach for standard credentials if you haven't yet created a token. @@ -61,7 +61,7 @@ You can check this using Ansible with a task such as: ### Changing the password following initial installation -**Caution:** Once you have changed the password, you need to use the new password from then on. Should you be doing this for an account that is used elsewhere then you may find that the account gets blocked due to too many failed login attemps. You should disconnect any clients using the same account before proceeding to avoid such issues. +**Caution:** Once you have changed the password, you need to use the new password from then on. Should you be doing this for an account that is used elsewhere then you may find that the account gets blocked due to too many failed login attempts. You should disconnect any clients using the same account before proceeding to avoid such issues. The [payload](https://grafana.com/docs/grafana/latest/http_api/user/#change-password) for changing a user's password is: ```json diff --git a/docs/api/pmm-server-config/account-management/create-user-accounts.md b/docs/api/pmm-server-config/account-management/create-user-accounts.md index 1eb51050cc..f45f78a0d3 100644 --- a/docs/api/pmm-server-config/account-management/create-user-accounts.md +++ b/docs/api/pmm-server-config/account-management/create-user-accounts.md @@ -41,7 +41,7 @@ $ curl --silent -X POST --netrc \ {"id":2,"message":"User created"} ``` -This can be acheived with Ansible with a task such as: +This can be achieved with Ansible with a task such as: ```yaml - name: Create a new user uri: diff --git a/docs/managed/data-model.md b/docs/managed/data-model.md index 2fa5e60f90..d6f490c77a 100644 --- a/docs/managed/data-model.md +++ b/docs/managed/data-model.md @@ -351,4 +351,4 @@ Add, Change and Remove APIs work with groups of objects and contain validation l **PostgreSQL**. Nodes, Services, and Agents are stored in three separate tables. We use [Single Table Inheritance](https://www.martinfowler.com/eaaCatalog/singleTableInheritance.html) to store various types of Nodes/Services/Agents in the same table. There are two more tables for relationships between Agents and Nodes, and Agents and Services. -Whatever column should be defined as NOT NULL depends on wether unique index is required. +Whatever column should be defined as NOT NULL depends on whether unique index is required. diff --git a/docs/managed/update-process.md b/docs/managed/update-process.md index 930fc4f006..16f9d621b7 100644 --- a/docs/managed/update-process.md +++ b/docs/managed/update-process.md @@ -10,7 +10,7 @@ This performs the following actions: **Notes** - `pmm-update` does not handle rollbacks in case of errors -- `pmm-update` requires root priveleges to run +- `pmm-update` requires root privileges to run ## Testing a custom pmm-update build diff --git a/docs/process/best_practices.md b/docs/process/best_practices.md index 62f666a745..62ab1ad1a0 100644 --- a/docs/process/best_practices.md +++ b/docs/process/best_practices.md @@ -22,7 +22,7 @@ After startup, during normal program execution, most errors should be handled, logged and communicated to the user. For example, REST API call should return an appropriate HTTP status code with error details; full details should be logged. The caller can then handle the problem and retry the call. If an external resource becomes unavailable, the program should try to reconnect to it with proper backoff policy. The supervisor should still be used to handle crashes, panics, and bugs. - - Issues detected at program initializtion phase - such as a missing external dependency or a port, which is already in use - is either a configuration or an environment problem, or a programming bug. Neither can be fixed by simply continuing. Attempts to make startup "smart" (re-read configuration file, re-parse command-line flags, etc.) significantly complicate it. On the other hand, when an error happens during normal program execution, there is usually a proper way to communicate it back to the user so they can retry. + - Issues detected at program initialization phase - such as a missing external dependency or a port, which is already in use - is either a configuration or an environment problem, or a programming bug. Neither can be fixed by simply continuing. Attempts to make startup "smart" (re-read configuration file, re-parse command-line flags, etc.) significantly complicate it. On the other hand, when an error happens during normal program execution, there is usually a proper way to communicate it back to the user so they can retry. - Supervisor-level dependencies between services are not strictly required (due to restarts everything will work eventually), but are nice to have: they help avoid scarry errors in logs. - The big exception is exporters: we should follow practices established by the Prometheus community and not fail if the system under monitoring is not available. Other startup errors, like a missing certificate file, should still terminate the exporter. diff --git a/documentation/docs/alert/contact_points.md b/documentation/docs/alert/contact_points.md index ebb7ddeb3e..28b6e3e88e 100644 --- a/documentation/docs/alert/contact_points.md +++ b/documentation/docs/alert/contact_points.md @@ -97,7 +97,7 @@ To edit the root notification policy: {.power-number} 1. Go to **Alerting > Notification policies** tab. -2. Click the ellipsis botton next to the root policy box and select the **Edit** option. +2. Click the ellipsis button next to the root policy box and select the **Edit** option. 3. Choose whether to keep the default Email contact point, select a new available contact point or create a new one. 4. In the **Group by** field, specify how alert rules should be processed into notifications. If multiple alerts are matched for this policy, they will be grouped based on the labels you specify, and a notification will be sent per group. 5. Expand the **Timing options** section and specify how notification wait times should be processed. These are short pauses the system can take to efficiently process multiple sets of alerts for notifications: diff --git a/documentation/docs/alert/silence_alerts.md b/documentation/docs/alert/silence_alerts.md index e222e22d92..0fa5855b9e 100644 --- a/documentation/docs/alert/silence_alerts.md +++ b/documentation/docs/alert/silence_alerts.md @@ -7,7 +7,7 @@ You can also schedule a silence for a future date and time. This is referred to During a silence, PMM continues to track metrics but does not trigger alerts or send notifications to any specified contact points. Once the silence expires alerts and notifications will resume. -Silenced alerts are still recorded under **Alerting > Fired Alerts** so that you can review them later. Silenced alerts show up as **Surpressed** and are disabled for as long as it's specified in the **Silence Duration**, or until you remove a silence. +Silenced alerts are still recorded under **Alerting > Fired Alerts** so that you can review them later. Silenced alerts show up as **Suppressed** and are disabled for as long as it's specified in the **Silence Duration**, or until you remove a silence. ## Using silences diff --git a/documentation/docs/install-pmm/HA.md b/documentation/docs/install-pmm/HA.md index 6052d56a85..890d2a4ac8 100644 --- a/documentation/docs/install-pmm/HA.md +++ b/documentation/docs/install-pmm/HA.md @@ -125,7 +125,7 @@ To set up ClickHouse: clickhouse/clickhouse-server:23.8.2.7-alpine ``` - === "Run services on a seperate instance" + === "Run services on a separate instance" ```sh docker run -d \ @@ -186,7 +186,7 @@ To set up VictoriaMetrics: --influxListenAddr=:8089 ``` - === "Run services on a seperate instance" + === "Run services on a separate instance" ```sh docker run -d \ @@ -265,7 +265,7 @@ To set up PostgreSQL: 6. Run the PostgreSQL container. - You can either run all the services on the same instance or on a seperate instance. + You can either run all the services on the same instance or on a separate instance. !!! note alert alert-primary "Note" It is recommended to use absolute paths instead of relative paths for volume mounts. @@ -286,7 +286,7 @@ To set up PostgreSQL: postgres -c shared_preload_libraries=pg_stat_statements ``` - === "Run services on a seperate instance" + === "Run services on a separate instance" ```sh docker run -d \ @@ -360,7 +360,7 @@ The PMM Server orchestrates the collection, storage, and visualization of metric ${PMM_DOCKER_IMAGE} ``` - === "Run services on a seperate instance" + === "Run services on a separate instance" ```sh docker run -d \ @@ -430,7 +430,7 @@ The PMM Server orchestrates the collection, storage, and visualization of metric ${PMM_DOCKER_IMAGE} ``` - === "Run services on a seperate instance" + === "Run services on a separate instance" ```sh docker run -d \ @@ -500,7 +500,7 @@ The PMM Server orchestrates the collection, storage, and visualization of metric ${PMM_DOCKER_IMAGE} ``` - === "Run services on a seperate instance" + === "Run services on a separate instance" ```sh docker run -d \ diff --git a/documentation/docs/install-pmm/install-pmm-client/connect-database/mongodb.md b/documentation/docs/install-pmm/install-pmm-client/connect-database/mongodb.md index 611cdfc498..90b1991eb5 100644 --- a/documentation/docs/install-pmm/install-pmm-client/connect-database/mongodb.md +++ b/documentation/docs/install-pmm/install-pmm-client/connect-database/mongodb.md @@ -242,7 +242,7 @@ where: ### From the user interface -To check the servie from the UI: +To check the service from the UI: {.power-number} 1. Select **PMM Configuration > Inventory > MongoDB**. diff --git a/documentation/docs/install-pmm/plan-pmm-installation/hardware_and_system.md b/documentation/docs/install-pmm/plan-pmm-installation/hardware_and_system.md index a34b7e89e8..b9cae292b4 100644 --- a/documentation/docs/install-pmm/plan-pmm-installation/hardware_and_system.md +++ b/documentation/docs/install-pmm/plan-pmm-installation/hardware_and_system.md @@ -22,7 +22,7 @@ * **Disk** - A minimum of 100 MB of storage is required for installing the PMM Client package. With a good connection to PMM Server, additional storage is not required. However, the client needs to store any collected data that it cannot dispatch immediately, so additional storage may be required if the connection is unstable or the throughput is low. VMagent uses 1 GB of disk space for cache during a network outage. QAN, on the other hand, uses RAM to store cache. + A minimum of 100 MB of storage is required for installing the PMM Client package. With a good connection to PMM Server, additional storage is not required. However, the client needs to store any collected data that it cannot dispatch immediately, so additional storage may be required if the connection is unstable or the throughput is low. VM Agent uses 1 GB of disk space for cache during a network outage. QAN, on the other hand, uses RAM to store cache. * **Operating system** diff --git a/documentation/docs/install-pmm/plan-pmm-installation/network_and_firewall.md b/documentation/docs/install-pmm/plan-pmm-installation/network_and_firewall.md index b5387b8207..064ffa0ef7 100644 --- a/documentation/docs/install-pmm/plan-pmm-installation/network_and_firewall.md +++ b/documentation/docs/install-pmm/plan-pmm-installation/network_and_firewall.md @@ -28,7 +28,7 @@ Other ports: Depending on your architecture other ports may also need to be exposed. - For `pmm-agent`, the default listen port is 7777. - - The default port range for `pmm-agent` is large by default to accomodate any architecture size but it can be modified using the `--ports-min` and `--ports-max` flags, or modifying the configuration file. In network constraint environments, the range can be reduced to a minimum by allocating at least one port per agent monitored. Learn more about available settings for `pmm-agent` in [Percona PMM-Agent documentation](https://docs.percona.com/percona-monitoring-and-management/details/commands/pmm-agent.html). + - The default port range for `pmm-agent` is large by default to accommodate any architecture size but it can be modified using the `--ports-min` and `--ports-max` flags, or modifying the configuration file. In network constraint environments, the range can be reduced to a minimum by allocating at least one port per agent monitored. Learn more about available settings for `pmm-agent` in [Percona PMM-Agent documentation](https://docs.percona.com/percona-monitoring-and-management/details/commands/pmm-agent.html). ## Network configuration for locked-down environments For computers in a locked-down corporate environment without direct access to the Internet, make sure to enable access to Percona Platform services following the instructions in the [Percona Platform documentation](https://docs.percona.com/percona-platform/network.html). \ No newline at end of file diff --git a/documentation/docs/reference/dashboards/dashboard-environent-summary.md b/documentation/docs/reference/dashboards/dashboard-environment-summary.md similarity index 100% rename from documentation/docs/reference/dashboards/dashboard-environent-summary.md rename to documentation/docs/reference/dashboards/dashboard-environment-summary.md diff --git a/documentation/docs/reference/dashboards/dashboard-postgresql-vacuum-monitoring-experimental.md b/documentation/docs/reference/dashboards/dashboard-postgresql-vacuum-monitoring-experimental.md index c77488ff04..7aed5ac077 100644 --- a/documentation/docs/reference/dashboards/dashboard-postgresql-vacuum-monitoring-experimental.md +++ b/documentation/docs/reference/dashboards/dashboard-postgresql-vacuum-monitoring-experimental.md @@ -7,7 +7,7 @@ ![!image](../../images/PMM_PostgreSQL_vacuum_monitor-experimental.png) -This dashbaord provides timely insights into the autovacuum process in PostgreSQL. +This dashboard provides timely insights into the autovacuum process in PostgreSQL. This dashboard contains the following: diff --git a/documentation/docs/reference/personal_data_handling.md b/documentation/docs/reference/personal_data_handling.md index 8ccebcb5d2..3d8ae69ae5 100644 --- a/documentation/docs/reference/personal_data_handling.md +++ b/documentation/docs/reference/personal_data_handling.md @@ -9,7 +9,7 @@ The following questions are being answered related to personal and confidential |**Data collection source** | **Data collected** | | --------------------------------------------------------------- | ------------------------------------------------------ | DB host to PMM | Database performance metrics
SQL query examples for query analytics (optional). - | PMM to DB Host | DSN and credentials for database access. A separate DB user is used (limited access) to retreive metrics from the database. + | PMM to DB Host | DSN and credentials for database access. A separate DB user is used (limited access) to retrieve metrics from the database. | DB Host to S3 compatible storage location | Database backup - optional if PMM Administrator configures it with Public Cloud (AWS, GCP, etc) as a possible storage location. | PMM Server to Percona Cloud | Telemetry data is collected.
PMM Server collects varying amounts of data from version to version, and no personal or confidential information is collected. See [here](https://docs.percona.com/percona-monitoring-and-management/how-to/configure.html#telemetry) for details on the data being transmitted. diff --git a/documentation/docs/reference/ui/ui_components.md b/documentation/docs/reference/ui/ui_components.md index 870189e59d..8edbc1c55f 100644 --- a/documentation/docs/reference/ui/ui_components.md +++ b/documentation/docs/reference/ui/ui_components.md @@ -16,7 +16,7 @@ The main menu is part of the Grafana framework and is visible on every page. | | Dashboards | Create dashboards or [folders][Folders], manage dashboards, import dashboards, create playlists, manage snapshots. | | Explore | Run queries with [PromQL]. | | Operating System (OS) | Operating System dashboard -| ![!image](../../images/mysql-dashboard.png) ![!image](../../images/haproxy-dashboard.png) ![!image](../../images/postresql-dashboard.png) | Service Type dashboards | Navigate to the dasboards available for the [services added for monitoring](../../install-pmm/install-pmm-client/connect-database/index.md) (MySQL, MongoDB, PostgreSQL, HAproxy or ProxySQL). +| ![!image](../../images/mysql-dashboard.png) ![!image](../../images/haproxy-dashboard.png) ![!image](../../images/postresql-dashboard.png) | Service Type dashboards | Navigate to the dashboards available for the [services added for monitoring](../../install-pmm/install-pmm-client/connect-database/index.md) (MySQL, MongoDB, PostgreSQL, HAproxy or ProxySQL). | | Query Analytics (QAN) | Navigate to the Query Analytics dashboard where you can analyze database queries over time, optimize database performance, and identify the source of problems. | | Alerting | [Alerting](../../alert/index.md), Create new alerts and manage your alert rules and alert templates. | | Advisors | Run health assessment checks against your connected databases and check any failed checks. diff --git a/documentation/docs/troubleshoot/index.md b/documentation/docs/troubleshoot/index.md index 2436a9cd71..b1b04c58bc 100644 --- a/documentation/docs/troubleshoot/index.md +++ b/documentation/docs/troubleshoot/index.md @@ -2,7 +2,7 @@ This section provides comprehensive solutions to common issues and scenarios that may arise while using PMM, including a [checklist](checklist.md). -To quickly identify the isssues and find the appropriate solution, the issues are categorized into distinct groups as follows: +To quickly identify the issues and find the appropriate solution, the issues are categorized into distinct groups as follows: - [Upgrade issues](upgrade_issues.md) - [Configuration issues](config_issues.md) diff --git a/documentation/docs/use/dashboard-inventory.md b/documentation/docs/use/dashboard-inventory.md index 650192036f..167da7f01b 100644 --- a/documentation/docs/use/dashboard-inventory.md +++ b/documentation/docs/use/dashboard-inventory.md @@ -25,7 +25,7 @@ The **Services** tab displays the individual services, the nodes on which they r #### Attributes -These are some of the atributes for a service: +These are some of the attributes for a service: - Each instance of a service gets a `service_type` attribute so one can clearly tell what type of database it is, for instance: `mysql`, `postgresql`, `mongodb`, etc. @@ -92,7 +92,7 @@ Editing existing labels can impact the following PMM functions: Update the alert rules promptly after editing the labels for a smooth alerting experience. -- **Scheduled backup**s: Editing the cluster label will remove all scheduled backups for the imapcted service or cluster. +- **Scheduled backup**s: Editing the cluster label will remove all scheduled backups for the impacted service or cluster. To prevent any issues, make sure to recreate your backups once you've configured the cluster. diff --git a/documentation/docs/use/dashboards-panels/manage-dashboards/manage-folders.md b/documentation/docs/use/dashboards-panels/manage-dashboards/manage-folders.md index b615c6b777..2fcfc90dd0 100644 --- a/documentation/docs/use/dashboards-panels/manage-dashboards/manage-folders.md +++ b/documentation/docs/use/dashboards-panels/manage-dashboards/manage-folders.md @@ -23,8 +23,8 @@ The other way of moving dashboards from one folder to another is: {.power-number} 1. On the **Dashboards** page, click on the dashboard that you want to move to another folder. -2. Click on Dasboard settings icon at the top of the page. -3. On the **General** tab, use the **Folder** drop-down menu to select the new taget folder. +2. Click on Dashboard settings icon at the top of the page. +3. On the **General** tab, use the **Folder** drop-down menu to select the new target folder. 4. Click **Save Dashboard** on the the left to save the change. ![!image](../../../images/PMM_Move_dashboards-way2.png) diff --git a/documentation/docs/use/dashboards/dashboard-manage-dashboards.md b/documentation/docs/use/dashboards/dashboard-manage-dashboards.md index 45043a3df7..21b7b66481 100644 --- a/documentation/docs/use/dashboards/dashboard-manage-dashboards.md +++ b/documentation/docs/use/dashboards/dashboard-manage-dashboards.md @@ -41,7 +41,7 @@ To delete multiple dashboards at once: To move dashboards from one folder to another (requires **Editor** rights): -#### From the Dasboards page +#### From the Dashboards page 1. On the **Dashboards** page, enter the name of the dashboard you want to move in the search bar. 2. Check the box next to the dashboard name. diff --git a/documentation/docs/use/dashboards/index.md b/documentation/docs/use/dashboards/index.md index 306cba53d4..951c49e218 100644 --- a/documentation/docs/use/dashboards/index.md +++ b/documentation/docs/use/dashboards/index.md @@ -69,7 +69,7 @@ [VictoriaMetrics Agents Overview]: dashboard-victoriametrics-agents-overview.md [PMM Inventory]: dashboard-inventory.md [Environment Overview]: dashboard-env-overview.md -[Environment Summary]: dashboard-environent-summary.md +[Environment Summary]: dashboard-environment-summary.md [CPU Utilization Details]: dashboard-cpu-utilization-details.md [Disk Details]: dashboard-disk-details.md [Network Details]: dashboard-network-details.md diff --git a/managed/CONTRIBUTING.md b/managed/CONTRIBUTING.md index 9851aaa460..0cdcff9b25 100644 --- a/managed/CONTRIBUTING.md +++ b/managed/CONTRIBUTING.md @@ -56,7 +56,7 @@ go test -timeout=30s -p 1 ./... | Variable | Description | Default | |------------------------------------------|---------------------------------------------------------------------------------------------------------------------|------------------------------------------| | PMM_DEV_ADVISOR_STARLARK_ALLOW_RECURSION | Allows recursive functions in checks scripts | false | -| PMM_DEV_ADVISOR_CHECKS_FILE | Specifies path to local checks file and disables downlading checks files from Percona Platform | none | +| PMM_DEV_ADVISOR_CHECKS_FILE | Specifies path to local checks file and disables downloading checks files from Percona Platform | none | | PMM_ADVISOR_CHECKS_DISABLE_START_DELAY | Disables checks service startup delay | false | | PMM_DEV_TELEMETRY_INTERVAL | Sets telemetry reporting interval | 24h | | PMM_DEV_TELEMETRY_DISABLE_SEND | Disables sending of telemetry data to SaaS. This param doesn't affect telemetry data gathering from the datasources | false | diff --git a/qan-api2/README.md b/qan-api2/README.md index 4b63222e6e..6e3275b844 100644 --- a/qan-api2/README.md +++ b/qan-api2/README.md @@ -28,7 +28,7 @@ curl -s -X POST -d '{"period_start_from": "2019-01-01T00:00:00Z", "period_start_ curl -X POST -d '{"period_start_from": "2019-01-01T00:00:00Z", "period_start_to": "2019-01-01T10:00:00Z"}' http://127.0.0.1:9922/v1/qan/metrics:getFilters ``` -## Get list of availible metrics. +## Get list of available metrics. ```bash curl -s -X POST -d '{}' http://127.0.0.1:9922/v1/qan/metrics:getNames | jq` @@ -84,7 +84,7 @@ curl -s -X POST -d '{}' http://127.0.0.1:9922/v1/qan/metrics:getNames | jq` } ``` -## Get Query Exemples +## Get Query Examples `curl 'http://localhost:9922/v1/qan/query:getExample ' -X POST -d '{"filter_by":"1D410B4BE5060972","group_by":"queryid","limit":5,"period_start_from":"2018-12-31T22:00:00+00:00","period_start_to":"2019-01-01T06:00:00+00:00"}' -s | jq` From ee9720fba28f98b8df9bc1e38bfc08987b797847 Mon Sep 17 00:00:00 2001 From: Alex Demidoff Date: Sat, 28 Dec 2024 15:59:50 +0300 Subject: [PATCH 3/9] PMM-13483 Refactor pmm-update (#3317) * PMM-13483 Remove pmm-update.spec * PMM-13483 Remove pmm-update package * PMM-13483 Use same syntax * PMM-13483 Rename pmm-update.log to pmm-init.log * PMM-13483 Don't stop Grafana * PMM-13483 Reorder the logs in the test * PMM-13483 Start grafana only when it was successfully stopped * PMM-13483 Rename pmm-update to pmm-init * PMM-13483 Temp fix for grafana restart * PMM-13483 Clean up .gitignore * PMM-13483 Remove redundant when condition --- .github/workflows/update.yml | 79 --- .gitignore | 3 - CONTRIBUTING.md | 1 - api-tests/server/logs_test.go | 2 +- build/ansible/pmm-docker/init.yml | 2 +- build/ansible/roles/pmm-images/tasks/main.yml | 5 +- build/ansible/roles/supervisord/files/pmm.ini | 8 +- .../packages/rpm/server/SPECS/pmm-update.spec | 187 ----- build/scripts/build-server-rpm-all | 1 - build/scripts/utils/check-agent-setup.sh | 9 - docker-compose.yml | 3 - .../pmm-server-config/troubleshooting/logs.md | 2 +- docs/managed/update-process.md | 65 -- managed/services/server/logs_test.go | 2 +- managed/services/server/updater.go | 4 +- managed/services/supervisord/maintail_test.go | 36 +- managed/services/supervisord/pmm_config.go | 8 +- .../services/supervisord/supervisord_test.go | 4 +- .../supervisord.d/pmm-db_disabled.ini | 8 +- .../testdata/supervisord.d/pmm-db_enabled.ini | 8 +- update/.devcontainer/install-dev-tools.sh | 50 -- update/LICENSE | 661 ------------------ update/Makefile | 73 -- update/README.md | 8 - update/ansible/.gitkeep | 0 update/docker-compose.yml | 13 - update/main.go | 98 --- update/main_test.go | 46 -- update/maincover_test.go | 27 - update/pkg/ansible/ansible.go | 59 -- update/pkg/ansible/ansible_test.go | 39 -- update/pkg/run/run.go | 90 --- update/pkg/run/run_test.go | 38 - version/update.go | 7 +- 34 files changed, 45 insertions(+), 1601 deletions(-) delete mode 100644 .github/workflows/update.yml delete mode 100644 build/packages/rpm/server/SPECS/pmm-update.spec delete mode 100755 build/scripts/utils/check-agent-setup.sh delete mode 100644 docs/managed/update-process.md delete mode 100755 update/.devcontainer/install-dev-tools.sh delete mode 100644 update/LICENSE delete mode 100644 update/Makefile delete mode 100644 update/README.md delete mode 100644 update/ansible/.gitkeep delete mode 100644 update/docker-compose.yml delete mode 100644 update/main.go delete mode 100644 update/main_test.go delete mode 100644 update/maincover_test.go delete mode 100644 update/pkg/ansible/ansible.go delete mode 100644 update/pkg/ansible/ansible_test.go delete mode 100644 update/pkg/run/run.go delete mode 100644 update/pkg/run/run_test.go diff --git a/.github/workflows/update.yml b/.github/workflows/update.yml deleted file mode 100644 index 2b5fa08b2c..0000000000 --- a/.github/workflows/update.yml +++ /dev/null @@ -1,79 +0,0 @@ -name: Update - -on: - push: - branches: - - main - - v3 - - pmm-* - tags: - - v[0-9]+.[0-9]+.[0-9]+* - paths-ignore: - - "documentation/**" - - pull_request: - paths-ignore: - - "admin/**" - - "agent/**" - - "api-tests/**" - - "cli-tests/**" - - "docs/**" - - "documentation/**" - - "managed/**" - - "qan-api2/**" - - "vmproxy/**" - - "ui/**" - -permissions: - contents: read - -jobs: - build: - name: Build - if: false - - strategy: - fail-fast: false - matrix: - image: - - perconalab/pmm-server:3-dev-latest # latest development version - - env: - PMM_SERVER_IMAGE: ${{ matrix.image }} - - runs-on: ubuntu-22.04 - - defaults: - run: - working-directory: ${{ github.workspace }}/update - - steps: - - name: Check out code - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - - - name: Docker Up - run: docker compose up -d - - - name: Install dev tools in container - run: docker exec pmm-update-server /root/go/src/github.com/percona/pmm/update/.devcontainer/install-dev-tools.sh - - - name: Run install - run: docker exec pmm-update-server make -C /root/go/src/github.com/percona/pmm/update install - - - name: Run license check and ansible checks - run: docker exec pmm-update-server make -C /root/go/src/github.com/percona/pmm/update check - - - name: Run tests - run: docker exec pmm-update-server make -C /root/go/src/github.com/percona/pmm/update test-race - - - name: Run with race detector and collect coverage information - run: docker exec pmm-update-server make -C /root/go/src/github.com/percona/pmm/update run-race-cover RUN_FLAGS='-debug -check' - - - name: Upload coverage results - uses: codecov/codecov-action@5c47607acb93fed5485fdbf7232e8a31425f672a # v5.0.2 - with: - file: cover.out - flags: update - fail_ci_if_error: false - token: ${{ secrets.CODECOV_TOKEN }} - diff --git a/.gitignore b/.gitignore index 67cdecb663..2d01020e57 100644 --- a/.gitignore +++ b/.gitignore @@ -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 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 954fc9b906..b5add1d313 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -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 diff --git a/api-tests/server/logs_test.go b/api-tests/server/logs_test.go index 0e09e84b4b..5d1bc08790 100644 --- a/api-tests/server/logs_test.go +++ b/api-tests/server/logs_test.go @@ -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", diff --git a/build/ansible/pmm-docker/init.yml b/build/ansible/pmm-docker/init.yml index 19c1227bc4..a424754ee6 100644 --- a/build/ansible/pmm-docker/init.yml +++ b/build/ansible/pmm-docker/init.yml @@ -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 diff --git a/build/ansible/roles/pmm-images/tasks/main.yml b/build/ansible/roles/pmm-images/tasks/main.yml index 4462a88678..78b7931012 100644 --- a/build/ansible/roles/pmm-images/tasks/main.yml +++ b/build/ansible/roles/pmm-images/tasks/main.yml @@ -92,7 +92,6 @@ - percona-qan-api2 - percona-dashboards - pmm-managed - - pmm-update - pmm-dump - vmproxy state: installed @@ -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" diff --git a/build/ansible/roles/supervisord/files/pmm.ini b/build/ansible/roles/supervisord/files/pmm.ini index 9facb3cbb9..d29349618e 100644 --- a/build/ansible/roles/supervisord/files/pmm.ini +++ b/build/ansible/roles/supervisord/files/pmm.ini @@ -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 @@ -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 diff --git a/build/packages/rpm/server/SPECS/pmm-update.spec b/build/packages/rpm/server/SPECS/pmm-update.spec deleted file mode 100644 index e68fc9f55d..0000000000 --- a/build/packages/rpm/server/SPECS/pmm-update.spec +++ /dev/null @@ -1,187 +0,0 @@ -%undefine _missing_build_ids_terminate_build - -# TODO: remove it as soon as we remove all noarch pmm-update rpms -# from 'pmm3-components/yum/laboratory' -%define _binaries_in_noarch_packages_terminate_build 0 -%define _unpackaged_files_terminate_build 0 - -%global repo pmm -%global provider github.com/percona/%{repo} -%global import_path %{provider} -%global commit 592eddf656bce32a11bd958af0a32c62bd5ea34c -%global shortcommit %(c=%{commit}; echo ${c:0:7}) -%define build_timestamp %(date -u +"%y%m%d%H%M") -%define release 67 -%define rpm_release %{release}.%{build_timestamp}.%{shortcommit}%{?dist} - -# the line below is sed'ed by build/bin/build-server-rpm to set a correct version -%define full_pmm_version 2.0.0 - -Name: pmm-update -Version: %{full_pmm_version} -Release: %{rpm_release} -Summary: Tool for updating packages and OS configuration for PMM Server - -License: AGPLv3 -URL: https://%{provider} -Source0: https://%{provider}/archive/%{commit}/%{repo}-%{shortcommit}.tar.gz - -BuildArch: noarch - -%description -%{summary} - - -%prep -%setup -q -n %{repo}-%{commit} -mkdir -p src/github.com/percona -ln -s $(pwd) src/%{provider} - -%build -export PMM_RELEASE_VERSION=%{full_pmm_version} -export PMM_RELEASE_FULLCOMMIT=%{commit} -export PMM_RELEASE_BRANCH="" - -cd src/github.com/percona/pmm/update -make release - - -%install -install -d %{buildroot}%{_datadir}/%{name} -cp -pav ./update/ansible %{buildroot}%{_datadir}/%{name} - -install -d %{buildroot}%{_sbindir} -cd src/github.com/percona/pmm/update -install -p -m 0755 bin/pmm-update %{buildroot}%{_sbindir}/ - - -%files -%license LICENSE -%doc README.md -%{_sbindir}/pmm-update -%{_datadir}/%{name} - - -%changelog -* Thu Dec 8 2022 Michal Kralik - 2.34.0-67 -- PMM-11207 Migrate pmm-update to monorepo - -* Mon May 16 2022 Nikita Beletskii - 2.29.0-1 -- https://per.co.na/pmm/latest - -* Tue Oct 19 2021 Nikita Beletskii - 2.23.0-64 -- https://per.co.na/pmm/latest - -* Tue Oct 19 2021 Nikita Beletskii - 2.23.0-63 -- https://per.co.na/pmm/2.23.0 - -* Tue Sep 21 2021 Nikita Beletskii - 2.22.0-62 -- https://per.co.na/pmm/2.22.0 - -* Thu Aug 26 2021 Nurlan Moldomurov - 2.21.0-61 -- https://per.co.na/pmm/2.21.0 - -* Tue Jul 27 2021 Nurlan Moldomurov - 2.20.0-60 -- https://per.co.na/pmm/2.20.0 - -* Wed Jun 30 2021 Denys Kondratenko - 2.19.0-59 -- https://per.co.na/pmm/2.19.0 - -* Tue Jun 01 2021 Nurlan Moldomurov - 2.18.0-57 -- https://per.co.na/pmm/2.18.0 - -* Tue May 11 2021 Nurlan Moldomurov - 2.17.0-56 -- https://per.co.na/pmm/2.17.0 - -* Thu Apr 15 2021 Nurlan Moldomurov - 2.16.0-54 -- https://per.co.na/pmm/2.16.0 - -* Thu Mar 18 2021 Nurlan Moldomurov - 2.15.1-53 -- https://per.co.na/pmm/2.15.1 - -* Thu Jan 28 2021 Nurlan Moldomurov - 2.14.0-52 -- https://per.co.na/pmm/2.14.1 - -* Thu Jan 28 2021 Nurlan Moldomurov - 2.14.0-51 -- https://per.co.na/pmm/2.14.0 - -* Tue Dec 29 2020 Nurlan Moldomurov - 2.13.0-49 -- https://per.co.na/pmm/2.13.0 - -* Tue Dec 01 2020 Nurlan Moldomurov - 2.12.0-46 -- https://per.co.na/pmm/2.12.0 - -* Mon Oct 19 2020 Nurlan Moldomurov - 2.11.1-45 -- https://per.co.na/pmm/2.11.1 - -* Wed Oct 14 2020 Nurlan Moldomurov - 2.11.0-44 -- https://per.co.na/pmm/2.11.0 - -* Tue Sep 22 2020 Nurlan Moldomurov - 2.10.1-43 -- https://per.co.na/pmm/2.10.1 - -* Tue Sep 15 2020 Nurlan Moldomurov - 2.10.0-41 -- https://per.co.na/pmm/2.10.0 - -* Tue Aug 04 2020 Nurlan Moldomurov - 2.9.1-39 -- https://per.co.na/pmm/2.9.1 - -* Tue Jul 14 2020 Nurlan Moldomurov - 2.9.0-37 -- https://per.co.na/pmm/2.9.0 - -* Thu Jul 2 2020 Mykyta Solomko - 2.6.1-35 -- PMM-5645 built using Golang 1.14 - -* Thu Jun 25 2020 Nurlan Moldomurov - 2.8.0-34 -- https://per.co.na/pmm/2.8.0 - -* Tue Jun 09 2020 Nurlan Moldomurov - 2.7.0-33 -- https://per.co.na/pmm/2.7.0 - -* Mon May 18 2020 Nurlan Moldomurov - 2.6.1-32 -- https://per.co.na/pmm/2.6.1 - -* Mon May 11 2020 Nurlan Moldomurov - 2.6.0-31 -- https://per.co.na/pmm/2.6.0 - -* Tue Apr 14 2020 Nurlan Moldomurov - 2.5.0-30 -- https://per.co.na/pmm/2.5.0 - -* Wed Mar 18 2020 Nurlan Moldomurov - 2.4.0-29 -- https://per.co.na/pmm/2.4.0 - -* Mon Feb 17 2020 Alexey Palazhchenko - 2.3.0-28 -- https://per.co.na/pmm/2.3.0 - -* Tue Feb 4 2020 Alexey Palazhchenko - 2.2.2-27 -- https://per.co.na/pmm/2.2.2 - -* Thu Jan 23 2020 Alexey Palazhchenko - 2.2.1-26 -- https://per.co.na/pmm/2.2.1 - -* Tue Dec 24 2019 Alexey Palazhchenko - 2.2.0-25 -- https://per.co.na/pmm/2.2.0 - -* Mon Nov 11 2019 Alexey Palazhchenko - 2.1.0-23 -- https://per.co.na/pmm/2.1.0 - -* Mon Sep 23 2019 Alexey Palazhchenko - 2.0.1-19 -- https://per.co.na/pmm/2.0.1 - -* Wed Sep 18 2019 Alexey Palazhchenko - 2.0.0-18 -- https://per.co.na/pmm/2.0.0 - -* Tue Sep 17 2019 Alexey Palazhchenko - 2.0.0-17.rc4 -- https://per.co.na/pmm/2.0.0-rc4 - -* Mon Sep 16 2019 Alexey Palazhchenko - 2.0.0-16.rc3 -- https://per.co.na/pmm/2.0.0-rc3 - -* Fri Sep 13 2019 Alexey Palazhchenko - 2.0.0-15.rc2 -- https://per.co.na/pmm/2.0.0-rc2 - -* Wed Sep 11 2019 Alexey Palazhchenko - 2.0.0-14.rc1 -- https://per.co.na/pmm/2.0.0-rc1 - -* Mon Sep 9 2019 Alexey Palazhchenko - 2.0.0-12.beta7 -- https://per.co.na/pmm/2.0.0-beta7 diff --git a/build/scripts/build-server-rpm-all b/build/scripts/build-server-rpm-all index e6accd289a..c82a6f6408 100755 --- a/build/scripts/build-server-rpm-all +++ b/build/scripts/build-server-rpm-all @@ -8,7 +8,6 @@ set -o xtrace ${bin_dir}/build-server-rpm percona-dashboards grafana-dashboards ${bin_dir}/build-server-rpm pmm-managed pmm ${bin_dir}/build-server-rpm percona-qan-api2 pmm -${bin_dir}/build-server-rpm pmm-update pmm ${bin_dir}/build-server-rpm pmm-dump ${bin_dir}/build-server-rpm vmproxy pmm diff --git a/build/scripts/utils/check-agent-setup.sh b/build/scripts/utils/check-agent-setup.sh deleted file mode 100755 index ea3def3714..0000000000 --- a/build/scripts/utils/check-agent-setup.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/bash - -# This script checks if PMM Server has finished upgrading so pmm-agent can perform the `setup` command. -# If PMM Server is not ready, the script will wait for 30 seconds and then exit with an error. - -if ! timeout 30 bash -c "until supervisorctl status pmm-update-perform-init | grep -q EXITED; do sleep 2; done"; then - echo "FATAL: failed to set up pmm-agent." - exit 1 -fi diff --git a/docker-compose.yml b/docker-compose.yml index 4089a5a73c..81196ee794 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -302,7 +302,6 @@ services: - go-modules:/root/go/pkg/mod - root-cache:/root/.cache - ./managed/testdata/pg/certs/:/certs/ - - ./update/ansible:/usr/share/pmm-update/ansible pmm-server-passive: profiles: @@ -382,7 +381,6 @@ services: - go-modules:/root/go/pkg/mod - root-cache:/root/.cache - ./managed/testdata/pg/certs/:/certs/ - - ./update/ansible:/usr/share/pmm-update/ansible pmm-server-passive-2: profiles: @@ -462,7 +460,6 @@ services: - go-modules:/root/go/pkg/mod - root-cache:/root/.cache - ./managed/testdata/pg/certs/:/certs/ - - ./update/ansible:/usr/share/pmm-update/ansible volumes: chdata: # Volume for ClickHouse data diff --git a/docs/api/pmm-server-config/troubleshooting/logs.md b/docs/api/pmm-server-config/troubleshooting/logs.md index d74c075a07..144c7f9a99 100644 --- a/docs/api/pmm-server-config/troubleshooting/logs.md +++ b/docs/api/pmm-server-config/troubleshooting/logs.md @@ -28,7 +28,7 @@ The downloaded logs package contains the following structure: { "codes": [ { - "code": "# tree\n├── clickhouse-server.err.log\n├── clickhouse-server.log\n├── clickhouse-server.startup.log\n├── client\n│ ├── list.txt\n│ ├── pmm-admin-version.txt\n│ ├── pmm-agent-config.yaml\n│ ├── pmm-agent-version.txt\n│ └── status.json\n├── cron.log\n├── dashboard-upgrade.log\n├── grafana.log\n├── installed.json\n├── nginx.conf\n├── nginx.log\n├── nginx.startup.log\n├── pmm-agent.log\n├── pmm-agent.yaml\n├── pmm-managed.log\n├── pmm-ssl.conf\n├── pmm-update-perform-init.log\n├── pmm-version.txt\n├── pmm.conf\n├── pmm.ini\n├── postgresql.log\n├── postgresql.startup.log\n├── prometheus.base.yml\n├── prometheus.log\n├── qan-api2.ini\n├── qan-api2.log\n├── supervisorctl_status.log\n├── supervisord.conf\n├── supervisord.log\n├── systemctl_status.log\n├── victoriametrics-promscrape.yml\n├── victoriametrics.ini\n├── victoriametrics.log\n├── victoriametrics_targets.json\n├── vmalert.ini\n└── vmalert.log", + "code": "# tree\n├── clickhouse-server.err.log\n├── clickhouse-server.log\n├── clickhouse-server.startup.log\n├── client\n│ ├── list.txt\n│ ├── pmm-admin-version.txt\n│ ├── pmm-agent-config.yaml\n│ ├── pmm-agent-version.txt\n│ └── status.json\n├── cron.log\n├── dashboard-upgrade.log\n├── grafana.log\n├── installed.json\n├── nginx.conf\n├── nginx.log\n├── nginx.startup.log\n├── pmm-agent.log\n├── pmm-agent.yaml\n├── pmm-managed.log\n├── pmm-ssl.conf\n├── pmm-init.log\n├── pmm-version.txt\n├── pmm.conf\n├── pmm.ini\n├── postgresql.log\n├── postgresql.startup.log\n├── prometheus.base.yml\n├── prometheus.log\n├── qan-api2.ini\n├── qan-api2.log\n├── supervisorctl_status.log\n├── supervisord.conf\n├── supervisord.log\n├── systemctl_status.log\n├── victoriametrics-promscrape.yml\n├── victoriametrics.ini\n├── victoriametrics.log\n├── victoriametrics_targets.json\n├── vmalert.ini\n└── vmalert.log", "language": "text" } ] diff --git a/docs/managed/update-process.md b/docs/managed/update-process.md deleted file mode 100644 index 16f9d621b7..0000000000 --- a/docs/managed/update-process.md +++ /dev/null @@ -1,65 +0,0 @@ -# Update of PMM Server - -## Update process - -Update of PMM Server which includes `managed` and other components is triggered by sending a [StartUpdate](https://github.com/percona/pmm/blob/PMM-12673-protobuf-linters/api/server/v1/server.proto#L260) message. -This performs the following actions: -1. Runs [pmm-update](https://github.com/percona/pmm/tree/main/update) command to initiate an update -2. `pmm-update` first updates itself to the latest version and restarts -3. `pmm-update` then runs a set of Ansible tasks to update all other components - -**Notes** -- `pmm-update` does not handle rollbacks in case of errors -- `pmm-update` requires root privileges to run - -## Testing a custom pmm-update build - -When making changes to `pmm-update`, you can test if they work in the following way: - -1. Install an older version of PMM Server to trigger an option to upgrade. This can be achieved either by: - 1. Installing an older version or - 2. Enabling experimental repo which already has an RC build available. Run these commands in the docker container: - ```sh - sed -i -e 's^/release/^/experimental/^' /etc/yum.repos.d/pmm2-server.repo - percona-release enable pmm2-client experimental - yum makecache - ``` -2. Create a new rpm package with the updated `pmm-update`. Refer to [Building RPM package](#building-rpm-package) section below. -3. Copy the rpm package and enable the `local` repo. The `local` repo is available in the container by default and points to `/tmp/RPMS`. - ```sh - mkdir -p /tmp/RPMS - cp /tmp/RPMS - createrepo /tmp/RPMS/ - yum-config-manager --enable local - ``` - - The rpm file is usually in `/root/rpmbuild/RPMS/pmm-update/noarch/` -4. You can now trigger an update in the UI and it will install the latest `pmm-update` package - -## Building RPM package - -All steps are performed in the docker container. - -1. Install dependencies - ```sh - yum install -y \ - make gcc wget curl \ - rpmdevtools createrepo rpm-build yum-utils - ``` -2. Install go https://go.dev/doc/install -3. From the pmm repo, copy `build/packages/rpm/server/SPECS/pmm-update.spec` file to the container -4. Change the `pmm-update.spec` file: - 1. Update version to some high number, eg - ``` - %define full_pmm_version 150.0.0 - ``` - 2. Update commit hash to the hash of your `pmm-update` version. For this you need to have the commit already available in https://github.com/percona/pmm - ``` - %global commit 592eddf656bce32a11bd958af0a32c62bd5ea34c - ``` -5. Build the rpm package - ```sh - mkdir -p /root/rpmbuild/SOURCES - spectool -C /root/rpmbuild/SOURCES/ -g pmm-update.spec - rpmbuild --define '_rpmdir %{_topdir}/RPMS/pmm-update' --define 'dist .el7' -ba pmm-update.spec - ``` diff --git a/managed/services/server/logs_test.go b/managed/services/server/logs_test.go index 0b75ade526..a0b3d9c59f 100644 --- a/managed/services/server/logs_test.go +++ b/managed/services/server/logs_test.go @@ -44,7 +44,7 @@ var commonExpectedFiles = []string{ "pmm-agent.yaml", "pmm-managed.log", "pmm-ssl.conf", - "pmm-update-perform-init.log", + "pmm-init.log", "pmm-version.txt", "pmm.conf", "pmm.ini", diff --git a/managed/services/server/updater.go b/managed/services/server/updater.go index 52bed3e4e3..81d755d721 100644 --- a/managed/services/server/updater.go +++ b/managed/services/server/updater.go @@ -40,7 +40,7 @@ import ( ) const ( - pmmUpdatePerformLog = "/srv/logs/pmm-update-perform-init.log" + pmmInitLog = "/srv/logs/pmm-init.log" updateCheckInterval = 24 * time.Hour updateCheckResultFresh = updateCheckInterval + 10*time.Minute updateDefaultTimeout = 30 * time.Second @@ -422,7 +422,7 @@ func (up *Updater) UpdateLog(offset uint32) ([]string, uint32, error) { up.performM.Lock() defer up.performM.Unlock() - f, err := os.Open(pmmUpdatePerformLog) + f, err := os.Open(pmmInitLog) if err != nil { return nil, 0, errors.WithStack(err) } diff --git a/managed/services/supervisord/maintail_test.go b/managed/services/supervisord/maintail_test.go index 61d9373e9a..1461b74b08 100644 --- a/managed/services/supervisord/maintail_test.go +++ b/managed/services/supervisord/maintail_test.go @@ -70,15 +70,15 @@ func TestParseEvent(t *testing.T) { t.Parallel() log := strings.Split(` - 2019-08-09 09:18:25,667 INFO spawned: 'pmm-update-check' with pid 11410 - 2019-08-09 09:18:26,539 INFO exited: pmm-update-check (exit status 0; not expected) - 2019-08-09 09:18:27,543 INFO spawned: 'pmm-update-check' with pid 11421 - 2019-08-09 09:18:28,324 INFO exited: pmm-update-check (exit status 0; not expected) - 2019-08-09 09:18:30,335 INFO spawned: 'pmm-update-check' with pid 11432 - 2019-08-09 09:18:31,109 INFO exited: pmm-update-check (exit status 0; not expected) - 2019-08-09 09:18:34,119 INFO spawned: 'pmm-update-check' with pid 11443 - 2019-08-09 09:18:34,883 INFO exited: pmm-update-check (exit status 0; not expected) - 2019-08-09 09:18:35,885 INFO gave up: pmm-update-check entered FATAL state, too many start retries too quickly + 2019-08-09 09:18:25,667 INFO spawned: 'pmm-init' with pid 11410 + 2019-08-09 09:18:26,539 INFO exited: pmm-init (exit status 0; not expected) + 2019-08-09 09:18:27,543 INFO spawned: 'pmm-init' with pid 11421 + 2019-08-09 09:18:28,324 INFO exited: pmm-init (exit status 0; not expected) + 2019-08-09 09:18:30,335 INFO spawned: 'pmm-init' with pid 11432 + 2019-08-09 09:18:31,109 INFO exited: pmm-init (exit status 0; not expected) + 2019-08-09 09:18:34,119 INFO spawned: 'pmm-init' with pid 11443 + 2019-08-09 09:18:34,883 INFO exited: pmm-init (exit status 0; not expected) + 2019-08-09 09:18:35,885 INFO gave up: pmm-init entered FATAL state, too many start retries too quickly `, "\n") var actual []*event @@ -92,15 +92,15 @@ func TestParseEvent(t *testing.T) { } } expected := []*event{ - {Time: time.Date(2019, 8, 9, 9, 18, 25, 667000000, time.UTC), Type: starting, Program: "pmm-update-check"}, - {Time: time.Date(2019, 8, 9, 9, 18, 26, 539000000, time.UTC), Type: exitedUnexpected, Program: "pmm-update-check"}, - {Time: time.Date(2019, 8, 9, 9, 18, 27, 543000000, time.UTC), Type: starting, Program: "pmm-update-check"}, - {Time: time.Date(2019, 8, 9, 9, 18, 28, 324000000, time.UTC), Type: exitedUnexpected, Program: "pmm-update-check"}, - {Time: time.Date(2019, 8, 9, 9, 18, 30, 335000000, time.UTC), Type: starting, Program: "pmm-update-check"}, - {Time: time.Date(2019, 8, 9, 9, 18, 31, 109000000, time.UTC), Type: exitedUnexpected, Program: "pmm-update-check"}, - {Time: time.Date(2019, 8, 9, 9, 18, 34, 119000000, time.UTC), Type: starting, Program: "pmm-update-check"}, - {Time: time.Date(2019, 8, 9, 9, 18, 34, 883000000, time.UTC), Type: exitedUnexpected, Program: "pmm-update-check"}, - {Time: time.Date(2019, 8, 9, 9, 18, 35, 885000000, time.UTC), Type: fatal, Program: "pmm-update-check"}, + {Time: time.Date(2019, 8, 9, 9, 18, 25, 667000000, time.UTC), Type: starting, Program: "pmm-init"}, + {Time: time.Date(2019, 8, 9, 9, 18, 26, 539000000, time.UTC), Type: exitedUnexpected, Program: "pmm-init"}, + {Time: time.Date(2019, 8, 9, 9, 18, 27, 543000000, time.UTC), Type: starting, Program: "pmm-init"}, + {Time: time.Date(2019, 8, 9, 9, 18, 28, 324000000, time.UTC), Type: exitedUnexpected, Program: "pmm-init"}, + {Time: time.Date(2019, 8, 9, 9, 18, 30, 335000000, time.UTC), Type: starting, Program: "pmm-init"}, + {Time: time.Date(2019, 8, 9, 9, 18, 31, 109000000, time.UTC), Type: exitedUnexpected, Program: "pmm-init"}, + {Time: time.Date(2019, 8, 9, 9, 18, 34, 119000000, time.UTC), Type: starting, Program: "pmm-init"}, + {Time: time.Date(2019, 8, 9, 9, 18, 34, 883000000, time.UTC), Type: exitedUnexpected, Program: "pmm-init"}, + {Time: time.Date(2019, 8, 9, 9, 18, 35, 885000000, time.UTC), Type: fatal, Program: "pmm-init"}, } assert.Equal(t, expected, actual) }) diff --git a/managed/services/supervisord/pmm_config.go b/managed/services/supervisord/pmm_config.go index 432e22ea32..201ea104a9 100644 --- a/managed/services/supervisord/pmm_config.go +++ b/managed/services/supervisord/pmm_config.go @@ -87,8 +87,8 @@ password = dummy username = dummy password = dummy -[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 @@ -99,8 +99,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 {{- if not .DisableInternalDB }} diff --git a/managed/services/supervisord/supervisord_test.go b/managed/services/supervisord/supervisord_test.go index 679a26a6e3..54db042e9d 100644 --- a/managed/services/supervisord/supervisord_test.go +++ b/managed/services/supervisord/supervisord_test.go @@ -122,8 +122,8 @@ func TestParseStatus(t *testing.T) { for str, expected := range map[string]*bool{ `pmm-agent STOPPED Sep 20 08:55 AM`: pointer.ToBool(false), `pmm-managed RUNNING pid 826, uptime 0:19:36`: pointer.ToBool(true), - `pmm-update-perform-init EXITED Sep 20 07:42 AM`: nil, - `pmm-update-perform-init STARTING`: pointer.ToBool(true), // no last column in that case + `pmm-init EXITED Sep 20 07:42 AM`: nil, + `pmm-init STARTING`: pointer.ToBool(true), // no last column in that case } { assert.Equal(t, expected, parseStatus(str), "%q", str) } diff --git a/managed/testdata/supervisord.d/pmm-db_disabled.ini b/managed/testdata/supervisord.d/pmm-db_disabled.ini index 5e5f482897..efcc5bce88 100644 --- a/managed/testdata/supervisord.d/pmm-db_disabled.ini +++ b/managed/testdata/supervisord.d/pmm-db_disabled.ini @@ -8,8 +8,8 @@ password = dummy username = dummy password = dummy -[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 @@ -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 diff --git a/managed/testdata/supervisord.d/pmm-db_enabled.ini b/managed/testdata/supervisord.d/pmm-db_enabled.ini index bd0ca87ab8..000ca48a0a 100644 --- a/managed/testdata/supervisord.d/pmm-db_enabled.ini +++ b/managed/testdata/supervisord.d/pmm-db_enabled.ini @@ -8,8 +8,8 @@ password = dummy username = dummy password = dummy -[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 @@ -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 diff --git a/update/.devcontainer/install-dev-tools.sh b/update/.devcontainer/install-dev-tools.sh deleted file mode 100755 index a5d82c514f..0000000000 --- a/update/.devcontainer/install-dev-tools.sh +++ /dev/null @@ -1,50 +0,0 @@ -#!/bin/bash - -# See https://code.visualstudio.com/docs/remote/remote-overview -# and https://code.visualstudio.com/docs/remote/containers. - -set -m -set -o errexit -set -o xtrace - -# download (in the background) the same verison as used by PMM build process -curl -sSL https://dl.google.com/go/go1.23.2.linux-amd64.tar.gz -o /tmp/golang.tar.gz & - -# to install man pages -sed -i '/nodocs/d' /etc/yum.conf - -# enable experimental repository with latest development packages -sed -i'' -e 's^/release/^/experimental/^' /etc/yum.repos.d/pmm2-server.repo - -yum update -y percona-release -percona-release enable pmm2-client testing - -# reinstall with man pages -yum install -y yum rpm -yum reinstall -y yum rpm - -yum install -y git make pkgconfig ansible \ - mc tmux psmisc lsof which iproute \ - bash-completion \ - man man-pages - -yum --enablerepo=ol9_codeready_builder install -y gcc glibc-static ansible-lint - -fg || true -tar -C /usr/local -xzf /tmp/golang.tar.gz && rm -f /tmp/golang.tar.gz -update-alternatives --install "/usr/bin/go" "go" "/usr/local/go/bin/go" 0 -update-alternatives --set go /usr/local/go/bin/go -update-alternatives --install "/usr/bin/gofmt" "gofmt" "/usr/local/go/bin/gofmt" 0 -update-alternatives --set gofmt /usr/local/go/bin/gofmt -mkdir /root/go/bin -go env - -# use modules to install (in the background) tagged releases -cd $(mktemp -d) -go mod init tools -env GOPROXY=https://proxy.golang.org go get -v github.com/go-delve/delve/cmd/dlv@latest & - -cd /root/go/src/github.com/percona/pmm -make init - -fg || true diff --git a/update/LICENSE b/update/LICENSE deleted file mode 100644 index be3f7b28e5..0000000000 --- a/update/LICENSE +++ /dev/null @@ -1,661 +0,0 @@ - GNU AFFERO GENERAL PUBLIC LICENSE - Version 3, 19 November 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The GNU Affero General Public License is a free, copyleft license for -software and other kinds of works, specifically designed to ensure -cooperation with the community in the case of network server software. - - The licenses for most software and other practical works are designed -to take away your freedom to share and change the works. By contrast, -our General Public Licenses are intended to guarantee your freedom to -share and change all versions of a program--to make sure it remains free -software for all its users. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -them if you wish), that you receive source code or can get it if you -want it, that you can change the software or use pieces of it in new -free programs, and that you know you can do these things. - - Developers that use our General Public Licenses protect your rights -with two steps: (1) assert copyright on the software, and (2) offer -you this License which gives you legal permission to copy, distribute -and/or modify the software. - - A secondary benefit of defending all users' freedom is that -improvements made in alternate versions of the program, if they -receive widespread use, become available for other developers to -incorporate. Many developers of free software are heartened and -encouraged by the resulting cooperation. However, in the case of -software used on network servers, this result may fail to come about. -The GNU General Public License permits making a modified version and -letting the public access it on a server without ever releasing its -source code to the public. - - The GNU Affero General Public License is designed specifically to -ensure that, in such cases, the modified source code becomes available -to the community. It requires the operator of a network server to -provide the source code of the modified version running there to the -users of that server. Therefore, public use of a modified version, on -a publicly accessible server, gives the public access to the source -code of the modified version. - - An older license, called the Affero General Public License and -published by Affero, was designed to accomplish similar goals. This is -a different license, not a version of the Affero GPL, but Affero has -released a new version of the Affero GPL which permits relicensing under -this license. - - The precise terms and conditions for copying, distribution and -modification follow. - - TERMS AND CONDITIONS - - 0. Definitions. - - "This License" refers to version 3 of the GNU Affero General Public License. - - "Copyright" also means copyright-like laws that apply to other kinds of -works, such as semiconductor masks. - - "The Program" refers to any copyrightable work licensed under this -License. Each licensee is addressed as "you". "Licensees" and -"recipients" may be individuals or organizations. - - To "modify" a work means to copy from or adapt all or part of the work -in a fashion requiring copyright permission, other than the making of an -exact copy. The resulting work is called a "modified version" of the -earlier work or a work "based on" the earlier work. - - A "covered work" means either the unmodified Program or a work based -on the Program. - - To "propagate" a work means to do anything with it that, without -permission, would make you directly or secondarily liable for -infringement under applicable copyright law, except executing it on a -computer or modifying a private copy. Propagation includes copying, -distribution (with or without modification), making available to the -public, and in some countries other activities as well. - - To "convey" a work means any kind of propagation that enables other -parties to make or receive copies. Mere interaction with a user through -a computer network, with no transfer of a copy, is not conveying. - - An interactive user interface displays "Appropriate Legal Notices" -to the extent that it includes a convenient and prominently visible -feature that (1) displays an appropriate copyright notice, and (2) -tells the user that there is no warranty for the work (except to the -extent that warranties are provided), that licensees may convey the -work under this License, and how to view a copy of this License. If -the interface presents a list of user commands or options, such as a -menu, a prominent item in the list meets this criterion. - - 1. Source Code. - - The "source code" for a work means the preferred form of the work -for making modifications to it. "Object code" means any non-source -form of a work. - - A "Standard Interface" means an interface that either is an official -standard defined by a recognized standards body, or, in the case of -interfaces specified for a particular programming language, one that -is widely used among developers working in that language. - - The "System Libraries" of an executable work include anything, other -than the work as a whole, that (a) is included in the normal form of -packaging a Major Component, but which is not part of that Major -Component, and (b) serves only to enable use of the work with that -Major Component, or to implement a Standard Interface for which an -implementation is available to the public in source code form. A -"Major Component", in this context, means a major essential component -(kernel, window system, and so on) of the specific operating system -(if any) on which the executable work runs, or a compiler used to -produce the work, or an object code interpreter used to run it. - - The "Corresponding Source" for a work in object code form means all -the source code needed to generate, install, and (for an executable -work) run the object code and to modify the work, including scripts to -control those activities. However, it does not include the work's -System Libraries, or general-purpose tools or generally available free -programs which are used unmodified in performing those activities but -which are not part of the work. For example, Corresponding Source -includes interface definition files associated with source files for -the work, and the source code for shared libraries and dynamically -linked subprograms that the work is specifically designed to require, -such as by intimate data communication or control flow between those -subprograms and other parts of the work. - - The Corresponding Source need not include anything that users -can regenerate automatically from other parts of the Corresponding -Source. - - The Corresponding Source for a work in source code form is that -same work. - - 2. Basic Permissions. - - All rights granted under this License are granted for the term of -copyright on the Program, and are irrevocable provided the stated -conditions are met. This License explicitly affirms your unlimited -permission to run the unmodified Program. The output from running a -covered work is covered by this License only if the output, given its -content, constitutes a covered work. This License acknowledges your -rights of fair use or other equivalent, as provided by copyright law. - - You may make, run and propagate covered works that you do not -convey, without conditions so long as your license otherwise remains -in force. You may convey covered works to others for the sole purpose -of having them make modifications exclusively for you, or provide you -with facilities for running those works, provided that you comply with -the terms of this License in conveying all material for which you do -not control copyright. Those thus making or running the covered works -for you must do so exclusively on your behalf, under your direction -and control, on terms that prohibit them from making any copies of -your copyrighted material outside their relationship with you. - - Conveying under any other circumstances is permitted solely under -the conditions stated below. Sublicensing is not allowed; section 10 -makes it unnecessary. - - 3. Protecting Users' Legal Rights From Anti-Circumvention Law. - - No covered work shall be deemed part of an effective technological -measure under any applicable law fulfilling obligations under article -11 of the WIPO copyright treaty adopted on 20 December 1996, or -similar laws prohibiting or restricting circumvention of such -measures. - - When you convey a covered work, you waive any legal power to forbid -circumvention of technological measures to the extent such circumvention -is effected by exercising rights under this License with respect to -the covered work, and you disclaim any intention to limit operation or -modification of the work as a means of enforcing, against the work's -users, your or third parties' legal rights to forbid circumvention of -technological measures. - - 4. Conveying Verbatim Copies. - - You may convey verbatim copies of the Program's source code as you -receive it, in any medium, provided that you conspicuously and -appropriately publish on each copy an appropriate copyright notice; -keep intact all notices stating that this License and any -non-permissive terms added in accord with section 7 apply to the code; -keep intact all notices of the absence of any warranty; and give all -recipients a copy of this License along with the Program. - - You may charge any price or no price for each copy that you convey, -and you may offer support or warranty protection for a fee. - - 5. Conveying Modified Source Versions. - - You may convey a work based on the Program, or the modifications to -produce it from the Program, in the form of source code under the -terms of section 4, provided that you also meet all of these conditions: - - a) The work must carry prominent notices stating that you modified - it, and giving a relevant date. - - b) The work must carry prominent notices stating that it is - released under this License and any conditions added under section - 7. This requirement modifies the requirement in section 4 to - "keep intact all notices". - - c) You must license the entire work, as a whole, under this - License to anyone who comes into possession of a copy. This - License will therefore apply, along with any applicable section 7 - additional terms, to the whole of the work, and all its parts, - regardless of how they are packaged. This License gives no - permission to license the work in any other way, but it does not - invalidate such permission if you have separately received it. - - d) If the work has interactive user interfaces, each must display - Appropriate Legal Notices; however, if the Program has interactive - interfaces that do not display Appropriate Legal Notices, your - work need not make them do so. - - A compilation of a covered work with other separate and independent -works, which are not by their nature extensions of the covered work, -and which are not combined with it such as to form a larger program, -in or on a volume of a storage or distribution medium, is called an -"aggregate" if the compilation and its resulting copyright are not -used to limit the access or legal rights of the compilation's users -beyond what the individual works permit. Inclusion of a covered work -in an aggregate does not cause this License to apply to the other -parts of the aggregate. - - 6. Conveying Non-Source Forms. - - You may convey a covered work in object code form under the terms -of sections 4 and 5, provided that you also convey the -machine-readable Corresponding Source under the terms of this License, -in one of these ways: - - a) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by the - Corresponding Source fixed on a durable physical medium - customarily used for software interchange. - - b) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by a - written offer, valid for at least three years and valid for as - long as you offer spare parts or customer support for that product - model, to give anyone who possesses the object code either (1) a - copy of the Corresponding Source for all the software in the - product that is covered by this License, on a durable physical - medium customarily used for software interchange, for a price no - more than your reasonable cost of physically performing this - conveying of source, or (2) access to copy the - Corresponding Source from a network server at no charge. - - c) Convey individual copies of the object code with a copy of the - written offer to provide the Corresponding Source. This - alternative is allowed only occasionally and noncommercially, and - only if you received the object code with such an offer, in accord - with subsection 6b. - - d) Convey the object code by offering access from a designated - place (gratis or for a charge), and offer equivalent access to the - Corresponding Source in the same way through the same place at no - further charge. You need not require recipients to copy the - Corresponding Source along with the object code. If the place to - copy the object code is a network server, the Corresponding Source - may be on a different server (operated by you or a third party) - that supports equivalent copying facilities, provided you maintain - clear directions next to the object code saying where to find the - Corresponding Source. Regardless of what server hosts the - Corresponding Source, you remain obligated to ensure that it is - available for as long as needed to satisfy these requirements. - - e) Convey the object code using peer-to-peer transmission, provided - you inform other peers where the object code and Corresponding - Source of the work are being offered to the general public at no - charge under subsection 6d. - - A separable portion of the object code, whose source code is excluded -from the Corresponding Source as a System Library, need not be -included in conveying the object code work. - - A "User Product" is either (1) a "consumer product", which means any -tangible personal property which is normally used for personal, family, -or household purposes, or (2) anything designed or sold for incorporation -into a dwelling. In determining whether a product is a consumer product, -doubtful cases shall be resolved in favor of coverage. For a particular -product received by a particular user, "normally used" refers to a -typical or common use of that class of product, regardless of the status -of the particular user or of the way in which the particular user -actually uses, or expects or is expected to use, the product. A product -is a consumer product regardless of whether the product has substantial -commercial, industrial or non-consumer uses, unless such uses represent -the only significant mode of use of the product. - - "Installation Information" for a User Product means any methods, -procedures, authorization keys, or other information required to install -and execute modified versions of a covered work in that User Product from -a modified version of its Corresponding Source. The information must -suffice to ensure that the continued functioning of the modified object -code is in no case prevented or interfered with solely because -modification has been made. - - If you convey an object code work under this section in, or with, or -specifically for use in, a User Product, and the conveying occurs as -part of a transaction in which the right of possession and use of the -User Product is transferred to the recipient in perpetuity or for a -fixed term (regardless of how the transaction is characterized), the -Corresponding Source conveyed under this section must be accompanied -by the Installation Information. But this requirement does not apply -if neither you nor any third party retains the ability to install -modified object code on the User Product (for example, the work has -been installed in ROM). - - The requirement to provide Installation Information does not include a -requirement to continue to provide support service, warranty, or updates -for a work that has been modified or installed by the recipient, or for -the User Product in which it has been modified or installed. Access to a -network may be denied when the modification itself materially and -adversely affects the operation of the network or violates the rules and -protocols for communication across the network. - - Corresponding Source conveyed, and Installation Information provided, -in accord with this section must be in a format that is publicly -documented (and with an implementation available to the public in -source code form), and must require no special password or key for -unpacking, reading or copying. - - 7. Additional Terms. - - "Additional permissions" are terms that supplement the terms of this -License by making exceptions from one or more of its conditions. -Additional permissions that are applicable to the entire Program shall -be treated as though they were included in this License, to the extent -that they are valid under applicable law. If additional permissions -apply only to part of the Program, that part may be used separately -under those permissions, but the entire Program remains governed by -this License without regard to the additional permissions. - - When you convey a copy of a covered work, you may at your option -remove any additional permissions from that copy, or from any part of -it. (Additional permissions may be written to require their own -removal in certain cases when you modify the work.) You may place -additional permissions on material, added by you to a covered work, -for which you have or can give appropriate copyright permission. - - Notwithstanding any other provision of this License, for material you -add to a covered work, you may (if authorized by the copyright holders of -that material) supplement the terms of this License with terms: - - a) Disclaiming warranty or limiting liability differently from the - terms of sections 15 and 16 of this License; or - - b) Requiring preservation of specified reasonable legal notices or - author attributions in that material or in the Appropriate Legal - Notices displayed by works containing it; or - - c) Prohibiting misrepresentation of the origin of that material, or - requiring that modified versions of such material be marked in - reasonable ways as different from the original version; or - - d) Limiting the use for publicity purposes of names of licensors or - authors of the material; or - - e) Declining to grant rights under trademark law for use of some - trade names, trademarks, or service marks; or - - f) Requiring indemnification of licensors and authors of that - material by anyone who conveys the material (or modified versions of - it) with contractual assumptions of liability to the recipient, for - any liability that these contractual assumptions directly impose on - those licensors and authors. - - All other non-permissive additional terms are considered "further -restrictions" within the meaning of section 10. If the Program as you -received it, or any part of it, contains a notice stating that it is -governed by this License along with a term that is a further -restriction, you may remove that term. If a license document contains -a further restriction but permits relicensing or conveying under this -License, you may add to a covered work material governed by the terms -of that license document, provided that the further restriction does -not survive such relicensing or conveying. - - If you add terms to a covered work in accord with this section, you -must place, in the relevant source files, a statement of the -additional terms that apply to those files, or a notice indicating -where to find the applicable terms. - - Additional terms, permissive or non-permissive, may be stated in the -form of a separately written license, or stated as exceptions; -the above requirements apply either way. - - 8. Termination. - - You may not propagate or modify a covered work except as expressly -provided under this License. Any attempt otherwise to propagate or -modify it is void, and will automatically terminate your rights under -this License (including any patent licenses granted under the third -paragraph of section 11). - - However, if you cease all violation of this License, then your -license from a particular copyright holder is reinstated (a) -provisionally, unless and until the copyright holder explicitly and -finally terminates your license, and (b) permanently, if the copyright -holder fails to notify you of the violation by some reasonable means -prior to 60 days after the cessation. - - Moreover, your license from a particular copyright holder is -reinstated permanently if the copyright holder notifies you of the -violation by some reasonable means, this is the first time you have -received notice of violation of this License (for any work) from that -copyright holder, and you cure the violation prior to 30 days after -your receipt of the notice. - - Termination of your rights under this section does not terminate the -licenses of parties who have received copies or rights from you under -this License. If your rights have been terminated and not permanently -reinstated, you do not qualify to receive new licenses for the same -material under section 10. - - 9. Acceptance Not Required for Having Copies. - - You are not required to accept this License in order to receive or -run a copy of the Program. Ancillary propagation of a covered work -occurring solely as a consequence of using peer-to-peer transmission -to receive a copy likewise does not require acceptance. However, -nothing other than this License grants you permission to propagate or -modify any covered work. These actions infringe copyright if you do -not accept this License. Therefore, by modifying or propagating a -covered work, you indicate your acceptance of this License to do so. - - 10. Automatic Licensing of Downstream Recipients. - - Each time you convey a covered work, the recipient automatically -receives a license from the original licensors, to run, modify and -propagate that work, subject to this License. You are not responsible -for enforcing compliance by third parties with this License. - - An "entity transaction" is a transaction transferring control of an -organization, or substantially all assets of one, or subdividing an -organization, or merging organizations. If propagation of a covered -work results from an entity transaction, each party to that -transaction who receives a copy of the work also receives whatever -licenses to the work the party's predecessor in interest had or could -give under the previous paragraph, plus a right to possession of the -Corresponding Source of the work from the predecessor in interest, if -the predecessor has it or can get it with reasonable efforts. - - You may not impose any further restrictions on the exercise of the -rights granted or affirmed under this License. For example, you may -not impose a license fee, royalty, or other charge for exercise of -rights granted under this License, and you may not initiate litigation -(including a cross-claim or counterclaim in a lawsuit) alleging that -any patent claim is infringed by making, using, selling, offering for -sale, or importing the Program or any portion of it. - - 11. Patents. - - A "contributor" is a copyright holder who authorizes use under this -License of the Program or a work on which the Program is based. The -work thus licensed is called the contributor's "contributor version". - - A contributor's "essential patent claims" are all patent claims -owned or controlled by the contributor, whether already acquired or -hereafter acquired, that would be infringed by some manner, permitted -by this License, of making, using, or selling its contributor version, -but do not include claims that would be infringed only as a -consequence of further modification of the contributor version. For -purposes of this definition, "control" includes the right to grant -patent sublicenses in a manner consistent with the requirements of -this License. - - Each contributor grants you a non-exclusive, worldwide, royalty-free -patent license under the contributor's essential patent claims, to -make, use, sell, offer for sale, import and otherwise run, modify and -propagate the contents of its contributor version. - - In the following three paragraphs, a "patent license" is any express -agreement or commitment, however denominated, not to enforce a patent -(such as an express permission to practice a patent or covenant not to -sue for patent infringement). To "grant" such a patent license to a -party means to make such an agreement or commitment not to enforce a -patent against the party. - - If you convey a covered work, knowingly relying on a patent license, -and the Corresponding Source of the work is not available for anyone -to copy, free of charge and under the terms of this License, through a -publicly available network server or other readily accessible means, -then you must either (1) cause the Corresponding Source to be so -available, or (2) arrange to deprive yourself of the benefit of the -patent license for this particular work, or (3) arrange, in a manner -consistent with the requirements of this License, to extend the patent -license to downstream recipients. "Knowingly relying" means you have -actual knowledge that, but for the patent license, your conveying the -covered work in a country, or your recipient's use of the covered work -in a country, would infringe one or more identifiable patents in that -country that you have reason to believe are valid. - - If, pursuant to or in connection with a single transaction or -arrangement, you convey, or propagate by procuring conveyance of, a -covered work, and grant a patent license to some of the parties -receiving the covered work authorizing them to use, propagate, modify -or convey a specific copy of the covered work, then the patent license -you grant is automatically extended to all recipients of the covered -work and works based on it. - - A patent license is "discriminatory" if it does not include within -the scope of its coverage, prohibits the exercise of, or is -conditioned on the non-exercise of one or more of the rights that are -specifically granted under this License. You may not convey a covered -work if you are a party to an arrangement with a third party that is -in the business of distributing software, under which you make payment -to the third party based on the extent of your activity of conveying -the work, and under which the third party grants, to any of the -parties who would receive the covered work from you, a discriminatory -patent license (a) in connection with copies of the covered work -conveyed by you (or copies made from those copies), or (b) primarily -for and in connection with specific products or compilations that -contain the covered work, unless you entered into that arrangement, -or that patent license was granted, prior to 28 March 2007. - - Nothing in this License shall be construed as excluding or limiting -any implied license or other defenses to infringement that may -otherwise be available to you under applicable patent law. - - 12. No Surrender of Others' Freedom. - - If conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot convey a -covered work so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you may -not convey it at all. For example, if you agree to terms that obligate you -to collect a royalty for further conveying from those to whom you convey -the Program, the only way you could satisfy both those terms and this -License would be to refrain entirely from conveying the Program. - - 13. Remote Network Interaction; Use with the GNU General Public License. - - Notwithstanding any other provision of this License, if you modify the -Program, your modified version must prominently offer all users -interacting with it remotely through a computer network (if your version -supports such interaction) an opportunity to receive the Corresponding -Source of your version by providing access to the Corresponding Source -from a network server at no charge, through some standard or customary -means of facilitating copying of software. This Corresponding Source -shall include the Corresponding Source for any work covered by version 3 -of the GNU General Public License that is incorporated pursuant to the -following paragraph. - - Notwithstanding any other provision of this License, you have -permission to link or combine any covered work with a work licensed -under version 3 of the GNU General Public License into a single -combined work, and to convey the resulting work. The terms of this -License will continue to apply to the part which is the covered work, -but the work with which it is combined will remain governed by version -3 of the GNU General Public License. - - 14. Revised Versions of this License. - - The Free Software Foundation may publish revised and/or new versions of -the GNU Affero General Public License from time to time. Such new versions -will be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - - Each version is given a distinguishing version number. If the -Program specifies that a certain numbered version of the GNU Affero General -Public License "or any later version" applies to it, you have the -option of following the terms and conditions either of that numbered -version or of any later version published by the Free Software -Foundation. If the Program does not specify a version number of the -GNU Affero General Public License, you may choose any version ever published -by the Free Software Foundation. - - If the Program specifies that a proxy can decide which future -versions of the GNU Affero General Public License can be used, that proxy's -public statement of acceptance of a version permanently authorizes you -to choose that version for the Program. - - Later license versions may give you additional or different -permissions. However, no additional obligations are imposed on any -author or copyright holder as a result of your choosing to follow a -later version. - - 15. Disclaimer of Warranty. - - THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY -APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT -HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY -OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM -IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF -ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. Limitation of Liability. - - IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS -THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY -GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE -USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF -DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD -PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), -EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF -SUCH DAMAGES. - - 17. Interpretation of Sections 15 and 16. - - If the disclaimer of warranty and limitation of liability provided -above cannot be given local legal effect according to their terms, -reviewing courts shall apply local law that most closely approximates -an absolute waiver of all civil liability in connection with the -Program, unless a warranty or assumption of liability accompanies a -copy of the Program in return for a fee. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -state the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU Affero General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Affero General Public License for more details. - - You should have received a copy of the GNU Affero General Public License - along with this program. If not, see . - -Also add information on how to contact you by electronic and paper mail. - - If your software can interact with users remotely through a computer -network, you should also make sure that it provides a way for users to -get its source. For example, if your program is a web application, its -interface could display a "Source" link that leads users to an archive -of the code. There are many ways you could offer source, and different -solutions will be better for different programs; see section 13 for the -specific requirements. - - You should also get your employer (if you work as a programmer) or school, -if any, to sign a "copyright disclaimer" for the program, if necessary. -For more information on this, and how to apply and follow the GNU AGPL, see -. diff --git a/update/Makefile b/update/Makefile deleted file mode 100644 index 9d4509389a..0000000000 --- a/update/Makefile +++ /dev/null @@ -1,73 +0,0 @@ -BASE_PATH = $(shell pwd) -BIN_PATH := $(BASE_PATH)/bin - -export PATH := $(BIN_PATH):$(PATH) - -help: ## Display this help message - @echo "Please use \`make \` where is one of:" - @grep '^[a-zA-Z]' $(MAKEFILE_LIST) | \ - awk -F ':.*?## ' 'NF==2 {printf " %-26s%s\n", $$1, $$2}' - -# `cut` is used to remove first `v` from `git describe` output -PMM_RELEASE_PATH ?= bin -PMM_RELEASE_VERSION ?= $(shell git describe --always --dirty | cut -b2-) -PMM_RELEASE_TIMESTAMP ?= $(shell date '+%s') -PMM_RELEASE_FULLCOMMIT ?= $(shell git rev-parse HEAD) -PMM_RELEASE_BRANCH ?= $(shell git describe --always --contains --all) - -LD_FLAGS = -ldflags " \ - -X 'github.com/percona/pmm/version.ProjectName=pmm-update' \ - -X 'github.com/percona/pmm/version.Version=$(PMM_RELEASE_VERSION)' \ - -X 'github.com/percona/pmm/version.PMMVersion=$(PMM_RELEASE_VERSION)' \ - -X 'github.com/percona/pmm/version.Timestamp=$(PMM_RELEASE_TIMESTAMP)' \ - -X 'github.com/percona/pmm/version.FullCommit=$(PMM_RELEASE_FULLCOMMIT)' \ - -X 'github.com/percona/pmm/version.Branch=$(PMM_RELEASE_BRANCH)' \ - " -prep: ## Mark the root directory of pmm as safe for OL9 - git config --global --add safe.directory /root/go/src/github.com/percona/pmm - -release: prep ## Build pmm-update release binary - env CGO_ENABLED=0 go build -v $(LD_FLAGS) -o $(PMM_RELEASE_PATH)/pmm-update - -install: prep ## Install pmm-update binary - go build -v $(LD_FLAGS) -o $(GOBIN)/pmm-update . - -install-race: prep ## Install pmm-update binary with race detector - go build -v $(LD_FLAGS) -race -o $(GOBIN)/pmm-update . - -TEST_FLAGS ?= -timeout=60s -count=1 -v -p 1 - -test: ## Run tests - go test $(TEST_FLAGS) ./... - -test-race: ## Run tests with race detector - go test $(TEST_FLAGS) -race ./... - -test-cover: ## Run tests and collect per-package coverage information - go test $(TEST_FLAGS) -coverprofile=cover.out -covermode=count ./... - -RUN_FLAGS ?= - -run: install _run ## Run pmm-update - -run-race: install-race _run ## Run pmm-update with race detector - -run-race-cover: install-race ## Run pmm-update with race detector and collect coverage information - go test -coverpkg="github.com/percona/pmm/update/..." \ - -tags maincover \ - $(LD_FLAGS) \ - -race -c -o pmm-update.test - rm -f *.runcover.out - ./pmm-update.test -test.count=1 -test.v -test.coverprofile=$(shell mktemp --tmpdir=. XXX.runcover.out) -test.run=TestMainCover $(RUN_FLAGS) - -_run: - pmm-update $(RUN_FLAGS) - -env-up: ## Start development environment - docker compose up --force-recreate --abort-on-container-exit --renew-anon-volumes --remove-orphans - -env-down: ## Stop development environment - docker compose down --volumes --remove-orphans - -install-dev-tools: - docker exec pmm-update-server /root/go/src/github.com/percona/pmm/update/.devcontainer/install-dev-tools.sh diff --git a/update/README.md b/update/README.md deleted file mode 100644 index 454b808e73..0000000000 --- a/update/README.md +++ /dev/null @@ -1,8 +0,0 @@ -# PMM Server Update Tools - -[![Build Status](https://github.com/percona/pmm/actions/workflows/update.yml/badge.svg)](https://github.com/percona/pmm/actions/workflows/update.yml) - -- Website: https://docs.percona.com/percona-monitoring-and-management/ -- Forum: https://www.percona.com/forums/questions-discussions/percona-monitoring-and-management/ - -PMM Update is a tool for updating packages and OS configuration for Percona Monitoring and Management Server. diff --git a/update/ansible/.gitkeep b/update/ansible/.gitkeep deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/update/docker-compose.yml b/update/docker-compose.yml deleted file mode 100644 index cf35c50147..0000000000 --- a/update/docker-compose.yml +++ /dev/null @@ -1,13 +0,0 @@ ---- -services: - pmm-update-server: - image: ${PMM_SERVER_IMAGE:-percona/pmm-server:3} - container_name: pmm-update-server - environment: - # for tests - - PMM_SERVER_IMAGE=${PMM_SERVER_IMAGE:-percona/pmm-server:3} - - GO_VERSION=${GO_VERSION:-1.23.x} - - PATH=/root/go/bin:$PATH - - REVIEWDOG_GITHUB_API_TOKEN=${REVIEWDOG_GITHUB_API_TOKEN} - volumes: - - ..:/root/go/src/github.com/percona/pmm diff --git a/update/main.go b/update/main.go deleted file mode 100644 index 68e40ab755..0000000000 --- a/update/main.go +++ /dev/null @@ -1,98 +0,0 @@ -// Copyright (C) 2023 Percona LLC -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . -// Package main provides the entry point for the update application. -package main - -import ( - "context" - "flag" - "log" - "os" - "os/signal" - - "github.com/sirupsen/logrus" - "golang.org/x/sys/unix" - - "github.com/percona/pmm/update/pkg/ansible" - "github.com/percona/pmm/version" -) - -func performStage2Ansible(ctx context.Context, playbook string, opts *ansible.RunPlaybookOpts) { - err := ansible.RunPlaybook(ctx, playbook, opts) - if err != nil { - logrus.Fatalf("RunPlaybook failed: %s", err) - } -} - -func runAnsible(ctx context.Context, playbook string, opts *ansible.RunPlaybookOpts) { - performStage2Ansible(ctx, playbook, opts) -} - -// Flags have to be global variables for maincover_test.go to work. -// -//nolint:gochecknoglobals -var ( - runPlaybookF = flag.Bool("run-playbook", false, "Run playbook without self-update") - playbookF = flag.String("playbook", "", "Ansible playbook for -perform") - debugF = flag.Bool("debug", false, "Enable debug logging") - traceF = flag.Bool("trace", false, "Enable trace logging") -) - -func main() { - log.SetFlags(0) - log.Print(version.FullInfo()) - log.SetPrefix("stdlog: ") - flag.Parse() - - if *debugF { - logrus.SetLevel(logrus.DebugLevel) - } - if *traceF { - *debugF = *traceF - logrus.SetLevel(logrus.TraceLevel) - logrus.SetReportCaller(true) // https://github.com/sirupsen/logrus/issues/954 - } - - var modes int - if *runPlaybookF { - modes++ - } - if modes != 1 { - logrus.Fatalf("Please select a mode: -current, -check, -run-playbook or -perform.") - } - - // handle termination signals - ctx, cancel := context.WithCancel(context.Background()) - signals := make(chan os.Signal, 1) - signal.Notify(signals, unix.SIGTERM, unix.SIGINT) - go func() { - s := <-signals - signal.Stop(signals) - logrus.Warnf("Got %s, shutting down...", unix.SignalName(s.(unix.Signal))) //nolint:forcetypeassert - cancel() - }() - - switch { - case *runPlaybookF: - if *playbookF == "" { - logrus.Fatalf("-playbook flag must be set.") - } - - runAnsible(ctx, *playbookF, &ansible.RunPlaybookOpts{ - Debug: *debugF, - Trace: *traceF, - }) - } -} diff --git a/update/main_test.go b/update/main_test.go deleted file mode 100644 index 3fc8cb2234..0000000000 --- a/update/main_test.go +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright (C) 2023 Percona LLC -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package main - -import ( - "os/exec" - "strings" - "testing" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" -) - -func TestPackages(t *testing.T) { - cmd := exec.Command("pmm-update", "-h") - b, err := cmd.CombinedOutput() - if err != nil { - // This branch is required for tests with pmm-server:3.0.0 - // In this case the exit code is 2. - e, ok := err.(*exec.ExitError) //nolint:errorlint - require.True(t, ok) - - sb := string(b) - assert.Equal(t, 2, e.ExitCode()) - assert.True(t, strings.Contains(sb, "ProjectName: pmm-update"), sb) - } else { - assert.NoError(t, err, string(b)) - } - - out := string(b) - assert.False(t, strings.Contains(out, "-httptest.serve"), `pmm-update should not import package "net/http/httptest"`) - assert.False(t, strings.Contains(out, "-test.run"), `pmm-update should not import package "testing"`) -} diff --git a/update/maincover_test.go b/update/maincover_test.go deleted file mode 100644 index aa26b16d85..0000000000 --- a/update/maincover_test.go +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (C) 2023 Percona LLC -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -//go:build maincover -// +build maincover - -package main - -import ( - "testing" -) - -func TestMainCover(*testing.T) { - main() -} diff --git a/update/pkg/ansible/ansible.go b/update/pkg/ansible/ansible.go deleted file mode 100644 index 08c1d05547..0000000000 --- a/update/pkg/ansible/ansible.go +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright (C) 2023 Percona LLC -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -// Package ansible contains function for running playbooks. -package ansible - -import ( - "context" - "fmt" - "strings" - "time" - - "github.com/percona/pmm/update/pkg/run" -) - -const ansibleCancelTimeout = 180 * time.Second // must be less than stopwaitsecs in supervisord config - -// RunPlaybookOpts contains ansible-playbook options. -type RunPlaybookOpts struct { - Debug bool - Trace bool - ExtraFlags []string -} - -// RunPlaybook runs ansible-playbook. -func RunPlaybook(ctx context.Context, playbook string, opts *RunPlaybookOpts) error { - if opts == nil { - opts = &RunPlaybookOpts{} - } - - var verbose string - runOpts := &run.Opts{} - if opts.Debug { - verbose = "-vvv" - } - if opts.Trace { - verbose = "-vvvv" - runOpts.Env = []string{"ANSIBLE_DEBUG=1"} - } - - cmdLine := fmt.Sprintf( - `ansible-playbook --flush-cache %s %s %s`, - verbose, strings.Join(opts.ExtraFlags, ""), playbook) - - _, _, err := run.Run(ctx, ansibleCancelTimeout, cmdLine, runOpts) - return err -} diff --git a/update/pkg/ansible/ansible_test.go b/update/pkg/ansible/ansible_test.go deleted file mode 100644 index 6f4e34eb20..0000000000 --- a/update/pkg/ansible/ansible_test.go +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright (C) 2023 Percona LLC -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package ansible - -import ( - "context" - "path/filepath" - "testing" - - "github.com/stretchr/testify/require" -) - -func TestAnsible(t *testing.T) { - playbook, err := filepath.Abs(filepath.Join("..", "..", "ansible", "playbook", "tasks", "update.yml")) - require.NoError(t, err) - - t.Run("SyntaxCheck", func(t *testing.T) { - err := RunPlaybook(context.Background(), playbook, &RunPlaybookOpts{ - ExtraFlags: []string{"--syntax-check"}, - }, - ) - require.NoError(t, err) - }) - - // playbooks are tested by `make check` -} diff --git a/update/pkg/run/run.go b/update/pkg/run/run.go deleted file mode 100644 index 399a903273..0000000000 --- a/update/pkg/run/run.go +++ /dev/null @@ -1,90 +0,0 @@ -// Copyright (C) 2023 Percona LLC -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -// Package run contains function for running commands. -package run - -import ( - "bytes" - "context" - "fmt" - "io" - "os" - "os/exec" - "strings" - "time" - - "github.com/sirupsen/logrus" - "golang.org/x/sys/unix" - - "github.com/percona/pmm/utils/pdeathsig" -) - -// Opts contains run options. -type Opts struct { - Env []string -} - -// Run runs command and returns stdout and stderr lines. Both are also tee'd to os.Stderr for a progress reporting. -// When ctx is canceled, SIGTERM is sent, and then SIGKILL after cancelTimeout. -func Run(ctx context.Context, cancelTimeout time.Duration, cmdLine string, opts *Opts) ([]string, []string, error) { - if err := ctx.Err(); err != nil { - return nil, nil, err - } - - if opts == nil { - opts = &Opts{} - } - if opts.Env == nil { - // inherit environment, not overwrite it - opts.Env = append(os.Environ(), opts.Env...) - } - - cmdCtx, cancel := context.WithCancel(context.Background()) - defer cancel() - args := strings.Fields(cmdLine) - cmd := exec.CommandContext(cmdCtx, args[0], args[1:]...) //nolint:gosec,contextcheck - - // restrict process - cmd.Env = opts.Env - cmd.Dir = "/" - pdeathsig.Set(cmd, unix.SIGKILL) - - var stdout, stderr bytes.Buffer - cmd.Stdout = io.MultiWriter(os.Stderr, &stdout) // stdout to stderr - cmd.Stderr = io.MultiWriter(os.Stderr, &stderr) - - fmt.Fprintf(os.Stderr, "Starting %q ...\n", strings.Join(cmd.Args, " ")) - if err := cmd.Start(); err != nil { - return nil, nil, err - } - - go func() { - select { - case <-cmdCtx.Done(): - case <-ctx.Done(): - if err := cmd.Process.Signal(unix.SIGTERM); err != nil { - logrus.Warnf("Failed to send SIGTERM.") - } - t := time.AfterFunc(cancelTimeout, cancel) - defer t.Stop() - } - }() - - err := cmd.Wait() - stdoutS := strings.Split(stdout.String(), "\n") - stderrS := strings.Split(stderr.String(), "\n") - return stdoutS, stderrS, err -} diff --git a/update/pkg/run/run_test.go b/update/pkg/run/run_test.go deleted file mode 100644 index 8557880ab8..0000000000 --- a/update/pkg/run/run_test.go +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright (C) 2023 Percona LLC -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU Affero General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU Affero General Public License for more details. -// -// You should have received a copy of the GNU Affero General Public License -// along with this program. If not, see . - -package run - -import ( - "context" - "testing" - "time" - - "github.com/stretchr/testify/assert" -) - -func TestRun(t *testing.T) { - t.Run("Terminated", func(t *testing.T) { - ctx, cancel := context.WithTimeout(context.Background(), time.Second) - defer cancel() - - start := time.Now() - stdout, stderr, err := Run(ctx, 5*time.Second, "sleep 10", nil) - assert.WithinDuration(t, start, time.Now(), 2*time.Second) - assert.EqualError(t, err, "signal: terminated") - assert.Equal(t, []string{""}, stdout) - assert.Equal(t, []string{""}, stderr) - }) -} diff --git a/version/update.go b/version/update.go index 8c1e4967f3..575203783a 100644 --- a/version/update.go +++ b/version/update.go @@ -25,12 +25,7 @@ type PackageInfo struct { Repo string `json:"repo"` } -// UpdateInstalledResult represents `pmm-update -installed` result. -type UpdateInstalledResult struct { - Installed PackageInfo `json:"installed"` -} - -// UpdateCheckResult represents `pmm-update -check` result. +// UpdateCheckResult describes the latest update check result. type UpdateCheckResult struct { Installed PackageInfo `json:"installed"` Latest DockerVersionInfo `json:"latest,omitempty"` From df26615e188bc50d9c66e2531a6f3ad17f9ccffc Mon Sep 17 00:00:00 2001 From: Alex Demidoff Date: Mon, 6 Jan 2025 15:17:03 +0300 Subject: [PATCH 4/9] PMM-7 Fix managed logs_test (#3428) --- managed/services/server/logs_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/managed/services/server/logs_test.go b/managed/services/server/logs_test.go index a0b3d9c59f..270337b9ec 100644 --- a/managed/services/server/logs_test.go +++ b/managed/services/server/logs_test.go @@ -42,9 +42,9 @@ var commonExpectedFiles = []string{ "nginx.log", "pmm-agent.log", "pmm-agent.yaml", + "pmm-init.log", "pmm-managed.log", "pmm-ssl.conf", - "pmm-init.log", "pmm-version.txt", "pmm.conf", "pmm.ini", From 759e058fc957c0df987da0547ea0fd83d05a90ef Mon Sep 17 00:00:00 2001 From: Alex Demidoff Date: Tue, 7 Jan 2025 11:59:53 +0300 Subject: [PATCH 5/9] PMM-3 Fix pdf rendering (#3409) * PMM-7 Fix PDF rendering (phase I) * chore: trigger the build * PMM-7 Apply more css fixes for PDF * PMM-7 Add doc-build-image make target * PMM-7 Apply different fixes * PMM-7 Remove redundant markup * PMM-7 Update the Makefile * PMM-7 Provide comments in css overrides for PDF * PMM-7 Add a local build preview --- documentation/Makefile | 38 +++++++++++++------ documentation/WRITERS-NOTES.md | 11 ++++++ documentation/docs/css/extra.css | 30 ++++++++++++--- documentation/docs/index.md | 11 +++--- documentation/docs/install-pmm/index.md | 21 ++++++---- .../baremetal/podman/index.md | 5 ++- .../network_and_firewall.md | 8 ++-- documentation/docs/use/qan/panels/overview.md | 10 ++--- documentation/mkdocs-base.yml | 4 +- documentation/mkdocs-pdf.yml | 5 +-- documentation/snippets/services-banner.md | 2 +- 11 files changed, 98 insertions(+), 47 deletions(-) diff --git a/documentation/Makefile b/documentation/Makefile index e12dc8090a..e86de90872 100644 --- a/documentation/Makefile +++ b/documentation/Makefile @@ -14,20 +14,36 @@ doc-check-images: ## Check if all images are used in documentation doc-remove-images: ## Remove unused images from documentation @ACTION=remove $(DIR)/resources/bin/check-images.sh -doc-build: ## Build documentation +doc-build: ## Build documentation (used in CI) # This command is used to build and deploy a preview to onrender.com # Preview URL: https://pmm-doc.onrender.com mkdocs build -f $(DIR)/mkdocs.yml -doc-build-pdf: ## Build documentation in PDF format +doc-build-pdf: ## Build documentation in PDF format + docker run --rm --platform=linux/amd64 -v $(DIR):/docs -w /build perconalab/pmm-doc-md:latest \ + bash -c " \ + cp -r /docs/* /build/ && \ + git init && \ + git config user.email 'doc-team@percona.com' && \ + git add --all && \ + git commit -am 'Initial commit' > /dev/null && \ + mkdocs build -f mkdocs-pdf.yml && \ + cp /build/site/pdf/*.pdf /docs/ \ + " + +doc-build-image: ## Build perconalab/pmm-doc-md:latest image # @docker buildx build --platform=linux/amd64 --progress=plain -t perconalab/pmm-doc-md:latest -f documentation/resources/Dockerfile.build . - docker run --rm --platform=linux/amd64 -v $(DIR):/docs -w /build -e ENABLE_PDF_EXPORT=1 perconalab/pmm-doc-md:latest \ - bash -c "cp -r /docs/* /build/ && \ - ls -la /build && \ - git init && \ - git config user.email 'doc-team@percona.com' && \ - git add --all && \ - git commit -am 'Initial commit' && \ - mkdocs build -f mkdocs-pdf.yml && \ - cp /build/site/pdf/*.pdf /docs/" + +doc-build-preview: ## Build documentation and preview at http://localhost:8000 + docker run --rm --platform=linux/amd64 -p 8000:8000 -v $(DIR):/docs -w /build perconalab/pmm-doc-md:latest \ + bash -c " \ + cp -r /docs/* /build/ && \ + git init && \ + git config user.email 'doc-team@percona.com' && \ + git add --all && \ + git commit -am 'Initial commit' > /dev/null && \ + mkdocs serve -f mkdocs.yml --dev-addr=0.0.0.0:8000 \ + " +doc-search-icons: ## Search for icons that can be used in documentation + @open https://squidfunk.github.io/mkdocs-material/reference/icons-emojis/#search diff --git a/documentation/WRITERS-NOTES.md b/documentation/WRITERS-NOTES.md index e64fe7f2f9..11f2cc0846 100644 --- a/documentation/WRITERS-NOTES.md +++ b/documentation/WRITERS-NOTES.md @@ -125,8 +125,19 @@ In some places, we have used variables themselves to solve the problem. In other ## Icons +Currently, we use three different sets of icons: + +- Native Mkdocs Material icons and emojis +- Iconscount Unicons +- FontAwesome Icons + +The preference should be given to Mkdocs Material icons, since they were initially designed for `mkdocs` project and work very well with it. In rare cases, when an icon cannot be found in Mkdocs Material, you can find a suitable one on Iconscout. FontAwesome icons do not play well with Mkdocs, so use them with caution and don't forget to apply additional CSS styles in case they don't render well in PDF. + +Ideally, we should migrate to using just the two first sets. + Use HTML for icons: +- For Material Theme Icons (`:` prefix and suffix), go to , find an icon, select it and copy the code here. - For PMM UI (Grafana) icons (`uil-` prefix), go to , find an icon, select 'Font' and copy the code here. - For Font Awesome (`fa-` prefix), go to , find an icon, copy the code. diff --git a/documentation/docs/css/extra.css b/documentation/docs/css/extra.css index 892c792163..d1dc1c36bd 100644 --- a/documentation/docs/css/extra.css +++ b/documentation/docs/css/extra.css @@ -1,8 +1,28 @@ @media print { - /* Adjusts positioning of admonition icon */ - .md-typeset :is(.admonition-title,summary):before { - top: 0.6rem; - left: 0.6rem; - } + /* Adjusts positioning of admonition icon */ + .md-typeset :is(.admonition-title,summary):before { + top: 0.6rem; + left: 0.6rem; } + + /* Do not render html tags with this class in PDF */ + .no-pdf { + display: none !important; + } + + /* Modify rendering of numbered lists in PDF */ + .power-number+ol>li::before, + .power-number+ol ol>li::before { + background-color: var(--md-default-bg-color); + color: var(--md-typeset-color); + border-radius: 0; + width: 1.5em; + margin-left: -1.7em; + opacity: 1; + } + + .tabbed-content { + display: contents; + } +} \ No newline at end of file diff --git a/documentation/docs/index.md b/documentation/docs/index.md index a5a3ff1aed..0d0efb0613 100644 --- a/documentation/docs/index.md +++ b/documentation/docs/index.md @@ -1,6 +1,8 @@ # About PMM -:material-information: Info: This is the documentation for the latest release, **PMM {{release}}** Beta. See the [Release Notes](release-notes/3.0.0_Beta.md) for details. +!!! info "" + + This is the documentation for the latest release, **PMM {{release}}** Beta. See the [Release Notes](release-notes/3.0.0_Beta.md) for details. Percona Monitoring and Management (PMM) is an open source database observability, monitoring, and management tool for use with MySQL, PostgreSQL, MongoDB, and the servers on which they run. It enables you to view node- to single-query performance metrics for all of your databases in a single place. @@ -14,7 +16,7 @@ Percona Monitoring and Management (PMM) is an open source database observability Would you like to see a preview of our Home page? Take a look at our free, live [demo](https://pmmdemo.percona.com/). -
+
## :material-telescope: Discover { .title } @@ -33,7 +35,7 @@ Ready to dive into PMM? Follow our simple, step-by-step installation instruction
-## :fontawesome-solid-gear: Configure { .title } +## :material-cog: Configure { .title } Are you ready to begin configuring PMM but need help figuring out how to begin? Let's dive in together. @@ -49,6 +51,3 @@ Looking for reliable and easy-to-use resources to tackle your daily challenges w
- - - diff --git a/documentation/docs/install-pmm/index.md b/documentation/docs/install-pmm/index.md index dd6a2074dd..03e56a7e0b 100644 --- a/documentation/docs/install-pmm/index.md +++ b/documentation/docs/install-pmm/index.md @@ -15,13 +15,13 @@ Install and run at least one PMM Server. Choose from the following options: PMM Server is not currently available as a native ARM64 build. For ARM-based systems, consider using the Docker or Podman installation methods, which can run x86_64 images via emulation on ARM platforms. -| Use | **Benefits** | **Drawbacks**| +| Use | :material-thumb-up: **Benefits** | :material-thumb-down: **Drawbacks**| |---|---|--- | [Docker] | 1. Quick
2. Simple
3. Rootless | Additional network configuration required. -| [Podman] | 1. Quick
2. Simple
3. Rootless |Podman installation required. -| [Helm] (Technical Preview) | 1. Quick
2. Simple
3. Cloud
4. Rootless| Requires running Kubernetes cluster. +| [Podman] | 1. Quick
2. Simple
3. Rootless | Podman installation required. +| [Helm] (Technical Preview) | 1. Quick
2. Simple
3. Cloud-compatible
4. Rootless| Requires running a Kubernetes cluster. | [Virtual appliance] | 1. Easily import into Hypervisor of your choice
2. Rootless| More system resources compared to Docker footprint. -| [Amazon AWS] | 1. Wizard-driven install.
2. Rootless| Non-free solution (infrastructure costs). +| [Amazon AWS] | 1. Wizard-driven install.
2. Rootless| Paid, incurs infrastructure costs. ## Install PMM Client @@ -29,21 +29,26 @@ Install and run PMM Client on every node where there is a service you want to mo The installation choices are: - === "With Docker" +=== "With Docker" - [Docker installation](client/index.md#docker) simplifies deployment across different architectures and automatically selects the appropriate image for your architecture (x86_64 or ARM64).=p][\;] + - [Docker installation](client/index.md#docker) simplifies deployment across different architectures and automatically selects the appropriate image for your architecture (x86_64 or ARM64). - === "Native installation" +=== "With package manager" - [Linux package](client/index.md#package-manager). Use `apt`, `apt-get`, `dnf`, `yum`. The package manager automatically selects the correct version for your architecture. - - [Binary package](client/index.md#binary-packa): Download the appropriate `.tar.gz` file for your architecture (x86_64 or ARM64). +=== "With binary package" + + - [Binary package](client/index.md#binary-package): Download the appropriate `.tar.gz` file for your architecture (x86_64 or ARM64). + !!! hint alert "Tips" Both binary installation and Docker containers can be run without root permissions. When installing on ARM-based systems, ensure you're using ARM64-compatible versions. Performance may vary between architectures. ## Add services + On each PMM Client instance, configure the nodes and services you want to monitor. + ??? info "Which services you can monitor?" - [MySQL] (and variants: Percona Server for MySQL, Percona XtraDB Cluster, MariaDB); diff --git a/documentation/docs/install-pmm/install-pmm-server/baremetal/podman/index.md b/documentation/docs/install-pmm/install-pmm-server/baremetal/podman/index.md index e519f06198..b0b5468ba4 100644 --- a/documentation/docs/install-pmm/install-pmm-server/baremetal/podman/index.md +++ b/documentation/docs/install-pmm/install-pmm-server/baremetal/podman/index.md @@ -166,7 +166,8 @@ On the other hand, the manual method offers a simpler setup with complete contro 4. Go to `https://localhost:8443` to access the PMM user interface in a web browser. If you are accessing the host remotely, replace `localhost` with the IP or server name of the host. For information on manually upgrading, see [Upgrade PMM Server using Podman](../../../../pmm-upgrade/upgrade_podman.md). -======= + + ## Run as non-privileged user to start PMM ??? info "Summary" @@ -288,4 +289,4 @@ To run Podman as a non-privileged user: sleep 80 timeout 60 podman wait --condition=running pmm-server ``` -
\ No newline at end of file +
diff --git a/documentation/docs/install-pmm/plan-pmm-installation/network_and_firewall.md b/documentation/docs/install-pmm/plan-pmm-installation/network_and_firewall.md index 064ffa0ef7..bb8bdfbfa1 100644 --- a/documentation/docs/install-pmm/plan-pmm-installation/network_and_firewall.md +++ b/documentation/docs/install-pmm/plan-pmm-installation/network_and_firewall.md @@ -9,15 +9,15 @@ For PMM to work correctly, your system's firewall should allow TCP traffic on th Ports to expose: | PMM component | TCP port | Direction | Description -|---------------|---------------|---------------|----------------------------------------------------------------------------------------------------------------- +|---------------|---------------|---------------|------------------------------------------------------------------------------------------ | PMM Server | 80 | both | HTTP server, used for gRPC over HTTP and web interface (**insecure**, use with caution). | PMM Server | 443 | both | HTTPS server, used for gRPC over HTTPS and web interface (secure, use of SSL certificates is highly encouraged). Other ports: | PMM component | TCP port | Direction | Description -|---------------|---------------|---------------|--------------------------------------------------------------- -| PMM Server | 7771 | both | gRPC, used for communication between `pmm-agent`, `pmm-admin`. +|---------------|---------------|---------------|----------------------------------------------------------------- +| PMM Server | 7771 | both | gRPC, used for communication between `pmm-agent` and `pmm-admin`. | PMM Server | 7772 | out | HTTP1 server, used for older links like `logs.zip`. | PMM Server | 7773 | out | Debugging. | `pmm-agent` | 7777 | out | Default `pmm-agent` listen port. @@ -28,7 +28,7 @@ Other ports: Depending on your architecture other ports may also need to be exposed. - For `pmm-agent`, the default listen port is 7777. - - The default port range for `pmm-agent` is large by default to accommodate any architecture size but it can be modified using the `--ports-min` and `--ports-max` flags, or modifying the configuration file. In network constraint environments, the range can be reduced to a minimum by allocating at least one port per agent monitored. Learn more about available settings for `pmm-agent` in [Percona PMM-Agent documentation](https://docs.percona.com/percona-monitoring-and-management/details/commands/pmm-agent.html). + - The default port range for `pmm-agent` is large by default to accommodate any architecture size but it can be modified using the `--ports-min` and `--ports-max` flags, or by changing the configuration file. In network constraint environments, the range can be reduced to a minimum by allocating at least one port per agent monitored. Learn more about available settings for `pmm-agent` in [Percona PMM-Agent documentation](https://docs.percona.com/percona-monitoring-and-management/3/use/commands/pmm-agent.html). ## Network configuration for locked-down environments For computers in a locked-down corporate environment without direct access to the Internet, make sure to enable access to Percona Platform services following the instructions in the [Percona Platform documentation](https://docs.percona.com/percona-platform/network.html). \ No newline at end of file diff --git a/documentation/docs/use/qan/panels/overview.md b/documentation/docs/use/qan/panels/overview.md index 4c0b59147c..efe7b1f766 100644 --- a/documentation/docs/use/qan/panels/overview.md +++ b/documentation/docs/use/qan/panels/overview.md @@ -29,12 +29,12 @@ Delete the search text and press Enter to see the full list again. - The first column is the object’s identifier. For **Query**, it is the query’s [Fingerprint](../../../reference/glossary.md#fingerprint). - The second column is the **Main metric**, containing a reduced graphical representation of the metric over time, called a **sparkline**, and a horizontal meter, filled to reflect a percentage of the total value. -- Additional values are revealed as mouse-over tool-tips. +- Additional values are revealed as mouse-over tooltips. -## Tool-tips +## Tooltips -- For the **Query** dimension, hovering over the information icon reveals the query ID and its example. -- Hovering on a column header reveals an informative tool-tip for that column. +- For the **Query** dimension, hovering over the information icon :material-information: reveals the query ID and its example. +- Hovering on a column header reveals an informative tooltip for that column. - Hovering on the main metric sparkline highlights the data point and a tooltip shows the data value under the cursor. ![!image](../../../images/PMM_Query_Analytics_Main_Metric_Sparkline.jpg) @@ -68,4 +68,4 @@ Delete the search text and press Enter to see the full list again. ![!image](../../../images/PMM_Query_Analytics_Devices_Pagination.jpg) -- Queries are grouped into pages of 25, 50 or 100 items. \ No newline at end of file +- Queries are grouped into pages of 25, 50 or 100 items. diff --git a/documentation/mkdocs-base.yml b/documentation/mkdocs-base.yml index 5202d3721d..4e6275a191 100644 --- a/documentation/mkdocs-base.yml +++ b/documentation/mkdocs-base.yml @@ -57,11 +57,11 @@ theme: extra_css: - https://unicons.iconscout.com/release/v3.0.3/css/line.css - https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.4.0/css/font-awesome.min.css - - css/extra.css - css/nocopy.css - css/design.css - css/osano.css - css/pmm.css + - css/extra.css extra_javascript: - js/promptremover.js @@ -78,7 +78,7 @@ markdown_extensions: meta: {} md_in_html: {} smarty: - smart_angled_quotes: true + smart_angled_quotes: true pymdownx.details: {} pymdownx.mark: {} pymdownx.smartsymbols: {} diff --git a/documentation/mkdocs-pdf.yml b/documentation/mkdocs-pdf.yml index 91390f141d..0ae7e55926 100644 --- a/documentation/mkdocs-pdf.yml +++ b/documentation/mkdocs-pdf.yml @@ -1,5 +1,5 @@ # MkDocs configuration for PDF output -# Usage: ENABLE_PDF_EXPORT=1 mkdocs build -f mkdocs-pdf.yml +# Usage: mkdocs build -f mkdocs-pdf.yml INHERIT: mkdocs-base.yml plugins: @@ -9,8 +9,7 @@ plugins: with-pdf: output_path: "pdf/PerconaMonitoringAndManagement-3.0.0-beta.pdf" cover_title: "Percona Monitoring and Management Documentation" - cover_subtitle: 3.0.0 (December 11, 2024) + cover_subtitle: 3.0.0 (December 13, 2024) author: "Percona Technical Documentation Team" cover_logo: docs/images/Percona_Logo_Color.png custom_template_path: resources/templates - enabled_if_env: ENABLE_PDF_EXPORT diff --git a/documentation/snippets/services-banner.md b/documentation/snippets/services-banner.md index a0e1d12dce..2c5d14caa1 100644 --- a/documentation/snippets/services-banner.md +++ b/documentation/snippets/services-banner.md @@ -1,4 +1,4 @@ -
+
## Get expert help { .title } From 0a00b804d023fba0dd320438c8f0a63c4048fc29 Mon Sep 17 00:00:00 2001 From: Catalina A <94133018+catalinaadam@users.noreply.github.com> Date: Tue, 7 Jan 2025 11:38:43 +0200 Subject: [PATCH 6/9] remove duplicated privilege to replicate PR 1346 (#3406) * remove duplicated privilege to replicate PR 1346 * removed duplication inside UpdateUser * feedback from Nurlan --- .../connect-database/mongodb.md | 32 +++++++++---------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/documentation/docs/install-pmm/install-pmm-client/connect-database/mongodb.md b/documentation/docs/install-pmm/install-pmm-client/connect-database/mongodb.md index 90b1991eb5..ea99d803fc 100644 --- a/documentation/docs/install-pmm/install-pmm-client/connect-database/mongodb.md +++ b/documentation/docs/install-pmm/install-pmm-client/connect-database/mongodb.md @@ -53,31 +53,29 @@ Run the example codes below in a `mongo` session to: "roles": [] }); -=== "Ceate/update user and assign created roles" +=== "Create/update user and assign created roles" db.getSiblingDB("admin").createUser({ user: "pmm", pwd: "pmm", roles: [ - { role: "explainRole", db: "admin" }, - { role: "clusterMonitor", db: "admin" }, - { role: "read", db: "local" }, - { "db" : "admin", "role" : "readWrite", "collection": "" }, - { "db" : "admin", "role" : "backup" }, - { "db" : "admin", "role" : "clusterMonitor" }, - { "db" : "admin", "role" : "restore" }, - { "db" : "admin", "role" : "pbmAnyAction" } + { db: "admin", role: "explainRole" }, + { db: "local", role: "read" }, + { db: "admin", role: "readWrite", collection: "" }, + { db: "admin", role: "backup" }, + { db: "admin", role: "clusterMonitor" }, + { db: "admin", role: "restore" }, + { db: "admin", role: "pbmAnyAction" } ] }) db.getSiblingDB("admin").updateUser("pmm", { roles: [ - { role: "explainRole", db: "admin" }, - { role: "clusterMonitor", db: "admin" }, - { role: "read", db: "local" }, - { "db" : "admin", "role" : "readWrite", "collection": "" }, - { "db" : "admin", "role" : "backup" }, - { "db" : "admin", "role" : "clusterMonitor" }, - { "db" : "admin", "role" : "restore" }, - { "db" : "admin", "role" : "pbmAnyAction" } + { db: "admin", role: "explainRole" }, + { db: "local", role: "read" }, + { db: "admin", role: "readWrite", collection: "" }, + { db: "admin", role: "backup" }, + { db: "admin", role: "clusterMonitor" }, + { db: "admin", role: "restore" }, + { db: "admin", role: "pbmAnyAction" } ] }) From 50a8348bb6c5754e033f6f9a7931de311ed27814 Mon Sep 17 00:00:00 2001 From: Santo <31849787+sleto-it@users.noreply.github.com> Date: Wed, 8 Jan 2025 13:07:01 +0000 Subject: [PATCH 7/9] Update grafana version in components page (#3425) From v9 to v11. Setting v11.1.8 as per https://pmm-doc-3.onrender.com/release-notes/3.0.0_Beta.html#improved-ux-with-grafanas-latest-release Co-authored-by: Catalina A <94133018+catalinaadam@users.noreply.github.com> --- documentation/docs/reference/pmm_components_and_versions.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/documentation/docs/reference/pmm_components_and_versions.md b/documentation/docs/reference/pmm_components_and_versions.md index 0ef6ca9125..06e341ae01 100644 --- a/documentation/docs/reference/pmm_components_and_versions.md +++ b/documentation/docs/reference/pmm_components_and_versions.md @@ -4,7 +4,7 @@ The following table lists all the PMM client/server components and their version | PMM client/server component |Version | Documentation |Location on GitHub| |-----------------------------|--------|---------------|------------------| -| Grafana | 9.2.20* | [Grafana Documentation](https://grafana.com/docs/grafana/latest/)|[Github Grafana](https://github.com/percona-platform/grafana)| +| Grafana | 11.1.8* | [Grafana Documentation](https://grafana.com/docs/grafana/latest/)|[Github Grafana](https://github.com/percona-platform/grafana)| | VictoriaMetrics| 1.93.4 | [VictoriaMetrics Documentation](https://docs.victoriametrics.com/)|[Github VictoriaMetrics](https://github.com/VictoriaMetrics/VictoriaMetrics) | | Nginx | 1.20.1 | [Nginx Documentation](http://nginx.org/en/docs/)|[Github Nginx](https://github.com/nginx/nginx-releases) | | Percona Distribution for PostgreSQL | 14.5 | [Percona Distribution for PostgreSQL 14 Documentation](https://www.percona.com/doc/postgresql/LATEST/index.html)| | From e663d258ce9d4888ec092d0a757efb5d79e3ffe6 Mon Sep 17 00:00:00 2001 From: Muhammad Aqeel Date: Thu, 9 Jan 2025 20:08:00 +0500 Subject: [PATCH 8/9] [PMM-13630]: Fixes service start issue + permissions issue (#3415) * [PMM-13630]: Fixes service start issue + permissions issue * [PMM-13630]: Fixes directory permissions issue + improves if condition --------- Co-authored-by: Alex Demidoff --- build/packages/rpm/client/pmm-client.spec | 37 ++++++++++++++++------- 1 file changed, 26 insertions(+), 11 deletions(-) diff --git a/build/packages/rpm/client/pmm-client.spec b/build/packages/rpm/client/pmm-client.spec index dea85fd042..bc77f78eef 100644 --- a/build/packages/rpm/client/pmm-client.spec +++ b/build/packages/rpm/client/pmm-client.spec @@ -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 @@ -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 @@ -132,7 +141,6 @@ 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 @@ -140,7 +148,7 @@ do %{__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 @@ -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 @@ -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 From 438aff46bf1b0b61e99ce7e497cc6e19db3b8a29 Mon Sep 17 00:00:00 2001 From: Talha Bin Rizwan Date: Thu, 9 Jan 2025 20:29:13 +0500 Subject: [PATCH 9/9] PMM-13642 Update scripts to release watchtower image. (#3432) --- build/Makefile | 10 ++++++++-- .../roles/podman-setup/templates/watchtower.env | 1 + .../roles/podman-setup/templates/watchtower.service | 2 +- build/packer/pmm.json | 5 +++-- 4 files changed, 13 insertions(+), 5 deletions(-) diff --git a/build/Makefile b/build/Makefile index 2a4f47535b..667eb33d7d 100644 --- a/build/Makefile +++ b/build/Makefile @@ -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 ------------------ @@ -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 @@ -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: diff --git a/build/packer/ansible/roles/podman-setup/templates/watchtower.env b/build/packer/ansible/roles/podman-setup/templates/watchtower.env index 727aa953fe..44ad59f48a 100644 --- a/build/packer/ansible/roles/podman-setup/templates/watchtower.env +++ b/build/packer/ansible/roles/podman-setup/templates/watchtower.env @@ -1,3 +1,4 @@ +WATCHTOWER_IMAGE={{ watchtower_image_name }} WATCHTOWER_HTTP_API_UPDATE=1 WATCHTOWER_HTTP_API_TOKEN=123 WATCHTOWER_NO_RESTART=1 diff --git a/build/packer/ansible/roles/podman-setup/templates/watchtower.service b/build/packer/ansible/roles/podman-setup/templates/watchtower.service index 7fc366d86b..017167a230 100644 --- a/build/packer/ansible/roles/podman-setup/templates/watchtower.service +++ b/build/packer/ansible/roles/podman-setup/templates/watchtower.service @@ -15,7 +15,7 @@ ExecStart=/usr/bin/podman run --rm --replace=true --name %N \ --env-file=/home/admin/.config/systemd/user/watchtower.env \ --net pmm_default \ --cap-add=net_admin,net_raw \ - docker.io/perconalab/watchtower + ${WATCHTOWER_IMAGE} ExecStop=/usr/bin/podman stop -t 10 %N diff --git a/build/packer/pmm.json b/build/packer/pmm.json index 5fd2f79a43..c0c88de4ab 100644 --- a/build/packer/pmm.json +++ b/build/packer/pmm.json @@ -1,7 +1,8 @@ { "variables": { "single_disk": "false", - "pmm_server_image_name": "docker.io/perconalab/pmm-server:3-dev-latest" + "pmm_server_image_name": "docker.io/perconalab/pmm-server:3-dev-latest", + "watchtower_image_name": "docker.io/perconalab/watchtower:dev-latest" }, "builders": [ { @@ -124,7 +125,7 @@ "-vvv", "-u root", "--extra-vars", - "\"pmm_server_image_name='{{ user `pmm_server_image_name`}}'\"" + "\"pmm_server_image_name='{{ user `pmm_server_image_name` }}' watchtower_image_name='{{ user `watchtower_image_name` }}'\"" ], "role_paths": [ "packer/ansible/roles/lvm-init",