-
Notifications
You must be signed in to change notification settings - Fork 56
Building Grafana
Below versions of Grafana are available in respective distributions at the time of creation of these build instructions:
- RHEL (8.6, 8.8) have
7.5.15 - RHEL (9.0, 9.2) have
9.0.9 - SLES (15 SP4, 15 SP5) have
9.5.5
The instructions provided below specify the steps to build Grafana 10.0.3 on Linux on IBM Z for following distributions:
- RHEL (7.8, 7.9, 8.6, 8.8, 9.0, 9.2)
- SLES (12 SP5, 15 SP4, 15 SP5)
- Ubuntu (20.04, 22.04, 23.04)
- When following the steps below please use a standard permission user unless otherwise specified
- A directory
/<source_root>/will be referred to in these instructions, this is a temporary writable directory anywhere you'd like to place it.
If you want to build Grafana using manual steps, go to STEP 2.
Use the following commands to build Grafana using the build script. Please make sure you have wget installed.
wget -q https://raw.githubusercontent.com/linux-on-ibm-z/scripts/master/Grafana/10.0.3/build_grafana.sh
# Build Grafana
bash build_grafana.sh [Provide -t option for executing build with tests]If the build completes successfully, go to STEP 5. In case of error, check logs for more details or go to STEP 2 to follow manual build steps.
export SOURCE_ROOT=/<source_root>/
export PATCH_URL="https://raw.githubusercontent.com/linux-on-ibm-z/scripts/master/Grafana/10.0.3/patch"-
RHEL (7.8, 7.9, 8.6, 8.8, 9.0, 9.2)
sudo yum install -y make gcc gcc-c++ tar wget git git-core patch xz curl python3
-
SLES (12 SP5, 15 SP4, 15 SP5)
sudo zypper install -y make gcc gcc-c++ wget tar git xz gzip curl patch python3 libnghttp2-devel
-
Ubuntu (20.04, 22.04, 23.04)
sudo apt-get update sudo apt-get install -y gcc g++ tar wget git make xz-utils patch curl python3
-
Build Python (Only for SLES 12 SP5)
wget -q https://raw.githubusercontent.com/linux-on-ibm-z/scripts/master/Python3/3.11.4/build_python3.sh bash build_python3.sh -y
-
Build GCC (Only for RHEL 7.x and SLES 12 SP5)
installer=yum #For RHEL 7.x installer=zypper #For SLES 12 SP5 sudo ${installer} install -y tar zip gcc-c++ unzip python3 cmake curl wget gcc vim patch binutils-devel tcl gettext bzip2 make GCC_VERSION=9.2.0 wget https://ftp.gnu.org/gnu/gcc/gcc-${GCC_VERSION}/gcc-${GCC_VERSION}.tar.gz tar -xf gcc-${GCC_VERSION}.tar.gz cd gcc-${GCC_VERSION} ./contrib/download_prerequisites mkdir objdir cd objdir ../configure --prefix=/opt/gcc --enable-languages=c,c++ --with-arch=zEC12 --with-long-double-128 \ --build=s390x-linux-gnu --host=s390x-linux-gnu --target=s390x-linux-gnu \ --enable-threads=posix --with-system-zlib --disable-multilib make -j $(nproc) sudo make install sudo ln -sf /opt/gcc/bin/gcc /usr/bin/gcc sudo ln -sf /opt/gcc/bin/g++ /usr/bin/g++ sudo ln -sf /opt/gcc/bin/g++ /usr/bin/c++ export PATH=/opt/gcc/bin:"$PATH" export LD_LIBRARY_PATH=/opt/gcc/lib64:"$LD_LIBRARY_PATH" export C_INCLUDE_PATH=/opt/gcc/lib/gcc/s390x-linux-gnu/${GCC_VERSION}/include export CPLUS_INCLUDE_PATH=/opt/gcc/lib/gcc/s390x-linux-gnu/${GCC_VERSION}/include
-
Install GO v1.21.0
wget https://raw.githubusercontent.com/linux-on-ibm-z/scripts/master/Go/1.18.4/build_go.sh bash build_go.sh -y -v 1.21.0 go version
-
Install Nodejs
cd $SOURCE_ROOT source "/etc/os-release" DISTRO="$ID-$VERSION_ID" NODE_JS_VERSION=18.17.0 if [[ "$DISTRO" == rhel-7* ]] || [[ "$DISTRO" == sles-12.5 ]]; then NODE_JS_VERSION=17.9.1 fi wget https://nodejs.org/dist/v${NODE_JS_VERSION}/node-v${NODE_JS_VERSION}-linux-s390x.tar.xz chmod ugo+r node-v${NODE_JS_VERSION}-linux-s390x.tar.xz sudo tar -C /usr/local -xf node-v${NODE_JS_VERSION}-linux-s390x.tar.xz export PATH=$PATH:/usr/local/node-v${NODE_JS_VERSION}-linux-s390x/bin node -v
-
Install Yarn
cd $SOURCE_ROOT sudo chmod ugo+w -R /usr/local/node-v17.9.1-linux-s390x #For RHEL 7.x and SLES 12 SP5 sudo chmod ugo+w -R /usr/local/node-v18.17.0-linux-s390x #For rest of the distros npm install -g yarn yarn set version 4.0.0-rc.45 yarn --version
-
Download Grafana
export GOPATH=$SOURCE_ROOT cd $GOPATH git clone https://github.com/grafana/grafana.git cd grafana git checkout v10.0.3 wget -O yarnrc.patch $PATCH_URL/yarnrc.patch git apply yarnrc.patch
-
Build Grafana Frontend
cd $GOPATH/grafana yarn install mkdir plugins-bundled/external export NODE_OPTIONS="--max-old-space-size=8192" make build-js
-
Build Grafana Backend
cd $GOPATH/grafana make gen-go make deps-go make build-go
-
Copy Grafana binaries to
/usr/binsudo cp $GOPATH/grafana/bin/linux-s390x/grafana /usr/bin/ sudo cp $GOPATH/grafana/bin/linux-s390x/grafana-server /usr/bin/ sudo cp $GOPATH/grafana/bin/linux-s390x/grafana-cli /usr/bin/
- Start Grafana server
grafana server --homepath=<path_to_installed_home_dir_of_grafana>
Note:
-
After starting Grafana server, you can view the Grafana console at
http://<HOST_IP>:<PORT>/. -
Custom configuration file is located at
$GOPATH/grafana/conf/defaults.ini& custom configuration file path can be overridden using the --config parameter. -
Plugin
grafana-image-rendereris not supported on s390x as it uses headless chromium browser which is not supported on s390x
-
Run backend tests
make test-go
-
Run frontend tests
cd $GOPATH/grafana yarn test --watchAll=false
Note:
-
The following error may occur:
"Error: ENOSPC: System limit for number of file watchers reached". If it does, you'll need to increase the number of max user watches for inotify. Append or change to a new max in the /etc/sysctl.conf file.echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p # This will check if the value has been changed. cat /proc/sys/fs/inotify/max_user_watches
-
Below test cases are failing on s390x and Intel.
- packages/grafana-data/src/datetime/formats.test.ts
- github.com/grafana/grafana/pkg/services/store -> TestListFiles (Only for SLES 15.x)
The information provided in this article is accurate at the time of writing, but on-going development in the open-source projects involved may make the information incorrect or obsolete. Please open issue or contact us on IBM Z Community if you have any questions or feedback.