Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions build/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions build/ansible/roles/pmm-images/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -23,7 +23,7 @@
dnf:
name: "*"
state: latest
disablerepo: percona-release-x86_64
disablerepo: percona-release-*

- name: Install OS tools
dnf:
Expand Down
14 changes: 10 additions & 4 deletions build/packages/rpm/server/SPECS/grafana.spec
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,20 @@
%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}
Summary: Grafana is an open source, feature rich metrics dashboard and graph editor
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

Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions build/packer/ansible/agent-aws.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
14 changes: 12 additions & 2 deletions build/packer/ansible/roles/cloud-node/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
45 changes: 44 additions & 1 deletion build/packer/pmm.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": [
Expand Down Expand Up @@ -72,7 +115,7 @@
[
{
"type": "manifest",
"only": ["amazon-ebs"],
"only": ["amazon-ebs", "amazon-ebs-arm64"],
"output": "manifest.json",
"strip_path": true
}
Expand Down
23 changes: 17 additions & 6 deletions build/scripts/build-server-rpm
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -26,23 +35,25 @@ 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
aws s3 sync \
--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

Expand Down Expand Up @@ -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

Expand Down
Loading