Skip to content

Commit

Permalink
πŸš§πŸ”§πŸ”¨πŸ“(setup): add one-shot script for manual install
Browse files Browse the repository at this point in the history
  • Loading branch information
debloper committed Aug 21, 2024
1 parent c5bd9e1 commit 6337e89
Show file tree
Hide file tree
Showing 5 changed files with 66 additions and 3 deletions.
7 changes: 7 additions & 0 deletions app/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# xplex<sup>HQ</sup>

This part of the code was written back in early 2019, by someone who absolutely wasn't into frontend, didn't need it and just did the bare minimum to get by (and barely ever used... as editing the `xplex.conf` in `/usr/local/nginx/conf/` & reloading `nginx` was perceived to be easier & more comprehensive).

This should be seriously redesigned and revamped; hopefully by a better frontend engineer. There are plenty of options (i.e. way more so than already overcrowded as it was back then) and still probably most of them are going to be a better option than how it is at the moment.

For version 1, let this be. If `xplex` gains any traction, then Version 2 deserves a better frontend.
2 changes: 0 additions & 2 deletions conf/nginx.conf
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
daemon off;

events {
worker_connections 64;
}
Expand Down
1 change: 1 addition & 0 deletions conf/xplex.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# push rtmp://a.rtmp.youtube.com/live2/<stream-key>;
57 changes: 57 additions & 0 deletions setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
#!/bin/bash

# install dependencies
apt-get update
apt-get install -y gcc g++ perl-modules make wget

# create a temporary working directory
mkdir -p /tmp/xplex
cd /tmp/xplex

# download the source code for nginx, openssl, pcre, rtmp, and zlib
export v_NGINX=1.26.1
export vm_OSSL=1.1.1w
export vm_PCRE=8.45
export vm_RTMP=1.2.2
export vm_ZLIB=1.3.1

wget https://nginx.org/download/nginx-${v_NGINX}.tar.gz
wget https://www.openssl.org/source/openssl-${vm_OSSL}.tar.gz
wget https://sourceforge.net/projects/pcre/files/pcre/${vm_PCRE}/pcre-${vm_PCRE}.tar.gz
wget https://github.com/arut/nginx-rtmp-module/archive/v${vm_RTMP}.tar.gz
wget https://zlib.net/fossils/zlib-${vm_ZLIB}.tar.gz

# extract the source code
cat *.tar.gz | tar -izxvf -

# configure nginx with rtmp module
cd /tmp/xplex/nginx-${v_NGINX}

./configure \
--with-openssl=../openssl-${vm_OSSL} \
--with-pcre=../pcre-${vm_PCRE} \
--with-zlib=../zlib-${vm_ZLIB} \
--add-module=../nginx-rtmp-module-${vm_RTMP}

# compile and install nginx
make
make install

# update nginx configuration to use xplex
cp conf/*.conf /usr/local/nginx/conf/

# install nodejs
curl -fsSL https://deb.nodesource.com/setup_20.x | bash -
apt install -y nodejs

# install xplex
mkdir -p /opt/xplex/
cp -r app/* /opt/xplex/
cd /opt/xplex/
npm install

# start xplex
nohup npm start &

# start nginx
/usr/local/nginx/sbin/nginx
2 changes: 1 addition & 1 deletion xplex.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
nohup npm start &

# Start nginx (daemon mode off)
/usr/local/nginx/sbin/nginx
/usr/local/nginx/sbin/nginx -g 'daemon off;'

0 comments on commit 6337e89

Please sign in to comment.