-
Notifications
You must be signed in to change notification settings - Fork 170
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #797 from 3scale/circleci-profiling
[circleci] install native apicast for profiling
- Loading branch information
Showing
7 changed files
with
156 additions
and
87 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#!/bin/sh | ||
|
||
set -x -e | ||
pip install --user hererocks | ||
|
||
if [ -n "$1" ]; then | ||
cd "$1" | ||
fi | ||
|
||
"$HOME/.local/bin/hererocks" lua_modules -r^ -l 5.1 --no-readline | ||
curl -L https://raw.githubusercontent.com/3scale/s2i-openresty/ffb1c55533be866a97466915d7ef31c12bae688c/site_config.lua -o lua_modules/share/lua/5.1/luarocks/site_config.lua | ||
make dependencies cpan | ||
|
||
mkdir -p ~/.systemtap | ||
# needed for complete backtraces | ||
# increase this if you start seeing stacks collapsed in impossible ways | ||
# also try https://github.com/openresty/stapxx/commit/59ba231efba8725a510cd8d1d585aedf94670404 | ||
# to avoid MAXACTTION problems | ||
cat <<- EOF > ~/.systemtap/rc | ||
-D MAXSTRINGLEN=1024 | ||
EOF |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#!/bin/sh | ||
|
||
set -x -e | ||
|
||
dnf -y install dnf-plugins-core | ||
|
||
dnf config-manager --add-repo https://openresty.org/package/fedora/openresty.repo | ||
|
||
yum -y install rsync | ||
yum -y install openresty-resty openresty-debug openresty-debug-debuginfo openresty-pcre-debuginfo | ||
yum -y install systemtap git httpd-tools | ||
yum -y install luarocks | ||
yum -y install perl-local-lib perl-App-cpanminus redis perl-open expect | ||
|
||
yum -y groupinstall 'Development Tools' | ||
yum -y install openssl-devel libev-devel | ||
|
||
dnf debuginfo-install -y "kernel-core-$(uname -r)" | ||
|
||
yum -y install python2-pip |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#!/bin/sh | ||
set -x -e | ||
|
||
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys ECDCAD72428D7C01 | ||
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys C8CAB6595FDFF622 | ||
|
||
codename=$(lsb_release -sc) | ||
tee /etc/apt/sources.list.d/ddebs.list << EOF | ||
deb http://ddebs.ubuntu.com/ ${codename} main restricted universe multiverse | ||
deb http://ddebs.ubuntu.com/ ${codename}-security main restricted universe multiverse | ||
deb http://ddebs.ubuntu.com/ ${codename}-updates main restricted universe multiverse | ||
deb http://ddebs.ubuntu.com/ ${codename}-proposed main restricted universe multiverse | ||
EOF | ||
|
||
wget -qO - https://openresty.org/package/pubkey.gpg | apt-key add - | ||
add-apt-repository -y "deb http://openresty.org/package/ubuntu ${codename} main" | ||
add-apt-repository -y ppa:niedbalski/systemtap-backports | ||
|
||
apt update | ||
|
||
echo manual > /etc/init/openresty.override | ||
|
||
apt install -y cpanminus liblocal-lib-perl libev-dev luarocks python-pip systemtap | ||
apt install -y openresty openresty-debug-dbgsym openresty-openssl-debug-dbgsym openresty-pcre-dbgsym openresty-zlib-dbgsym | ||
|
||
kernel=$(uname -r) | ||
apt install -y "linux-headers-${kernel}" "linux-image-${kernel}-dbgsym" | ||
|
||
service openresty stop |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
#!/bin/sh | ||
set -x -e -u | ||
|
||
user=${SUDO_USER:-${CIRCLECI_USER:-vagrant}} | ||
|
||
# CircleCI forces use of SSH protocol everywhere, we need to reset it. | ||
export HOME="/tmp" | ||
|
||
# Clone various utilities | ||
git clone https://github.com/openresty/stapxx.git /usr/local/stapxx || (cd /usr/local/stapxx && git pull) | ||
git clone https://github.com/brendangregg/FlameGraph.git /usr/local/flamegraph || (cd /usr/local/flamegraph && git pull) | ||
git clone https://github.com/openresty/openresty-systemtap-toolkit.git /usr/local/openresty-systemtap-toolkit || (cd /usr/local/openresty-systemtap-toolkit && git pull) | ||
curl -L https://github.com/tsenart/vegeta/releases/download/v6.1.1/vegeta-v6.1.1-linux-amd64.tar.gz | tar -xz --overwrite -C /usr/local/bin/ | ||
|
||
git clone https://github.com/wg/wrk.git /usr/local/wrk || (cd /usr/local/wrk && git pull) | ||
( cd /usr/local/wrk && make && mv wrk /usr/local/bin/ ) | ||
|
||
git clone https://github.com/lighttpd/weighttp.git /usr/local/weighttp || (cd /usr/local/weighttp && git pull) | ||
( cd /usr/local/weighttp && gcc -O2 -DPACKAGE_VERSION='"0.4"' src/*.c -o weighttp -lev -lpthread && ln -sf "$(pwd)/weighttp" /usr/local/bin/ ) | ||
|
||
# Utility to resolve builtin functions | ||
echo '#!/usr/bin/env luajit' > /usr/local/bin/ljff | ||
curl -L https://raw.githubusercontent.com/openresty/openresty-devel-utils/master/ljff.lua >> /usr/local/bin/ljff | ||
chmod +x /usr/local/bin/ljff | ||
|
||
# Create stap++ executable always pointing to its proper location | ||
echo '#!/bin/sh' > /usr/local/bin/stap++ | ||
echo 'exec /usr/local/stapxx/stap++ -I /usr/local/stapxx/tapset "$@"' >> /usr/local/bin/stap++ | ||
chmod +x /usr/local/bin/stap++ | ||
|
||
# shellcheck disable=SC2016 | ||
echo 'export PATH="lua_modules/bin:${PATH}"' > /etc/profile.d/rover.sh | ||
chmod +x /etc/profile.d/rover.sh | ||
|
||
# shellcheck disable=SC2016 | ||
echo 'eval $(perl -I ~/perl5/lib/perl5/ -Mlocal::lib)' > /etc/profile.d/perl.sh | ||
chmod +x /etc/profile.d/perl.sh | ||
|
||
if [ -n "${CIRCLE_SHELL_ENV:-}" ]; then | ||
cat /etc/profile.d/rover.sh >> "${CIRCLE_SHELL_ENV}" | ||
cat /etc/profile.d/perl.sh >> "${CIRCLE_SHELL_ENV}" | ||
fi | ||
|
||
mkdir -p /usr/share/lua/5.1/luarocks/ /usr/share/lua/5.3/luarocks/ | ||
curl -L https://raw.githubusercontent.com/3scale/s2i-openresty/ffb1c55533be866a97466915d7ef31c12bae688c/site_config.lua > /usr/share/lua/5.1/luarocks/site_config.lua | ||
ln -sf /usr/share/lua/5.1/luarocks/site_config.lua /usr/share/lua/5.3/luarocks/site_config.lua | ||
|
||
# Add various utilites to the PATH | ||
ln -sf /usr/local/openresty/luajit/bin/luajit /usr/local/bin/luajit | ||
ln -sf /usr/local/flamegraph/*.pl /usr/local/bin/ | ||
ln -sf /usr/local/stapxx/samples/*.sxx /usr/local/bin/ | ||
# shellcheck disable=SC2046 | ||
ln -sf $(find /usr/local/openresty-systemtap-toolkit/ -maxdepth 1 -type f -executable -print) /usr/local/bin/ | ||
|
||
# Allow vagrant user to use systemtap | ||
usermod -a -G stapusr,stapdev "${user}" | ||
|
||
# Raise opened files limit for vagrant user | ||
# shellcheck disable=SC1117 | ||
printf "%b${user}\t\t\t-\tnofile\t\t1000000" > /etc/security/limits.d/90-nofile.conf | ||
|
||
echo 'kernel.perf_event_paranoid = -1' > /etc/sysctl.d/perf.conf | ||
# shellcheck disable=SC2039 | ||
echo "-1" > /proc/sys/kernel/perf_event_paranoid |