Go to file
邱博亞 1d6e97f473 first commit 2021-11-28 11:24:50 +08:00
README.md first commit 2021-11-28 11:24:50 +08:00

README.md

Upgrade Server

upgrade openssl+nginx

nano build_nginx.sh
#paste the code below
####################################################################################
#!/bin/bash
wget https://www.openssl.org/source/openssl-1.1.1g.tar.gz --no-check-certificate
tar -zxf openssl-1.1.1g.tar.gz
cd openssl-1.1.1g
./config
sudo apt install make gcc
make -j4
sudo mv /usr/bin/openssl ~/tmp
sudo make install
sudo ln -s /usr/local/bin/openssl /usr/bin/openssl
sudo ldconfig
cd ..
sudo apt-get install build-essential libpcre3 libpcre3-dev zlib1g zlib1g-dev libssl-dev libgd-dev libxml2 libxml2-dev uuid-dev -y
wget http://nginx.org/download/nginx-1.21.1.tar.gz
tar -zxvf nginx-1.21.1.tar.gz
cd nginx-1.21.1
./configure --prefix=/var/www/html --sbin-path=/usr/sbin/nginx --conf-path=/etc/nginx/nginx.conf --http-log-path=/var/log/nginx/access.log --error-log-path=/var/log/nginx/error.log --with-pcre  --lock-path=/var/lock/nginx.lock --pid-path=/var/run/nginx.pid --with-http_ssl_module --with-http_image_filter_module=dynamic --modules-path=/etc/nginx/modules --with-http_v2_module --with-stream=dynamic --with-http_addition_module --with-http_mp4_module --with-openssl-opt="enable-tls1_3 enable-ec_nistp_64_gcc_128"

make -j4
sudo  make install
sudo service nginx restart
####################################################################################
chmod +x build_nginx.sh
sudo ./build_nginx.sh

upgrade site

nano update_site.sh
#paste the code below
####################################################################################
#!/bin/bash
source ~/.rvm/scripts/rvm
all_folder=`ls orbit_sites/*/ -d`
pwd=`pwd`
for folder in $all_folder
do
    tmp="$pwd/$folder"
    if [ "`grep $tmp /etc/nginx/orbit_sites/*`" != "" ]
    then
    cd "$pwd/$folder"
    rm -r public/assets
    echo '#123' >> Gemfile
    bundle update --all;
    git fetch origin
    bundle exec bin/rails runner "Rails.env='production';Admin::SitesController.new.git_reset('origin','update');while(1) do (Multithread.where(key: 'update_manager',status: 'finish').count!=0 ? break : nil) end;sleep(5)"
    else
    echo "$tmp is not site"
    fi
done
#####################################################################################
chmod +x update_site.sh
./update_site.sh