heroku-openresty-buildpack

by benwilber

GitHub Readme.md

OpenResty Buildpack for Heroku

(and Heroku-compatibles like Dokku)

Features

  • Support for the full OpenResty suite including OPM and the Resty CLI
  • Built-in support for installing packages from LuaRocks
  • Full control of the top-level nginx.conf and the $LUA_PATH/$LUA_CPATH environment variables
  • Easily declare Lua dependencies by listing them in opm.txt and/or luarocks.txt in your project's root directory

Getting started

The easiest way to get started with this buildpack is to check out the Hello World app.

Basic usage

Clone the Hello World app

$ git clone https://github.com/benwilber/heroku-openresty-hello-world.git
$ cd heroku-openresty-hello-world

Create a new Heroku app

$ heroku apps:create --stack=heroku-20 --buildpack=https://github.com/benwilber/heroku-openresty-buildpack.git

We have to add the heroku/python buildpack as well so that we can compile the nginx.conf template.

$ heroku buildpacks:add heroku/python

Push the app to Heroku

$ git push heroku master

Visiting the app's URL in your web browser will display "Hello OpenResty!"

Supported Heroku stacks

This buildpack has been tested with the following Heroku stacks:

  • heroku-18
  • heroku-20

Building OpenResty

If you're interested in making a custom build of OpenResty then take a look at the Makefile in the root of this repository. OpenResty (and dependencies) are compiled in Docker running the target stack.

$ make build-heroku-20

You can modify the bin/build file to add or modify how OpenResty is built. For instance, if you want to add additional NGINX modules.