Skip to content

Commit

Permalink
[vagrant] split vagrant provision script
Browse files Browse the repository at this point in the history
  • Loading branch information
mikz committed Jan 9, 2018
1 parent 3275ef7 commit b27e234
Showing 1 changed file with 28 additions and 10 deletions.
38 changes: 28 additions & 10 deletions Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
Vagrant.configure("2") do |config|
# Every Vagrant development environment requires a box. You can search for
# boxes at https://atlas.hashicorp.com/search.
config.vm.box = "centos/7"
config.vm.box = "fedora/26-cloud-base"
config.vm.box_version = "20170705"

# Create a forwarded port mapping which allows access to a specific port
# within the machine from a port on the host machine. In the example below,
Expand Down Expand Up @@ -45,17 +46,18 @@ Vagrant.configure("2") do |config|

config.vm.provision "shell", inline: <<-'SHELL'
set -x -e
yum -y install yum-utils rsync
# Install OpenResty and other tools
yum-config-manager --add-repo https://openresty.org/package/centos/openresty.repo
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 epel-release httpd-tools
yum -y install systemtap git httpd-tools
yum -y install luarocks
yum -y install perl-local-lib perl-App-cpanminus redis
yum -y install perl-local-lib perl-App-cpanminus redis perl-open expect
yum -y groupinstall 'Development Tools'
yum -y install openssl-devel
yum -y install openssl-devel libev-devel
# Clone various utilities
git clone https://github.com/openresty/stapxx.git /usr/local/stapxx || (cd /usr/local/stapxx && git pull)
Expand All @@ -66,6 +68,9 @@ Vagrant.configure("2") do |config|
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
Expand All @@ -82,11 +87,12 @@ Vagrant.configure("2") do |config|
echo 'eval $(perl -I ~/perl5/lib/perl5/ -Mlocal::lib)' > /etc/profile.d/perl.sh
chmod +x /etc/profile.d/perl.sh
mkdir -p /usr/share/lua/5.1/luarocks/
mkdir -p /usr/share/lua/5.{1,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,3}/luarocks/site_config.lua
# Install APIcast dependencies
(cd app && make dependencies cpan)
yum -y install python2-pip
# Add various utilites to the PATH
ln -sf /usr/local/openresty/luajit/bin/luajit /usr/local/bin/luajit
Expand All @@ -100,7 +106,19 @@ Vagrant.configure("2") do |config|
# Raise opened files limit for vagrant user
echo -e 'vagrant\t\t\t-\tnofile\t\t1000000' > /etc/security/limits.d/90-nofile.conf
echo 'kernel.perf_event_paranoid = -1' > /etc/sysctl.d/perf.conf
echo -1 > /proc/sys/kernel/perf_event_paranoid
# Start redis needed for tests
systemctl start redis
SHELL
SHELL

config.vm.provision 'shell', privileged: false, name: "Install APIcast dependencies", inline: <<-'SHELL'
set -x -e
pip install --user hererocks
pushd app
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
SHELL
end

0 comments on commit b27e234

Please sign in to comment.