Skip to content

Commit 06d28da

Browse files
committed
Added module for openlitespeed (Experimental)
Updated readme
1 parent 7cd8e4e commit 06d28da

File tree

7 files changed

+934
-12
lines changed

7 files changed

+934
-12
lines changed

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,16 @@ with my humble/honest effort.
2323

2424
Starting version 3.0 ffead-cpp supports both **autoconf** and **cmake** for builds
2525

26+
Detailed OS specific instrauctions and docker/docker-compose scripts are located at [docker](https://github.com/sumeetchhetri/ffead-cpp/tree/master/docker)
27+
2628
Official ffead-cpp pre-built images can be found at [dockerhub](https://cloud.docker.com/repository/docker/sumeetchhetri/ffead-cpp-3.0/tags)
2729

2830

2931
Features
3032
==========
3133
- Webrtc Signalling (websocket + api) (horizontally scalable peerjs compatible signalling server)
3234
- Advanced ORM - SDORM (sql/monogo)
33-
- Embedded Server, Apache/Nginx support (modules)
35+
- Embedded Server, Apache/Nginx support (stable modules), Openlitespeed (experimental)
3436
- Web Socket Support
3537
- HTTP2.0 Support
3638
- Cache API (memcached/redis)
@@ -69,6 +71,7 @@ Quickstart (Using autoconf)
6971
Webrtc Example (Uses peerjs)
7072
===========
7173
- Follow Quickstart (Using cmake) above
74+
- Build docker image from [docker-webrtc](https://github.com/sumeetchhetri/ffead-cpp/tree/master/docker/webrtc-peerjs)
7275
- Once the server starts, navigate to http://localhost:8080/peer-server/index.html in 2 tabs
7376
- Enjoy p2p calling using the ffead-cpp webrtc (peerjs compatible) signalling server
7477

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
wget -O - http://rpms.litespeedtech.com/debian/enable_lst_debian_repo.sh | bash
2+
apt-get install openlitespeed
3+
apt-get install lsphp73
4+
ln -sf /usr/local/lsws/lsphp73/bin/lsphp /usr/local/lsws/fcgi-bin/lsphp5

modules/apache_mod_ffeadcpp/mod_ffeadcpp.cpp

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@
6464
#include "ServiceTask.h"
6565
#include "PropFileReader.h"
6666
#include "XmlParseException.h"
67+
#include "HttpClient.h"
6768
#undef strtoul
6869
#ifdef WINDOWS
6970
#include <direct.h>
@@ -523,11 +524,6 @@ void one_time_init()
523524
}
524525
#endif*/
525526

526-
527-
#ifdef INC_JOBS
528-
JobScheduler::start();
529-
#endif
530-
531527
logger << ("Initializing WSDL files....") << std::endl;
532528
ConfigurationHandler::initializeWsdls();
533529
logger << ("Initializing WSDL files done....") << std::endl;
@@ -611,6 +607,8 @@ static apr_status_t mod_ffeadcp_child_uninit(void* arg)
611607

612608
RegexUtil::flushCache();
613609

610+
HttpClient::cleanup();
611+
614612
LoggerFactory::clear();
615613

616614
CommonUtils::clearInstance();
@@ -686,6 +684,10 @@ static void mod_ffeadcp_child_init(apr_pool_t *p, server_rec *s)
686684
ConfigurationHandler::initializeCaches();
687685
logger << ("Initializing Caches done....") << std::endl;
688686

687+
#ifdef INC_JOBS
688+
JobScheduler::start();
689+
#endif
690+
689691
HTTPResponseStatus::init();
690692

691693
HttpRequest::init();

modules/nginx_mod_ffeadcpp/mod_ffeadcpp.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ ngx_module_t ngx_http_ffeadcpp_module = {
125125
&init_worker_process, /* init process */
126126
NULL, /* init thread */
127127
NULL, /* exit thread */
128-
&exit_process, /* exit process */
128+
&exit_process, /* exit process */
129129
NULL, /* exit master */
130130
NGX_MODULE_V1_PADDING
131131
};

modules/nginx_mod_ffeadcpp/ngx_http_ffeadcpp_module.cpp

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ extern "C" {
3232
#include "ServiceTask.h"
3333
#include "PropFileReader.h"
3434
#include "XmlParseException.h"
35+
#include "HttpClient.h"
3536
#undef strtoul
3637
#ifdef WINDOWS
3738
#include <direct.h>
@@ -829,11 +830,6 @@ static ngx_int_t init_module(ngx_cycle_t *cycle)
829830
}
830831
#endif*/
831832

832-
833-
#ifdef INC_JOBS
834-
JobScheduler::start();
835-
#endif
836-
837833
logger << ("Initializing WSDL files....") << std::endl;
838834
ConfigurationHandler::initializeWsdls();
839835
logger << ("Initializing WSDL files done....") << std::endl;
@@ -950,6 +946,10 @@ static ngx_int_t init_worker_process(ngx_cycle_t *cycle)
950946
ConfigurationHandler::initializeCaches();
951947
logger << ("Initializing Caches done....") << std::endl;
952948

949+
#ifdef INC_JOBS
950+
JobScheduler::start();
951+
#endif
952+
953953
HTTPResponseStatus::init();
954954

955955
HttpRequest::init();
@@ -969,5 +969,17 @@ static ngx_int_t exit_process(ngx_cycle_t *cycle)
969969

970970
ConfigurationData::getInstance()->clearAllSingletonBeans();
971971

972+
#ifdef INC_JOBS
973+
JobScheduler::stop();
974+
#endif
975+
976+
RegexUtil::flushCache();
977+
978+
HttpClient::cleanup();
979+
980+
LoggerFactory::clear();
981+
982+
CommonUtils::clearInstance();
983+
972984
return NGX_OK;
973985
}
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
#!/bin/sh
2+
3+
echo =====================================================================================
4+
5+
cd `dirname "$0"`
6+
7+
if [ $# -eq 0 ] ; then
8+
echo Need a c file name, such as $0 mymodule.c
9+
echo
10+
exit 1
11+
fi
12+
13+
echo "Your command is $0 $1 $2"
14+
echo
15+
16+
if [ ! -f $1 ] ; then
17+
echo File $1 does not exist
18+
echo
19+
exit 1
20+
fi
21+
22+
if [ ! -d $2 ] ; then
23+
echo Please specify ffead-cpp directory path
24+
echo
25+
exit 1
26+
fi
27+
28+
29+
if [ "x$LSIAPIDIR" = "x" ]; then
30+
#if not set the LSIAPIDIR, use the default location
31+
LSIAPIDIR=../../
32+
fi
33+
34+
if [ ! -d "$LSIAPIDIR/include" ]; then
35+
echo "Directory $LSIAPIDIR/include missing"
36+
echo
37+
exit 1
38+
fi
39+
40+
TARGET=`basename $1 .cpp`
41+
echo Target=$TARGET
42+
echo
43+
44+
45+
46+
47+
SYS_NAME=`uname -s`
48+
if [ "x$SYS_NAME" = "xDarwin" ] ; then
49+
UNDEFINED_FLAG="-undefined dynamic_lookup"
50+
else
51+
UNDEFINED_FLAG=""
52+
fi
53+
54+
if [ "$TARGET" = "imgresize" ] ; then
55+
if [ -e "/usr/local/lib/libgd.a" ] ; then
56+
GDLIB="-lgd"
57+
else
58+
echo "Lib gd is not installed. Cannot use $TARGET without it."
59+
echo
60+
exit 1
61+
fi
62+
else
63+
GDLIB=""
64+
fi
65+
66+
FFEAD_CPP_DIR=$2
67+
68+
gcc -g -Wall -fPIC -fvisibility=hidden -c -D_REENTRANT $(getconf LFS_CFLAGS) $TARGET.cpp -I "$LSIAPIDIR/src" -I "$LSIAPIDIR/include" -I${FFEAD_CPP_DIR}/include -I/usr/local/include/libmongoc-1.0 -I/usr/local/include/libbson-1.0 -I/usr/include/libmongoc-1.0 -I/usr/include/libbson-1.0 -w -fpermissive -std=gnu++17
69+
gcc -g -Wall -fPIC $UNDEFINED_FLAG $(getconf LFS_CFLAGS) -lstdc++ -L/usr/local/lib -L${FFEAD_CPP_DIR}/lib -o $TARGET.so $TARGET.o -shared $GDLIB -lffead-modules -lffead-framework -lmongoc-1.0 -lbson-1.0
70+
71+
if [ -f $(pwd)/$TARGET.so ] ; then
72+
echo -e "\033[38;5;71m$TARGET.so created.\033[39m"
73+
else
74+
echo -e "\033[38;5;203mError, $TARGET.so does not exist, failed.\033[39m"
75+
fi
76+
77+
if [ -f $TARGET.o ] ; then
78+
rm $TARGET.o
79+
fi
80+
81+
82+
echo Done!
83+
echo

0 commit comments

Comments
 (0)