Skip to content
This repository was archived by the owner on Jan 19, 2021. It is now read-only.

Commit 2cfb9a8

Browse files
committedAug 25, 2017
update README
1 parent cb1ba88 commit 2cfb9a8

File tree

2 files changed

+97
-44
lines changed

2 files changed

+97
-44
lines changed
 

‎README.md

+56-44
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,8 @@ Here's some guides on installing/using:
6161
* [Requirements](#requirements)
6262
* [Installation](#installation)
6363
+ [Install with Docker](#install-with-docker)
64-
+ [Install OpenResty with RTMP](#install-openresty-with-rtmp)
64+
+ [Install OpenResty with `setup-openresty`](#install-openresty-with-setup-openresty)
65+
+ [Alternative: Install OpenResty with RTMP Manually](#alternative-install-openresty-with-rtmp manually)
6566
+ [Alternative: Install nginx with Lua and rtmp](#alternative-install-nginx-with-lua-and-rtmp)
6667
+ [Setup database and user in Postgres](#setup-database-and-user-in-postgres)
6768
+ [Setup Redis](#setup-redis)
@@ -106,68 +107,79 @@ I have a Docker image available, along with a docker-compose file for
106107
quickly getting up and running. Instructions are available here:
107108
https://github.com/jprjr/docker-multistreamer
108109

109-
### Install OpenResty with RTMP
110+
### Install OpenResty with `setup-openresty`
111+
112+
I've written a script for setting up OpenResty and LuaRocks: https://github.com/jprjr/setup-openresty
113+
114+
This is now my preferred way for setting up OpenResty. It automatically
115+
installs build pre-requisites for a good number of distros, and installs
116+
Lua 5.1.5 in addition to LuaJIT. This allows LuaRocks to build C modules
117+
that no longer build against LuaJIT (like cjson).
118+
119+
To install, simply:
120+
121+
```bash
122+
git clone https://github.com/jprjr/setup-openresty
123+
cd setup-openresty
124+
sudo ./setup-openresty
125+
--prefix=/opt/openresty-rtmp \
126+
--with-rtmp \
127+
--with-stream \
128+
--with-stream-lua
129+
```
130+
131+
### Alternative: Install OpenResty with RTMP Manually
110132

111133
You don't explicitly need OpenResty - it's just convenient because it already
112134
includes the Lua module (and the Lua module's requirements).
113135

136+
You'll want to install Lua 5.1.5 as well, so that LuaRocks can build older
137+
C modules. Included inline is a patch for building liblua as a dynamic library.
138+
114139
```bash
115-
sudo apt-get install libreadline-dev libncurses5-dev libpcre3-dev \
116-
libssl-dev perl make build-essential unzip curl git
140+
sudo apt-get -y install \
141+
libreadline-dev \
142+
libncurses5-dev \
143+
libpcre3-dev \
144+
libssl-dev \
145+
perl \
146+
make \
147+
build-essential \
148+
unzip \
149+
curl \
150+
git
117151
mkdir openresty-build && cd openresty-build
118-
curl -R -L https://openresty.org/download/openresty-1.11.2.2.tar.gz | tar xz
119-
curl -R -L https://github.com/arut/nginx-rtmp-module/archive/v1.1.10.tar.gz | tar xz
120-
curl -R -L https://github.com/openresty/stream-lua-nginx-module/archive/e527417c5d04da0c26c12cf4d8a0ef0f1e36e051.tar.gz | tar xz
152+
curl -R -L https://openresty.org/download/openresty-1.11.2.5.tar.gz | tar xz
153+
curl -R -L https://github.com/arut/nginx-rtmp-module/archive/v1.2.0.tar.gz | tar xz
154+
curl -R -L https://github.com/openresty/stream-lua-nginx-module/archive/a3a050bfacfb8d097ee276380c4e606031f2aaf2.tar.gz | tar xz
121155
curl -R -L http://luarocks.github.io/luarocks/releases/luarocks-2.4.2.tar.gz | tar xz
122-
cd openresty-1.11.2.2
156+
curl -R -L https://www.lua.org/ftp/lua-5.1.5.tar.gz | tar xz
157+
158+
cd openresty-1.11.2.5
123159
./configure \
124160
--prefix=/opt/openresty-rtmp \
125161
--with-pcre-jit \
126162
--with-ipv6 \
127163
--with-stream \
128164
--with-stream_ssl_module \
129-
--add-module=../nginx-rtmp-module-1.1.10 \
130-
--add-module=../stream-lua-nginx-module-e527417c5d04da0c26c12cf4d8a0ef0f1e36e051
165+
--add-module=../nginx-rtmp-module-1.2.0 \
166+
--add-module=../stream-lua-nginx-module-a3a050bfacfb8d097ee276380c4e606031f2aaf2
131167
make
132168
sudo make install
169+
170+
cd ../lua-5.1.5
171+
patch -p1 < /path/to/lua-5.1.5.patch # in this repo under misc
172+
sed -e 's,/usr/local,/opt/openresty-rtmp,g' -i src/luaconf.h
173+
make CFLAGS="-fPIC -O2 -Wall -DLUA_USE_LINUX" linux
174+
sudo make INSTALL_TOP="/opt/openresty-rtmp/luajit" TO_LIB="liblua.a liblua.so" install
175+
133176
cd ../luarocks-2.4.2
134177
./configure \
135178
--prefix=/opt/openresty-rtmp \
136179
--with-lua=/opt/openresty-rtmp/luajit \
137-
--lua-suffix=jit \
138-
--with-lua-include=/opt/openresty-rtmp/luajit/include/luajit-2.1
139-
```
140-
141-
### Alternative: Install nginx with Lua and rtmp
142-
143-
Here's a short script to download nginx and install it to `/opt/nginx-rtmp`
144-
145-
```bash
146-
mkdir nginx-build && cd nginx-build
147-
curl -R -L http://nginx.org/download/nginx-1.10.2.tar.gz | tar xz
148-
curl -R -L https://github.com/simpl/ngx_devel_kit/archive/v0.3.0.tar.gz | tar xz
149-
curl -R -L https://github.com/openresty/lua-nginx-module/archive/v0.10.7.tar.gz | tar xz
150-
curl -R -L https://github.com/arut/nginx-rtmp-module/archive/v1.1.10.tar.gz | tar xz
151-
curl -R -L https://github.com/openresty/stream-lua-nginx-module/archive/e527417c5d04da0c26c12cf4d8a0ef0f1e36e051.tar.gz | tar xz
152-
cd nginx-1.10.2
153-
export LUAJIT_LIB=$(pkg-config --variable=libdir luajit)
154-
export LUAJIT_INC=$(pkg-config --variable=includedir luajit)
155-
./configure \
156-
--prefix=/opt/nginx-rtmp \
157-
--with-threads \
158-
--with-file-aio \
159-
--with-ipv6 \
160-
--with-http_ssl_module \
161-
--with-pcre \
162-
--with-pcre-jit \
163-
--with-stream \
164-
--with-stream_ssl_module \
165-
--add-module=../ngx_devel_kit-0.3.0 \
166-
--add-module=../lua-nginx-module-0.10.7 \
167-
--add-module=../nginx-rtmp-module-1.1.10 \
168-
--add-module=../stream-lua-nginx-module-e527417c5d04da0c26c12cf4d8a0ef0f1e36e051
169-
make
170-
sudo make install
180+
--rocks-tree=/opt/openresty-rtmp/luajit
181+
make build
182+
sudo make bootstrap
171183
```
172184

173185
### Setup database and user in Postgres

‎misc/lua-5.1.5.patch

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
diff -ru lua-5.1.5.orig/src/Makefile lua-5.1.5/src/Makefile
2+
--- lua-5.1.5.orig/src/Makefile 2012-02-13 20:41:22.000000000 +0000
3+
+++ lua-5.1.5/src/Makefile 2017-08-25 13:42:56.716651273 +0000
4+
@@ -8,7 +8,8 @@
5+
PLAT= none
6+
7+
CC= gcc
8+
-CFLAGS= -O2 -Wall $(MYCFLAGS)
9+
+CFLAGS ?= -O2 -Wall
10+
+CFLAGS += $(MYCFLAGS)
11+
AR= ar rcu
12+
RANLIB= ranlib
13+
RM= rm -f
14+
@@ -23,6 +24,7 @@
15+
PLATS= aix ansi bsd freebsd generic linux macosx mingw posix solaris
16+
17+
LUA_A= liblua.a
18+
+LUA_SO= liblua.so
19+
CORE_O= lapi.o lcode.o ldebug.o ldo.o ldump.o lfunc.o lgc.o llex.o lmem.o \
20+
lobject.o lopcodes.o lparser.o lstate.o lstring.o ltable.o ltm.o \
21+
lundump.o lvm.o lzio.o
22+
@@ -36,7 +38,7 @@
23+
LUAC_O= luac.o print.o
24+
25+
ALL_O= $(CORE_O) $(LIB_O) $(LUA_O) $(LUAC_O)
26+
-ALL_T= $(LUA_A) $(LUA_T) $(LUAC_T)
27+
+ALL_T= $(LUA_A) $(LUA_SO) $(LUA_T) $(LUAC_T)
28+
ALL_A= $(LUA_A)
29+
30+
default: $(PLAT)
31+
@@ -51,6 +53,9 @@
32+
$(AR) $@ $(CORE_O) $(LIB_O) # DLL needs all object files
33+
$(RANLIB) $@
34+
35+
+$(LUA_SO): $(CORE_O) $(LIB_O)
36+
+ $(CC) -shared -o $(LUA_SO) $(CORE_O) $(LIB_O) -lm -ldl
37+
+
38+
$(LUA_T): $(LUA_O) $(LUA_A)
39+
$(CC) -o $@ $(MYLDFLAGS) $(LUA_O) $(LUA_A) $(LIBS)
40+
41+
Only in lua-5.1.5/src: Makefile.orig

0 commit comments

Comments
 (0)
This repository has been archived.