From bde2f25a42c15c21f7c39f626f352fadc81d7f82 Mon Sep 17 00:00:00 2001 From: Thomas Lynch Date: Sat, 9 Dec 2023 12:10:42 +1100 Subject: [PATCH] Update INSTALLATION.md for updated mongodb, nvm.sh script, nginx installation method Update nginx.sh config script to change how geoip is downloaded Update ecosystem config to increase cores used by chan and build-worker --- CHANGELOG.md | 1 + INSTALLATION.md | 22 ++++++++++++++++------ configs/nginx/nginx.sh | 16 ++++++++-------- ecosystem.config.js | 4 ++-- 4 files changed, 27 insertions(+), 16 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index af3e63ec..48cd0122 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,5 @@ ### 1.4.1 + - Update the INSTALLATION.md (install instructions). - Add a "Bypass DNSBL" account/role permission. - Add a "Bypass Anonymizer Restrictions" account/role permission. - Update dependencies. diff --git a/INSTALLATION.md b/INSTALLATION.md index 9e9b3422..35648129 100644 --- a/INSTALLATION.md +++ b/INSTALLATION.md @@ -27,7 +27,7 @@ ```bash sudo apt update -y -sudo apt install curl wget gnupg nginx ffmpeg imagemagick graphicsmagick python3-certbot-nginx fontconfig fonts-dejavu -y +sudo apt install curl wget libgeoip-dev gnupg ffmpeg imagemagick graphicsmagick fontconfig fonts-dejavu -y ``` **3. Install MongoDB** @@ -40,10 +40,9 @@ Please ensure your hardware is supported before reporting issues. The complete p [MongoDB Installation](https://docs.mongodb.com/manual/tutorial/install-mongodb-on-debian/#install-mongodb-community-edition-on-debian): ```bash -wget -qO - https://www.mongodb.org/static/pgp/server-6.0.asc | sudo apt-key add - -echo "deb http://repo.mongodb.org/apt/debian $(lsb_release -sc)/mongodb-org/6.0 main" | sudo tee /etc/apt/sources.list.d/mongodb-org-6.0.list -sudo apt update -y -sudo apt install -y mongodb-org +wget -qO - https://www.mongodb.org/static/pgp/server-7.0.asc | sudo apt-key add - +echo "deb http://repo.mongodb.org/apt/debian $(lsb_release -sc)/mongodb-org/7.0 main" | sudo tee /etc/apt/sources.list.d/mongodb-org-7.0.list +hsudo apt install -y mongodb-org sudo systemctl enable --now mongod ``` @@ -94,7 +93,7 @@ sudo systemctl restart redis-server For easy installation, use [node version manager](https://github.com/nvm-sh/nvm#installing-and-updating) "nvm": ```bash -curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash +curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash export NVM_DIR="$HOME/.nvm" [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" @@ -120,6 +119,10 @@ HiddenServicePort 80 unix:/var/run/nginx-tor.sock EOF sudo systemctl restart tor +until [ -f /var/lib/tor/jschan/hostname ] +do + sleep 1 +done sudo cat /var/lib/tor/jschan/hostname ``` @@ -158,6 +161,13 @@ Note down the .loki and .onion address for the next step. For standard installations, run `configs/nginx/nginx.sh`. This will prompt you for installation directory, domains, onion/lokinet, enable geoip, install a letsencrypt certificate with certbot and more: ```bash +wget https://raw.githubusercontent.com/fatchan/nginx-autoinstall/master/nginx-autoinstall.sh +chmod +x nginx-autoinstall.sh +sudo su +HEADLESS=y OPTION=1 NGINX_VER=STABLE SUBFILTER=y RTMP=y ./nginx-autoinstall.sh +echo "You can safely ignore that error about restarting nginx ^" +exit +rm nginx-autoinstall.sh sudo bash configs/nginx/nginx.sh ``` diff --git a/configs/nginx/nginx.sh b/configs/nginx/nginx.sh index 11e11305..234316f2 100755 --- a/configs/nginx/nginx.sh +++ b/configs/nginx/nginx.sh @@ -279,17 +279,17 @@ if [ "$GEOIP" == "y" ]; then echo "Downloading and installing geoip database for nginx..." #download geoip data cd /usr/share/GeoIP - mv GeoIP.dat GeoIP.dat.bak - wget --retry-connrefused https://dl.miyuru.lk/geoip/dbip/country/dbip.dat.gz - gunzip dbip.dat.gz - mv dbip.dat GeoIP.dat - chown www-data:www-data /usr/share/GeoIP/GeoIP.dat - + wget --retry-connrefused -qO- "https://download.db-ip.com/free/dbip-country-lite-`date +%Y-%m`.mmdb.gz" | tee "/usr/share/GeoIP/dbip.mmdb.gz" >/dev/null + gunzip "/usr/share/GeoIP/dbip.mmdb.gz" #add goeip_country to /etc/nginx/nginx.conf, only if not already exists - grep -qF "geoip_country" /etc/nginx/nginx.conf + grep -qF "geoip2" /etc/nginx/nginx.conf if [ $? -eq 1 ]; then sudo sed -i '/http {/a \ -geoip_country /usr/share/GeoIP/GeoIP.dat;' /etc/nginx/nginx.conf +geoip2 /usr/share/GeoIP/dbip.mmdb {\ + auto_reload 5m;\ + $geoip2_data_country_code default=unknown source=$remote_addr country iso_code;\ + $geoip2_data_country_name country names en;\ +}' /etc/nginx/nginx.conf fi else echo "Geoip not installed, removing directives..." diff --git a/ecosystem.config.js b/ecosystem.config.js index 89be6769..cc137024 100644 --- a/ecosystem.config.js +++ b/ecosystem.config.js @@ -4,7 +4,7 @@ module.exports = { apps : [{ name: 'build-worker', script: 'worker.js', - instances: Math.floor(numCpus/2), + instances: Math.ceil(numCpus*0.75), autorestart: true, watch: false, max_memory_restart: '1G', @@ -21,7 +21,7 @@ module.exports = { }, { name: 'chan', script: 'server.js', - instances: Math.floor(numCpus/2), + instances: Math.ceil(numCpus*0.75), autorestart: true, watch: false, max_memory_restart: '1G',