Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix compilation on ubuntu-noble #55

Merged
merged 3 commits into from
Jan 29, 2025
Merged
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
4 changes: 4 additions & 0 deletions config/blobs.yml
Original file line number Diff line number Diff line change
@@ -38,6 +38,10 @@ percona-xtrabackup-8.0.35-31.tar.gz:
size: 447786172
object_id: 845f90c2-0643-459d-61cd-57ebf90bb585
sha: sha256:c6bda1e7f983e5a667bff22d1d67d33404db4e741676d03c9c60bbd4b263cabf
pkg-config_0.29.2.orig.tar.gz:
size: 2016830
object_id: ca3d829d-016e-4acd-6509-9d1766884b9d
sha: sha256:6fc69c01688c9458a57eb9a1664c9aba372ccda420a02bf4429fe610e7e7d591
procps_3.3.17.orig.tar.xz:
size: 1008428
object_id: 49ca152b-47d2-4737-5f55-154159b7ed7d
1 change: 1 addition & 0 deletions jobs/galera-agent/spec
Original file line number Diff line number Diff line change
@@ -5,6 +5,7 @@ templates:
drain.sh.erb: bin/drain
galera-agent-config.yml.erb: config/galera-agent-config.yml
bpm.yml.erb: config/bpm.yml
service.bash: bin/service

packages:
- galera-agent
25 changes: 10 additions & 15 deletions jobs/galera-agent/templates/bpm.yml.erb
Original file line number Diff line number Diff line change
@@ -7,30 +7,25 @@ end
---
processes:
- name: galera-agent
executable: bash
args:
- "-c"
- |
if [[ -f /sys/fs/cgroup/net_cls,net_prio/monit-api-access/cgroup.procs ]]; then
echo $$ > /sys/fs/cgroup/net_cls,net_prio/monit-api-access/cgroup.procs
fi
umount /sys/fs/cgroup -R
exec runuser -u vcap -- /var/vcap/packages/galera-agent/bin/galera-agent \
--configPath=/var/vcap/jobs/galera-agent/config/galera-agent-config.yml \
-timeFormat=<%= p('logging.format.timestamp') %>
executable: /var/vcap/jobs/galera-agent/bin/service
limits:
open_files: 1048576
additional_volumes:
- path: /var/vcap/sys/run/pxc-mysql
writable: true
- path: /var/vcap/data/pxc-mysql
writable: true
- path: /var/vcap/jobs/pxc-mysql
mount_only: true
writable: false
- path: /var/vcap/bosh/etc
mount_only: true
writable: false
- path: /var/vcap/store
writable: true
mount_only: true
unsafe:
privileged: true
unrestricted_volumes:
- path: /var/vcap/jobs/pxc-mysql
writable: false
- path: /var/vcap/store
writable: true
- path: "/sys/fs/cgroup"
writable: true
2 changes: 1 addition & 1 deletion jobs/galera-agent/templates/galera-agent-config.yml.erb
Original file line number Diff line number Diff line change
@@ -13,7 +13,7 @@ config = {
"Monit" => {
"User" => 'vcap',
"Password" => 'random-password',
"Host" => 'localhost',
"Host" => '127.0.0.1',
"Port" => 2822,
"MysqlStateFilePath" => '/var/vcap/store/pxc-mysql/state.txt',
"ServiceName" => 'galera-init',
27 changes: 27 additions & 0 deletions jobs/galera-agent/templates/service.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/usr/bin/env bash

set -o nounset

if type -f -p nft >/dev/null && nft list ruleset | grep -q monit_output; then
rule_handle=$(nft -a list ruleset | awk '/galera-agent/ { print $NF }')
if [[ -n $rule_handle ]]; then
nft delete rule inet filter monit_output handle "${rule_handle}"
fi
nft insert rule inet filter monit_output index 2 \
socket cgroupv2 level 2 "system.slice/runc-bpm-galera-agent.scope" \
ip daddr 127.0.0.1 tcp dport 2822 \
log prefix '"Matched cgroup galera-agent monit access rule: "' \
accept
elif [[ -f /var/vcap/bosh/etc/monit-access-helper.sh ]]; then
source /var/vcap/bosh/etc/monit-access-helper.sh
permit_monit_access
fi

# unmount fails under newer Ubuntu kernels without using the "--make-rslave" option
# This affects the ubuntu-jammy stemcell 1.351 .. 1.390
mount --make-rslave /sys/fs/cgroup
umount --recursive /sys/fs/cgroup
umount /var/vcap/bosh/etc
exec chpst -u vcap -- /var/vcap/packages/galera-agent/bin/galera-agent \
--configPath=/var/vcap/jobs/galera-agent/config/galera-agent-config.yml \
--timeFormat="<%= p('logging.format.timestamp') %>"
4 changes: 4 additions & 0 deletions operations/noble-stemcell.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
- type: replace
path: /stemcells/alias=default/os
value: ubuntu-noble
8 changes: 8 additions & 0 deletions operations/stemcell-os.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
- type: replace
path: /stemcells/alias=default/os
value: ((stemcell_os))

- type: replace
path: /stemcells/alias=default/version
value: latest
17 changes: 11 additions & 6 deletions packages/percona-xtrabackup-2.4/packaging
Original file line number Diff line number Diff line change
@@ -12,15 +12,15 @@ main() {
install_build_dependencies() {
tar -xf libaio_*.tar.xz
cd libaio-*/
make -j $(nproc) install
make -j "$(nproc)" install prefix="${BOSH_INSTALL_TARGET}"
cd -

tar -xf libev-*.tar.gz
cd libev-*/
./configure --prefix=/usr/local --disable-static
make -j $(nproc) install
make -j "$(nproc)" install
./configure --prefix="${BOSH_INSTALL_TARGET}" --libdir="${BOSH_INSTALL_TARGET}/lib/private" --disable-static
make -j $(nproc) install-exec
make -j "$(nproc)" install-exec
cd -
}

@@ -33,19 +33,24 @@ build_and_install() {
cd percona-xtrabackup-*/
mkdir bld && cd bld

export LIBRARY_PATH="${BOSH_INSTALL_TARGET}/lib:${BOSH_INSTALL_TARGET}/lib/private"
export LD_LIBRARY_PATH="${BOSH_INSTALL_TARGET}/lib"
export CPLUS_INCLUDE_PATH="${BOSH_INSTALL_TARGET}/include"
export C_INCLUDE_PATH="${BOSH_INSTALL_TARGET}/include"

# shellcheck disable=SC2016
cmake .. \
-DBUILD_CONFIG=xtrabackup_release \
-DCMAKE_CXX_COMPILER=g++ \
-DCMAKE_C_COMPILER=gcc \
-DCMAKE_INSTALL_PREFIX="${BOSH_INSTALL_TARGET}" \
-DCMAKE_INSTALL_RPATH='$ORIGIN/../lib/private' \
-DCMAKE_INSTALL_RPATH='$ORIGIN/../lib/private;$ORIGIN/../lib' \
-DINSTALL_MYSQLTESTDIR= \
-DWITH_BOOST=../../boost_1_59_0 \
-DWITH_MAN_PAGES=OFF \
-DWITH_SSL=system

make -j $(nproc)
make -j $(nproc) install/strip
make -j "$(nproc)" install/strip
rm -fr "${BOSH_INSTALL_TARGET}/man/"
}

35 changes: 23 additions & 12 deletions packages/percona-xtrabackup-8.0/packaging
Original file line number Diff line number Diff line change
@@ -10,35 +10,44 @@ main() {
}

install_build_dependencies() {
tar -xf pkg-config_*.tar.gz
cd pkg-config-*/
./configure --prefix=/usr \
--with-internal-glib \
--with-pc-path=/usr/lib/x86_64-linux-gnu/pkgconfig:/usr/lib/pkgconfig:/usr/share/pkgconfig
make -j "$(nproc)" install
cd -

tar -xf libaio_*.tar.xz
cd libaio-*/
make -j $(nproc) install
make -j "$(nproc)" install prefix="${BOSH_INSTALL_TARGET}"
cd -

tar -xf libev-*.tar.gz
cd libev-*/
./configure --prefix=/usr/local --disable-static
make -j $(nproc) install
make -j "$(nproc)" install
./configure --prefix="${BOSH_INSTALL_TARGET}" --libdir="${BOSH_INSTALL_TARGET}/lib/private" --disable-static
make -j $(nproc) install-exec
make -j "$(nproc)" install-exec
cd -

tar -xf procps_*.tar.xz
cd procps-*/
local discard_dir=$(mktemp -d)
local discard_dir
discard_dir=$(mktemp -d)
./configure \
--disable-pidof \
--disable-kill \
--disable-static \
--disable-modern-top \
--disable-numa \
--without-ncurses \
--bindir=${discard_dir} \
--sbindir=${discard_dir} \
--bindir="${discard_dir}" \
--sbindir="${discard_dir}" \
--libdir="${BOSH_INSTALL_TARGET}/lib/private" \
--prefix="${BOSH_INSTALL_TARGET}" \
--datarootdir=${discard_dir} \
--datadir=${discard_dir}
--datarootdir="${discard_dir}" \
--datadir="${discard_dir}"
make -j "$(nproc)" install
cd -
}
@@ -55,24 +64,26 @@ build_and_install() {
local boost_dir
boost_dir=$(readlink -f ../../boost_*/)

export LIBRARY_PATH="${BOSH_INSTALL_TARGET}/lib/private"
export LIBRARY_PATH="${BOSH_INSTALL_TARGET}/lib:${BOSH_INSTALL_TARGET}/lib/private"
export LD_LIBRARY_PATH="${BOSH_INSTALL_TARGET}/lib"
export CPLUS_INCLUDE_PATH="${BOSH_INSTALL_TARGET}/include"
export C_INCLUDE_PATH="${BOSH_INSTALL_TARGET}/include"

# shellcheck disable=SC2016
cmake .. \
-DBUILD_CONFIG=xtrabackup_release \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_CXX_COMPILER=g++ \
-DCMAKE_C_COMPILER=gcc \
-DCMAKE_INSTALL_PREFIX="${BOSH_INSTALL_TARGET}" \
-DCMAKE_INSTALL_RPATH='$ORIGIN/../lib/private' \
-DCMAKE_INSTALL_RPATH='$ORIGIN/../lib/private;$ORIGIN/../lib' \
-DINSTALL_MYSQLTESTDIR= \
-DWITH_BOOST="${boost_dir}" \
-DWITH_MAN_PAGES=OFF \
-DWITH_SSL=system \
-DWITH_VERSION_CHECK=OFF

make -j $(nproc)
make -j $(nproc) install/strip
make -j "$(nproc)" install/strip
rm -fr "${BOSH_INSTALL_TARGET}/man/"
}

1 change: 1 addition & 0 deletions packages/percona-xtrabackup-8.0/spec
Original file line number Diff line number Diff line change
@@ -8,4 +8,5 @@ files:
- percona-xtrabackup-8.0*.tar.gz
- libev-*.tar.gz
- libaio_*.tar.xz
- pkg-config_*.tar.gz
- procps_*.orig.tar.xz
37 changes: 17 additions & 20 deletions packages/percona-xtradb-cluster-5.7/packaging
Original file line number Diff line number Diff line change
@@ -5,7 +5,7 @@ set -o errexit -o nounset -o pipefail
install_build_dependencies() {
tar -xf libaio_*.orig.tar.xz
cd libaio-*/
make install
make install prefix="${BOSH_INSTALL_TARGET}"
cd -

tar -xf boost_1_59_0.tar.bz2
@@ -36,33 +36,41 @@ unpack_source() {

apply_patches() {
(
cd ./*Percona-XtraDB-Cluster-*/
cd Percona-XtraDB-Cluster-*/
patch -p1 < ../patches/libgalera_pxc57_cmake.patch
)
}

configure_source() {
build_and_install() {
(
cd ./*Percona-XtraDB-Cluster-*/percona-xtradb-cluster-galera/
cd Percona-XtraDB-Cluster-*/percona-xtradb-cluster-galera/
cp GALERA-REVISION GALERA_GIT_REVISION
cmake . \
-DBOOST_ROOT=../../boost_1_59_0 \
-DCMAKE_INSTALL_PREFIX="${BOSH_INSTALL_TARGET}" \
-DGALERA_REVISION="$(<GALERA-REVISION)"
make -j "$(nproc)" install/strip
mv "${BOSH_INSTALL_TARGET}/doc" "${BOSH_INSTALL_TARGET}/doc.galera"
)

(
cd ./*Percona-XtraDB-Cluster-*/
cd Percona-XtraDB-Cluster-*/
source MYSQL_VERSION
compilation_comment="Percona XtraDB Cluster (GPL) ${MYSQL_VERSION_MAJOR}.${MYSQL_VERSION_MINOR}.${MYSQL_VERSION_PATCH}${MYSQL_VERSION_EXTRA}"

export LIBRARY_PATH="${BOSH_INSTALL_TARGET}/lib"
export LD_LIBRARY_PATH="${BOSH_INSTALL_TARGET}/lib"
export CPLUS_INCLUDE_PATH="${BOSH_INSTALL_TARGET}/include"
export C_INCLUDE_PATH="${BOSH_INSTALL_TARGET}/include"

mkdir bld && cd bld
cmake .. \
-DBUILD_CONFIG=mysql_release \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DCMAKE_CXX_COMPILER=g++ \
-DCMAKE_C_COMPILER=gcc \
-DCMAKE_INSTALL_PREFIX="${BOSH_INSTALL_TARGET}" \
-DCMAKE_INSTALL_RPATH='$ORIGIN/../lib' \
-DCOMPILATION_COMMENT="${compilation_comment}" \
-DENABLED_LOCAL_INFILE=off \
-DINSTALL_MYSQLTESTDIR= \
@@ -83,29 +91,18 @@ configure_source() {
-DWITH_UNIT_TESTS=OFF \
-DWITH_WSREP=ON \
-DWITH_ZLIB=bundled
)
}

build_source() {
make -C ./*Percona-XtraDB-Cluster-*/percona-xtradb-cluster-galera/ -j $(nproc)
make -C ./*Percona-XtraDB-Cluster-*/bld/ -j $(nproc)
}

install_distribution() {
make -C ./*Percona-XtraDB-Cluster-*/bld/ -j $(nproc) install/strip
make -C ./*Percona-XtraDB-Cluster-*/percona-xtradb-cluster-galera/ -j $(nproc) install/strip
mv "${BOSH_INSTALL_TARGET}/doc" "${BOSH_INSTALL_TARGET}/doc.galera"
rm -fr "${BOSH_INSTALL_TARGET}"/share/garb* "${BOSH_INSTALL_TARGET}/cmake/"
make -j "$(nproc)" install/strip
rm -fr "${BOSH_INSTALL_TARGET}"/share/garb* "${BOSH_INSTALL_TARGET}/cmake/"
)
}

main() {
install_build_dependencies
install_socat
unpack_source
apply_patches
configure_source
build_source
install_distribution
build_and_install
}

main
20 changes: 19 additions & 1 deletion packages/percona-xtradb-cluster-8.0/packaging
Original file line number Diff line number Diff line change
@@ -11,9 +11,18 @@ main() {
}

install_build_dependencies() {
tar -xf pkg-config_*.tar.gz
cd pkg-config-*/
./configure \
--prefix=/usr \
--with-internal-glib \
--with-pc-path=/usr/lib/x86_64-linux-gnu/pkgconfig:/usr/lib/pkgconfig:/usr/share/pkgconfig
make -j "$(nproc)" install
cd -

tar -xf libaio_*.orig.tar.xz
cd libaio-*/
make install
make install prefix="${BOSH_INSTALL_TARGET}"
cd -

tar -xf boost_*.tar.bz2
@@ -61,6 +70,14 @@ build() {
echo "${mysql_version}" >"${BOSH_INSTALL_TARGET}/VERSION"

mkdir bld && cd bld

# Point search paths to ${BOSH_INSTALL_TARGET} to find vendored build dependencies
# libaio,in particular, won't be found in a non-standard path without this change.
export LIBRARY_PATH="${BOSH_INSTALL_TARGET}/lib"
export LD_LIBRARY_PATH="${BOSH_INSTALL_TARGET}/lib"
export CPLUS_INCLUDE_PATH="${BOSH_INSTALL_TARGET}/include"
export C_INCLUDE_PATH="${BOSH_INSTALL_TARGET}/include"

cmake .. \
-DBUILD_CONFIG=mysql_release \
-DBOOST_ROOT="${boost_dir}" \
@@ -69,6 +86,7 @@ build() {
-DCMAKE_CXX_COMPILER=g++ \
-DCMAKE_C_COMPILER=gcc \
-DCMAKE_INSTALL_PREFIX="${BOSH_INSTALL_TARGET}" \
-DCMAKE_INSTALL_RPATH='$ORIGIN/../lib/private;$ORIGIN/../lib' \
-DCOMPILATION_COMMENT="${compilation_comment}" \
-DENABLED_LOCAL_INFILE=OFF \
-DINSTALL_MYSQLTESTDIR= \
1 change: 1 addition & 0 deletions packages/percona-xtradb-cluster-8.0/spec
Original file line number Diff line number Diff line change
@@ -8,4 +8,5 @@ files:
- boost_1_77_0.tar.bz2
- check_*.tar.gz
- libaio_*.orig.tar.xz
- pkg-config_*.tar.gz
- socat-*.tar.gz
7 changes: 7 additions & 0 deletions src/e2e-tests/utilities/bosh/bosh.go
Original file line number Diff line number Diff line change
@@ -135,6 +135,13 @@ func DeployPXC(deploymentName string, options ...DeployOptionFunc) error {
)
}

if stemcellOS := os.Getenv("STEMCELL_OS"); stemcellOS != "" {
args = append(args,
"--ops-file=operations/stemcell-os.yml",
fmt.Sprintf("--var=stemcell_os=%q", stemcellOS),
)
}

for _, o := range options {
o(&args)
}
26 changes: 26 additions & 0 deletions src/e2e-tests/verification_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package e2e_tests

import (
"bytes"
"crypto/tls"
"database/sql"
"encoding/json"
@@ -21,6 +22,7 @@ import (
"github.com/onsi/gomega/gstruct"

"e2e-tests/utilities/bosh"
"e2e-tests/utilities/cmd"
"e2e-tests/utilities/credhub"
)

@@ -82,6 +84,30 @@ var _ = Describe("Feature Verification", Ordered, Label("verification"), func()
Expect(sysctlOutput).To(ContainSubstring(`vm.swappiness = 1`),
"Expected vm.swappiness to be 1, but it was not!\nCommand output: %s", sysctlOutput)
})

It("runs the expected stemcell", func() {
stemcellOS := os.Getenv("STEMCELL_OS")
if stemcellOS == "" {
Skip("No STEMCELL_OS environment variable set. Skipping stemcell verification")

var result struct {
Tables []struct {
Rows []struct {
Stemcell string `json:"stemcell_s"`
}
}
}

var out bytes.Buffer
Expect(cmd.RunWithoutOutput(&out, "bosh", "deployment", "--deployment="+deploymentName, "--json")).To(Succeed())

Expect(json.Unmarshal(out.Bytes(), &result)).To(Succeed())

Expect(result.Tables[0].Rows[0].Stemcell).To(ContainSubstring(stemcellOS))

GinkgoWriter.Printf("OK! Found stemcell os (%q) in output: %s\n", stemcellOS, out.String())
}
})
})

Context("MySQL Configuration", Label("configuration"), func() {