diff --git a/build/Makefile b/build/Makefile index 92b1d88ff34..dec8cd1ec50 100644 --- a/build/Makefile +++ b/build/Makefile @@ -10,6 +10,12 @@ pmm-ami: 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 + +pmm-ami-arm64: + 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}' \ + -var 'watchtower_image_name=${WATCHTOWER_IMAGE}' \ + -only amazon-ebs-arm64 -color=false packer/pmm.json | tee build.log ## ----------------- PACKER ------------------ ## RPM Build Images diff --git a/build/ansible/roles/pmm-images/tasks/main.yml b/build/ansible/roles/pmm-images/tasks/main.yml index f86a6d1d128..f236007f37b 100644 --- a/build/ansible/roles/pmm-images/tasks/main.yml +++ b/build/ansible/roles/pmm-images/tasks/main.yml @@ -14,7 +14,7 @@ - name: Add a local YUM repository yum_repository: name: local - description: Local YUM repository - x86_64 + description: Local YUM repository baseurl: file:///tmp/RPMS gpgcheck: no enabled: no @@ -23,7 +23,7 @@ dnf: name: "*" state: latest - disablerepo: percona-release-x86_64 + disablerepo: percona-release-* - name: Install OS tools dnf: diff --git a/build/packages/rpm/server/SPECS/grafana.spec b/build/packages/rpm/server/SPECS/grafana.spec index 11f58fcf737..31e408ad821 100644 --- a/build/packages/rpm/server/SPECS/grafana.spec +++ b/build/packages/rpm/server/SPECS/grafana.spec @@ -12,6 +12,12 @@ %define gobuild(o:) go build -ldflags "${LDFLAGS:-} -B 0x$(head -c20 /dev/urandom|od -An -tx1|tr -d ' \\n')" -a -v -x %{?**}; %endif +%ifarch aarch64 +%define go_arch arm64 +%else +%define go_arch amd64 +%endif + Name: percona-grafana Version: %{grafana_version} Release: %{rpm_release} @@ -19,7 +25,7 @@ Summary: Grafana is an open source, feature rich metrics dashboard and gr License: AGPLv3 URL: https://github.com/percona/grafana Source0: https://github.com/percona/grafana/archive/%{commit}.tar.gz -ExclusiveArch: %{ix86} x86_64 %{arm} +ExclusiveArch: %{ix86} x86_64 %{arm} aarch64 BuildRequires: fontconfig @@ -49,10 +55,10 @@ cp -rpav public %{buildroot}%{_datadir}/grafana cp -rpav tools %{buildroot}%{_datadir}/grafana install -d -p %{buildroot}%{_sbindir} -cp bin/linux/amd64/grafana-server %{buildroot}%{_sbindir}/ -cp bin/linux/amd64/grafana %{buildroot}%{_sbindir}/ +cp bin/linux/%{go_arch}/grafana-server %{buildroot}%{_sbindir}/ +cp bin/linux/%{go_arch}/grafana %{buildroot}%{_sbindir}/ install -d -p %{buildroot}%{_bindir} -cp bin/linux/amd64/grafana-cli %{buildroot}%{_bindir}/ +cp bin/linux/%{go_arch}/grafana-cli %{buildroot}%{_bindir}/ install -d -p %{buildroot}%{_sysconfdir}/grafana cp conf/sample.ini %{buildroot}%{_sysconfdir}/grafana/grafana.ini diff --git a/build/packer/ansible/agent-aws.yml b/build/packer/ansible/agent-aws.yml index d80201a8a15..d885331df58 100644 --- a/build/packer/ansible/agent-aws.yml +++ b/build/packer/ansible/agent-aws.yml @@ -119,9 +119,9 @@ remote_src: yes mode: "u+x,g+x,o+x" - - name: Install latest YQ (YAML processor) + - name: Install latest YQ (YAML processor) get_url: - url: https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64 + url: "https://github.com/mikefarah/yq/releases/latest/download/yq_linux_{{ ansible_architecture_alt }}" dest: /usr/bin/yq mode: "555" diff --git a/build/packer/ansible/roles/cloud-node/tasks/main.yml b/build/packer/ansible/roles/cloud-node/tasks/main.yml index 3dcf607ef77..478447e878e 100644 --- a/build/packer/ansible/roles/cloud-node/tasks/main.yml +++ b/build/packer/ansible/roles/cloud-node/tasks/main.yml @@ -99,16 +99,26 @@ dest: /etc/sudoers.d/90-admin-user mode: 0440 -- name: change cloud user for AMI EL9 | Change cloud user +- name: change cloud user for AMI EL9 | Change cloud user (Oracle Linux) when: - create_admin == "true" - - ansible_distribution == 'OracleLinux' or ansible_distribution == 'AlmaLinux' + - ansible_distribution == 'OracleLinux' - ansible_distribution_major_version == '9' replace: dest: /etc/cloud/cloud.cfg.d/00_ol-default-user.cfg regexp: "name: ec2-user" replace: "name: admin" +- name: change cloud user for AMI EL9 | Change cloud user (AlmaLinux) + when: + - create_admin == "true" + - ansible_distribution == 'AlmaLinux' + - ansible_distribution_major_version == '9' + replace: + dest: /etc/cloud/cloud.cfg + regexp: "name: ec2-user" + replace: "name: admin" + - name: cloud-init configuration | stat /etc/waagent.conf stat: path=/etc/waagent.conf register: waagent_conf diff --git a/build/packer/pmm.json b/build/packer/pmm.json index 5ab30aa2a1d..9092ecaa9cb 100644 --- a/build/packer/pmm.json +++ b/build/packer/pmm.json @@ -37,6 +37,49 @@ "iit-billing-tag": "pmm-ami" }, "ssh_clear_authorized_keys": "true" + }, + { + "type": "amazon-ebs", + "name": "amazon-ebs-arm64", + "ami_name": "PMM Server ARM64 [{{isotime \"2006-01-02 1504\"}}]", + "instance_type": "c7g.xlarge", + "launch_block_device_mappings": [ + { + "delete_on_termination": true, + "device_name": "/dev/sda1", + "volume_size": 20, + "volume_type": "gp3" + }, + { + "delete_on_termination": false, + "device_name": "/dev/sdb", + "volume_size": 100, + "volume_type": "gp3" + } + ], + "region": "us-east-1", + "security_group_id": "sg-688c2b1c", + "source_ami_filter": { + "filters": { + "name": "AlmaLinux OS 9.*", + "architecture": "arm64", + "root-device-type": "ebs", + "virtualization-type": "hvm" + }, + "owners": ["764336703387"], + "most_recent": true + }, + "ssh_pty": "true", + "ena_support": "true", + "ssh_username": "ec2-user", + "subnet_id": "subnet-ee06e8e1", + "run_tags": { + "iit-billing-tag": "pmm-ami" + }, + "run_volume_tags": { + "iit-billing-tag": "pmm-ami" + }, + "ssh_clear_authorized_keys": "true" } ], "provisioners": [ @@ -72,7 +115,7 @@ [ { "type": "manifest", - "only": ["amazon-ebs"], + "only": ["amazon-ebs", "amazon-ebs-arm64"], "output": "manifest.json", "strip_path": true } diff --git a/build/scripts/build-server-rpm b/build/scripts/build-server-rpm index 9c5ce91122a..67bf9ceefc0 100755 --- a/build/scripts/build-server-rpm +++ b/build/scripts/build-server-rpm @@ -5,6 +5,15 @@ set -o xtrace . $(dirname $0)/vars +# The S3 build cache was amd64-only historically; keep those paths unchanged +# and namespace other architectures to avoid cross-arch cache hits. +build_arch=$(uname -m) +if [ "${build_arch}" = "x86_64" ]; then + cache_dist=${rpmbuild_dist} +else + cache_dist=${rpmbuild_dist}-${build_arch} +fi + get_rpm_version() { local spec_name=$1 @@ -26,8 +35,10 @@ is_build_needed() { local packages= # Structure of S3 build cache - # s3://pmm-build-cache/PR-BUILDS/9 - el9 - # s3://pmm-build-cache/RELEASE/9 - el9 + # s3://pmm-build-cache/PR-BUILDS/el9 - el9 x86_64 + # s3://pmm-build-cache/PR-BUILDS/el9-aarch64 - el9 aarch64 + # s3://pmm-build-cache/RELEASE/el9 - el9 x86_64 + # s3://pmm-build-cache/RELEASE/el9-aarch64 - el9 aarch64 # RPM_EPOCH is set for Feature Builds if [ -n "$RPM_EPOCH" ]; then @@ -35,14 +46,14 @@ is_build_needed() { --region us-east-2 \ --no-progress \ --no-sign-request \ - s3://pmm-build-cache/PR-BUILDS/${rpmbuild_dist}/${spec_name}-${rpm_version} \ + s3://pmm-build-cache/PR-BUILDS/${cache_dist}/${spec_name}-${rpm_version} \ ${rpms_dir}/${spec_name}-${rpm_version} else aws s3 sync \ --region us-east-2 \ --no-progress \ --no-sign-request \ - s3://pmm-build-cache/RELEASE/${rpmbuild_dist}/${spec_name}-${rpm_version} \ + s3://pmm-build-cache/RELEASE/${cache_dist}/${spec_name}-${rpm_version} \ ${rpms_dir}/${spec_name}-${rpm_version} fi @@ -152,14 +163,14 @@ build() { --region us-east-2 \ --no-progress \ ${rpms_dir}/${spec_name}-${rpm_version} \ - s3://pmm-build-cache/PR-BUILDS/${rpmbuild_dist}/${spec_name}-${rpm_version} \ + s3://pmm-build-cache/PR-BUILDS/${cache_dist}/${spec_name}-${rpm_version} \ || : else aws s3 sync \ --region us-east-2 \ --no-progress \ ${rpms_dir}/${spec_name}-${rpm_version} \ - s3://pmm-build-cache/RELEASE/${rpmbuild_dist}/${spec_name}-${rpm_version} \ + s3://pmm-build-cache/RELEASE/${cache_dist}/${spec_name}-${rpm_version} \ || : fi