Skip to content

Instantly share code, notes, and snippets.

@mayorova
Last active February 19, 2019 13:20
Show Gist options
  • Save mayorova/23d960e2a96df9d99342f90f72a59b0f to your computer and use it in GitHub Desktop.
Save mayorova/23d960e2a96df9d99342f90f72a59b0f to your computer and use it in GitHub Desktop.
Install APIcast v3.2.0 on RHEL 7.5
# Switch to root
sudo -i
# Install dependencies
yum install -y yum-utils gcc git
# Enable OpenResty repo (see RHEL section at https://openresty.org/en/linux-packages.html)
yum-config-manager --add-repo https://openresty.org/package/rhel/openresty.repo
# Enable EPEL packages (needed for LuaRocks)
yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
# Upgrade yum
yum upgrade -y
# Install OpenResty (see RHEL section at https://openresty.org/en/linux-packages.html)
yum install -y openresty-openssl-1.0.2k
export OPENRESTY_RPM_VERSION="1.13.6.1"
yum install -y \
openresty-${OPENRESTY_RPM_VERSION} \
openresty-resty-${OPENRESTY_RPM_VERSION}
# Install LuaRocks
export LUAROCKS_VERSION="2.3.0"
yum install -y luarocks-${LUAROCKS_VERSION}
# Configure Lua environment
mkdir -p /usr/share/lua/5.1/luarocks/
cat << EOF > /usr/share/lua/5.1/luarocks/site_config.lua
local site_config = { }
local openresty = [[/usr/local/openresty]]
local luajit = openresty .. [[/luajit]]
site_config.LUAROCKS_SYSCONFIG=openresty .. [[/config-5.1.lua]]
site_config.LUA_INTERPRETER=[[resty]]
site_config.LUA_DIR_SET=false
site_config.LUAROCKS_PREFIX= [[/usr]]
site_config.LUA_INCDIR= luajit .. [[/include/luajit-2.1]]
site_config.LUA_LIBDIR= luajit .. [[/lib/5.1]]
site_config.LUA_BINDIR= openresty .. [[/bin]]
site_config.LUAROCKS_SYSCONFDIR=[[/etc/luarocks]]
site_config.LUAROCKS_ROCKS_TREE=[[/usr/local/openresty/luajit]]
site_config.LUAROCKS_ROCKS_SUBDIR=[[/luarocks/rocks]]
site_config.LUAROCKS_UNAME_S=[[Linux]]
site_config.LUAROCKS_UNAME_M=[[x86_64]]
site_config.LUAROCKS_DOWNLOADER=[[curl]]
site_config.LUAROCKS_MD5CHECKER=[[md5sum]]
site_config.LUAROCKS_EXTERNAL_DEPS_SUBDIRS={ bin="bin", lib={ "lib", [[lib64]] }, include="include" }
site_config.LUAROCKS_RUNTIME_EXTERNAL_DEPS_SUBDIRS={ bin="bin", lib={ "lib", [[lib64]] }, include="include" }
return site_config
EOF
# Return to non-root user
exit
# Download the v3.2.0 release (Red Hat 3scale API Management v2.2) and extract it
curl -L -o apicast-3.2.0.tar.gz https://github.com/3scale/apicast/archive/v3.2.0.tar.gz
tar xzvf apicast-3.2.0.tar.gz
cd apicast-3.2.0
# Install the dependencies
make dependencies
# Start APIcast
THREESCALE_PORTAL_ENDPOINT=https://{ACCESS_TOKEN}@{DOMAIN}-admin.3scale.net \
THREESCALE_DEPLOYMENT_ENV=staging \
APICAST_CONFIGURATION_LOADER=lazy \
APICAST_CONFIGURATION_CACHE=0 \
bin/apicast -vvv
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment