Updated.
This commit is contained in:
parent
a8f6cb8935
commit
f9eb12bd3a
|
@ -8,7 +8,7 @@ fi
|
|||
sudo apt update
|
||||
sudo apt install -y git
|
||||
org_pwd=$(pwd)
|
||||
if [[ $ubuntu_version > '22' ]]; then #In ubuntu 22, install linux-libc-dev instead of linux-kernel-headers
|
||||
if [[ "$ubuntu_version" > '22' ]]; then #In ubuntu 22, install linux-libc-dev instead of linux-kernel-headers
|
||||
sudo apt install -y linux-libc-dev software-properties-common build-essential
|
||||
else
|
||||
sudo apt install -y linux-kernel-headers software-properties-common build-essential
|
||||
|
@ -59,7 +59,184 @@ function fix_mongod_and_logrotate(){
|
|||
logrotate -d /etc/logrotate.conf"
|
||||
cd "$org_pwd"
|
||||
}
|
||||
if [[ $ubuntu_version > '21' ]]; then
|
||||
function get_mongodb_old(){
|
||||
old_dir="mongodb_old"
|
||||
if [ -d "/var/lib/$old_dir" ]; then
|
||||
postfix_num="0"
|
||||
while true; do
|
||||
old_dir="mongodb_old.$postfix_num"
|
||||
if [ ! -d "/var/lib/$old_dir" ]; then
|
||||
break
|
||||
else
|
||||
postfix_num="$((postfix_num+1))"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
mongodb_old_dir="/var/lib/$old_dir"
|
||||
}
|
||||
function fix_downgrade_mongod(){
|
||||
if [ -z "$org_mongod_ver" ]
|
||||
sudo rm -rf /var/lib/mongodb/*;
|
||||
sudo chown mongodb:mongodb /var/lib/mongodb -R
|
||||
sudo chown mongodb:mongodb /var/log/mongodb -R
|
||||
sudo service mongod restart
|
||||
sleep 10
|
||||
else
|
||||
if [[ "$org_mongod_ver" > "$1" ]] ; then
|
||||
if [ -d "/var/lib/mongodb" ]; then
|
||||
get_mongodb_old
|
||||
mv /var/lib/mongodb $mongodb_old_dir
|
||||
push_messages "old mongo move to $mongodb_old_dir!"
|
||||
fi
|
||||
sudo mkdir -p /var/lib/mongodb
|
||||
sudo chown mongodb:mongodb /var/lib/mongodb -R
|
||||
sudo chown mongodb:mongodb /var/log/mongodb -R
|
||||
sudo service mongod restart
|
||||
sleep 10
|
||||
fi
|
||||
fi
|
||||
mongod --version
|
||||
mongod_code="$(echo $?)"
|
||||
}
|
||||
function install_mongodb(){
|
||||
case $1 in
|
||||
3.2)
|
||||
mongod_ver="3.2.22"
|
||||
apt_add_key_func https://www.mongodb.org/static/pgp/server-3.2.asc
|
||||
echo "deb http://repo.mongodb.org/apt/ubuntu trusty/mongodb-org/3.2 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.2.list
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y mongodb-org=$mongod_ver mongodb-org-server=$mongod_ver mongodb-org-shell=$mongod_ver mongodb-org-mongos=$mongod_ver mongodb-org-tools=$mongod_ver
|
||||
sudo service mongod stop
|
||||
sudo rm -f /var/lib/mongodb/mongod.lock
|
||||
sudo rm -f /tmp/mongodb-27017.sock
|
||||
sudo chown mongodb:mongodb /var/lib/mongodb -R
|
||||
sudo chown mongodb:mongodb /var/log/mongodb -R
|
||||
sudo service mongod restart
|
||||
sleep 10
|
||||
fix_downgrade_mongod "$mongod_ver"
|
||||
if [ $mongod_code != 0 ] && [ $mongod_code != 1 ]; then #mongo core dump
|
||||
push_messages "Mongo 3.2 core dump!"
|
||||
push_messages "Please install mongod by yourself!"
|
||||
else
|
||||
if [ -e /tmp/mongodb-27017.sock ]; then
|
||||
push_messages "Mongo start success!"
|
||||
else
|
||||
push_messages "mongo not yet start!"
|
||||
push_messages "Please check mongo status!"
|
||||
fi
|
||||
fix_mongod_and_logrotate
|
||||
fi
|
||||
;;
|
||||
4.4)
|
||||
mongod_ver="4.4.18"
|
||||
apt_add_key_func https://www.mongodb.org/static/pgp/server-4.4.asc
|
||||
if [[ "$ubuntu_version" > '20' ]]; then
|
||||
echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/4.4 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.4.list
|
||||
elif [[ "$ubuntu_version" =~ '18' ]] || [[ "$ubuntu_version" =~ '19' ]]; then
|
||||
echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.4 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.4.list
|
||||
else
|
||||
echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/4.4 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.4.list
|
||||
fi
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y mongodb-org=$mongod_ver mongodb-org-server=$mongod_ver mongodb-org-shell=$mongod_ver mongodb-org-mongos=$mongod_ver mongodb-org-tools=$mongod_ver --allow-downgrades
|
||||
sudo service mongod restart
|
||||
sleep 10
|
||||
fix_downgrade_mongod "$mongod_ver"
|
||||
#if mongo 4.4 core dump, then install mongo 3.2
|
||||
if [ $mongod_code != 0 ] && [ $mongod_code != 1 ]; then
|
||||
install_mongodb "3.2" "1"
|
||||
else
|
||||
push_messages "mongo not yet start!"
|
||||
push_messages "Please check mongo status!"
|
||||
fi
|
||||
;;
|
||||
5.0)
|
||||
mongod_ver="5.0.14"
|
||||
apt_add_key_func https://www.mongodb.org/static/pgp/server-5.0.asc
|
||||
# install mongod 5.0
|
||||
if [[ "$ubuntu_version" > '20' ]]; then
|
||||
sudo wget -nc http://archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1-1ubuntu2.1~18.04.20_amd64.deb
|
||||
sudo dpkg -i libssl1.1_1.1.1-1ubuntu2.1~18.04.20_amd64.deb
|
||||
sudo wget -nc http://archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl-dev_1.1.1-1ubuntu2.1~18.04.20_amd64.deb
|
||||
sudo dpkg -i libssl-dev_1.1.1-1ubuntu2.1~18.04.20_amd64.deb
|
||||
echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/5.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-5.0.list
|
||||
elif [[ "$ubuntu_version" =~ '18' ]] || [[ "$ubuntu_version" =~ '19' ]]; then
|
||||
echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/5.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-5.0.list
|
||||
else
|
||||
echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/5.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-5.0.list
|
||||
fi
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y mongodb-org=$mongod_ver mongodb-org-database=$mongod_ver mongodb-org-server=$mongod_ver mongodb-mongosh mongodb-org-shell=$mongod_ver mongodb-org-mongos=$mongod_ver mongodb-org-tools=$mongod_ver --allow-downgrades
|
||||
sudo rm -f /var/lib/mongodb/mongod.lock
|
||||
sudo rm -f /tmp/mongodb-27017.sock
|
||||
sudo chown mongodb:mongodb /var/lib/mongodb -R
|
||||
sudo chown mongodb:mongodb /var/log/mongodb -R
|
||||
sudo service mongod restart
|
||||
sleep 10
|
||||
if [[ ! -e /usr/bin/mongo ]]; then
|
||||
sudo ln -s /usr/bin/mongosh /usr/bin/mongo
|
||||
fi
|
||||
if [ -e /tmp/mongodb-27017.sock ]; then
|
||||
push_messages "Mongo start success!"
|
||||
fix_mongod_and_logrotate
|
||||
else
|
||||
fix_downgrade_mongod "$mongod_ver"
|
||||
#if mongo 5.0 core dump, then install mongo 4.4
|
||||
if [ $mongod_code != 0 ] && [ $mongod_code != 1 ]; then
|
||||
install_mongodb "4.4" "1"
|
||||
else
|
||||
push_messages "mongo not yet start!"
|
||||
push_messages "Please check mongo status!"
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
6.0)
|
||||
mongod_ver="6.0.4"
|
||||
apt_add_key_func https://www.mongodb.org/static/pgp/server-6.0.asc
|
||||
if [[ "$ubuntu_version" > '20' ]]; then
|
||||
sudo wget -nc http://archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1-1ubuntu2.1~18.04.20_amd64.deb
|
||||
sudo dpkg -i libssl1.1_1.1.1-1ubuntu2.1~18.04.20_amd64.deb
|
||||
sudo wget -nc http://archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl-dev_1.1.1-1ubuntu2.1~18.04.20_amd64.deb
|
||||
sudo dpkg -i libssl-dev_1.1.1-1ubuntu2.1~18.04.20_amd64.deb
|
||||
echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/6.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-6.0.list
|
||||
elif [[ "$ubuntu_version" =~ '18' ]] || [[ "$ubuntu_version" =~ '19' ]]; then
|
||||
echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/6.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-6.0.list
|
||||
else
|
||||
echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/6.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-6.0.list
|
||||
fi
|
||||
sudo apt-get update
|
||||
sudo apt-get remove mongodb-clients --purge
|
||||
sudo apt-get install -y mongodb-org=$mongod_ver mongodb-org-database=$mongod_ver mongodb-org-server=$mongod_ver mongodb-mongosh mongodb-org-mongos=$mongod_ver mongodb-org-tools=$mongod_ver --allow-downgrades
|
||||
sudo service mongod stop
|
||||
sudo rm -f /var/lib/mongodb/mongod.lock
|
||||
sudo rm -f /tmp/mongodb-27017.sock
|
||||
sudo chown mongodb:mongodb /var/lib/mongodb -R
|
||||
sudo chown mongodb:mongodb /var/log/mongodb -R
|
||||
sudo service mongod restart
|
||||
sleep 10
|
||||
if [[ ! -e /usr/bin/mongo ]]; then
|
||||
sudo ln -s /usr/bin/mongosh /usr/bin/mongo
|
||||
fi
|
||||
if [ -e /tmp/mongodb-27017.sock ]; then
|
||||
push_messages "Mongo start success!"
|
||||
fix_mongod_and_logrotate
|
||||
else
|
||||
fix_downgrade_mongod "$mongod_ver"
|
||||
#if mongo 6.0 core dump, then install mongo 5.0
|
||||
if [ $mongod_code != 0 ] && [ $mongod_code != 1 ]; then
|
||||
install_mongodb "5.0" "1"
|
||||
else
|
||||
push_messages "mongo not yet start!"
|
||||
push_messages "Please check mongo status!"
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
push_messages "Only support mongodb: 3.2, 4.4, 5.0, 6.0!"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
if [[ "$ubuntu_version" > '21' ]]; then
|
||||
function apt_add_key_func(){
|
||||
url="$1"
|
||||
base_name="$(basename $url)"
|
||||
|
@ -86,7 +263,7 @@ fi
|
|||
sudo service nginx restart
|
||||
openssl_dir=""
|
||||
need_export_apt_key="0"
|
||||
if [[ $ubuntu_version > '21' ]]; then # ruby must use openssl <= 1.1.1. Not support openssl 3.0 yet.
|
||||
if [[ "$ubuntu_version" > '21' ]]; then # ruby must use openssl <= 1.1.1. Not support openssl 3.0 yet.
|
||||
need_export_apt_key="1"
|
||||
if [[ ! -d "/opt/openssl" ]]; then
|
||||
target_openssl_ver="1.1.1q"
|
||||
|
@ -110,139 +287,23 @@ sudo mkdir orbit_sites/
|
|||
if [ -z "$(grep 'orbit_sites' nginx.conf)" ]; then
|
||||
sudo sed -i 's/\(include\ \/etc\/nginx\/sites-enabled\/\*\;\)/\1\n include\ \/etc\/nginx\/orbit_sites\/*;/g' nginx.conf
|
||||
fi
|
||||
if [[ $ubuntu_version > '22' ]]; then #Use root account prevent reading socket denied
|
||||
if [[ "$ubuntu_version" > '22' ]]; then #Use root account prevent reading socket denied
|
||||
sudo sed -E -i 's/^[# ]*user.*/user root/g' /etc/nginx/nginx.conf
|
||||
fi
|
||||
cd $org_pwd
|
||||
sudo apt-get install gnupg -y
|
||||
if [[ $ubuntu_version =~ '14' ]]; then
|
||||
apt_add_key_func https://www.mongodb.org/static/pgp/server-3.2.asc
|
||||
echo "deb http://repo.mongodb.org/apt/ubuntu trusty/mongodb-org/3.2 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.2.list
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y mongodb-org=3.2.22 mongodb-org-server=3.2.22 mongodb-org-shell=3.2.22 mongodb-org-mongos=3.2.22 mongodb-org-tools=3.2.22
|
||||
sudo service mongod stop
|
||||
sudo rm -f /var/lib/mongodb/mongod.lock
|
||||
sudo rm -f /tmp/mongodb-27017.sock
|
||||
sudo chown mongodb:mongodb /var/lib/mongodb -R
|
||||
sudo chown mongodb:mongodb /var/log/mongodb -R
|
||||
sudo service mongod restart
|
||||
sleep 10
|
||||
mongod --version
|
||||
exit_code="$(echo $?)"
|
||||
if [ $exit_code != 0 ] && [ $exit_code != 1 ]; then #mongo core dump
|
||||
push_messages "Mongo 3.2 core dump!"
|
||||
push_messages "Please install mongod by yourself!"
|
||||
else
|
||||
if [ -e /tmp/mongodb-27017.sock ]; then
|
||||
push_messages "Mongo start success!"
|
||||
else
|
||||
push_messages "mongo not yet start!"
|
||||
push_messages "Please check mongo status!"
|
||||
fi
|
||||
fix_mongod_and_logrotate
|
||||
fi
|
||||
if [ -z "$(which mongod)" ]; then
|
||||
org_mongod_ver=""
|
||||
else
|
||||
# install mongod 6.0
|
||||
apt_add_key_func https://www.mongodb.org/static/pgp/server-6.0.asc
|
||||
if [[ $ubuntu_version > '20' ]]; then
|
||||
sudo wget -nc http://archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1-1ubuntu2.1~18.04.20_amd64.deb
|
||||
sudo dpkg -i libssl1.1_1.1.1-1ubuntu2.1~18.04.20_amd64.deb
|
||||
sudo wget -nc http://archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl-dev_1.1.1-1ubuntu2.1~18.04.20_amd64.deb
|
||||
sudo dpkg -i libssl-dev_1.1.1-1ubuntu2.1~18.04.20_amd64.deb
|
||||
echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/6.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-6.0.list
|
||||
elif [[ $ubuntu_version =~ '18' ]] || [[ $ubuntu_version =~ '19' ]]; then
|
||||
echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/6.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-6.0.list
|
||||
org_mongod_ver=`mongod --version|grep 'Build Info' -A 20|grep 'version'|sed -E 's/\s*"version"://g'|cut -d '"' -f 2`
|
||||
fi
|
||||
if [[ "$ubuntu_version" =~ '14' ]]; then
|
||||
install_mongodb "3.2"
|
||||
else
|
||||
if [ -z "$(lscpu |grep 'avx')" ]; then #Latest version not use avx instruction is 4.4.
|
||||
install_mongodb "4.4"
|
||||
else
|
||||
echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/6.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-6.0.list
|
||||
fi
|
||||
sudo apt-get update
|
||||
sudo apt-get remove mongodb-clients --purge
|
||||
sudo apt-get install -y mongodb-org=6.0.2 mongodb-org-database=6.0.2 mongodb-org-server=6.0.2 mongodb-mongosh mongodb-org-mongos=6.0.2 mongodb-org-tools=6.0.2
|
||||
sudo service mongod stop
|
||||
sudo rm -f /var/lib/mongodb/mongod.lock
|
||||
sudo rm -f /tmp/mongodb-27017.sock
|
||||
sudo chown mongodb:mongodb /var/lib/mongodb -R
|
||||
sudo chown mongodb:mongodb /var/log/mongodb -R
|
||||
sudo service mongod restart
|
||||
sleep 10
|
||||
if [[ ! -e /usr/bin/mongo ]]; then
|
||||
sudo ln -s /usr/bin/mongosh /usr/bin/mongo
|
||||
fi
|
||||
if [ -e /tmp/mongodb-27017.sock ]; then
|
||||
push_messages "Mongo start success!"
|
||||
else
|
||||
mongod --version
|
||||
exit_code="$(echo $?)"
|
||||
#if mongo 6 core dump, then install mongo 5
|
||||
if [ $exit_code != 0 ] && [ $exit_code != 1 ]; then
|
||||
sudo apt-get purge mongodb-org* -y
|
||||
# sudo rm -rf /var/log/mongodb
|
||||
# sudo rm -rf /var/lib/mongodb
|
||||
apt_add_key_func https://www.mongodb.org/static/pgp/server-5.0.asc
|
||||
# install mongod 5.0
|
||||
if [[ $ubuntu_version > '20' ]]; then
|
||||
sudo wget -nc http://archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1-1ubuntu2.1~18.04.20_amd64.deb
|
||||
sudo dpkg -i libssl1.1_1.1.1-1ubuntu2.1~18.04.20_amd64.deb
|
||||
sudo wget -nc http://archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl-dev_1.1.1-1ubuntu2.1~18.04.20_amd64.deb
|
||||
sudo dpkg -i libssl-dev_1.1.1-1ubuntu2.1~18.04.20_amd64.deb
|
||||
echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/5.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-5.0.list
|
||||
elif [[ $ubuntu_version =~ '18' ]] || [[ $ubuntu_version =~ '19' ]]; then
|
||||
echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/5.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-5.0.list
|
||||
else
|
||||
echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/5.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-5.0.list
|
||||
fi
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y mongodb-org=5.0.11 mongodb-org-database=5.0.11 mongodb-org-server=5.0.11 mongodb-mongosh mongodb-org-shell=5.0.11 mongodb-org-mongos=5.0.11 mongodb-org-tools=5.0.11
|
||||
sudo rm -f /var/lib/mongodb/mongod.lock
|
||||
sudo rm -f /tmp/mongodb-27017.sock
|
||||
sudo chown mongodb:mongodb /var/lib/mongodb -R
|
||||
sudo chown mongodb:mongodb /var/log/mongodb -R
|
||||
sudo service mongod restart
|
||||
sleep 10
|
||||
if [[ ! -e /usr/bin/mongo ]]; then
|
||||
sudo ln -s /usr/bin/mongosh /usr/bin/mongo
|
||||
fi
|
||||
if [ -e /tmp/mongodb-27017.sock ]; then
|
||||
push_messages "Mongo start success!"
|
||||
else
|
||||
mongod --version
|
||||
exit_code="$(echo $?)"
|
||||
#if mongo 5 core dump, then install mongo 4.4
|
||||
if [ $exit_code != 0 ] && [ $exit_code != 1 ]; then
|
||||
sudo apt-get purge mongodb-org* -y
|
||||
# sudo rm -rf /var/log/mongodb
|
||||
# sudo rm -rf /var/lib/mongodb
|
||||
apt_add_key_func https://www.mongodb.org/static/pgp/server-4.4.asc
|
||||
if [[ $ubuntu_version > '20' ]]; then
|
||||
echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/4.4 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.4.list
|
||||
elif [[ $ubuntu_version =~ '18' ]] || [[ $ubuntu_version =~ '19' ]]; then
|
||||
echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu bionic/mongodb-org/4.4 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.4.list
|
||||
else
|
||||
echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/4.4 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-4.4.list
|
||||
fi
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y mongodb-org=4.4.11 mongodb-org-server=4.4.11 mongodb-org-shell=4.4.11 mongodb-org-mongos=4.4.11 mongodb-org-tools=4.4.11
|
||||
sudo service mongod restart
|
||||
sleep 10
|
||||
if [[ ! -e /usr/bin/mongo ]]; then
|
||||
sudo ln -s /usr/bin/mongosh /usr/bin/mongo
|
||||
fi
|
||||
if [ -e /tmp/mongodb-27017.sock ]; then
|
||||
push_messages "Mongo start success!"
|
||||
else
|
||||
push_messages "mongo not yet start!"
|
||||
push_messages "Please check mongo status!"
|
||||
fi
|
||||
else
|
||||
push_messages "mongo not yet start!"
|
||||
push_messages "Please check mongo status!"
|
||||
fi
|
||||
fi
|
||||
else
|
||||
push_messages "mongo not yet start!"
|
||||
push_messages "Please check mongo status!"
|
||||
fi
|
||||
fix_mongod_and_logrotate
|
||||
install_mongodb "6.0"
|
||||
fi
|
||||
fi
|
||||
# build ImageMagick and install
|
||||
|
|
|
@ -67,6 +67,11 @@ bundle_orbit () {
|
|||
echo "Execing bundle install in $ORBIT_ROOT";
|
||||
sudo su -l $ORBIT_USER -c "cd $ORBIT_ROOT && bundle $args";
|
||||
}
|
||||
upgrade_orbit () {
|
||||
sig QUIT;
|
||||
sudo su -l $ORBIT_USER -c "cd $ORBIT_ROOT && bundle update && git fetch origin && rails runner 'a=Admin::SitesController.new;a.git_reset(%w(origin)[0],%w(update)[0]);while(1) do (Multithread.where(key: %w(update_manager)[0],status: %w(finish)[0]).count!=0 ? break : nil) end;sleep(5)' && bundle update";
|
||||
start_orbit;
|
||||
}
|
||||
case $1 in
|
||||
install)
|
||||
if [ ! -z "$2" ]; then
|
||||
|
@ -92,6 +97,30 @@ install)
|
|||
|
||||
exit 0;
|
||||
;;
|
||||
update)
|
||||
if [ ! -z "$2" ]; then
|
||||
get_orbit_root $2;
|
||||
if [ ! -z "$ORBIT_ROOT" ]; then
|
||||
bundle_orbit;
|
||||
fi
|
||||
else
|
||||
if [ -e "/home/$ORBIT_USER/closed_sites.txt" ]; then
|
||||
closed_sites="$(cat /home/$ORBIT_USER/closed_sites.txt)";
|
||||
else
|
||||
closed_sites="";
|
||||
fi
|
||||
for APP in `ls -1 $NGINX_ORBIT_SITES`; do
|
||||
get_orbit_root $APP;
|
||||
if [ ! -z "$ORBIT_ROOT" ]; then
|
||||
if [[ ! "$closed_sites" =~ "$ORBIT_ROOT" ]]; then
|
||||
upgrade_orbit;
|
||||
fi
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
exit 0;
|
||||
;;
|
||||
start)
|
||||
if [ ! -z "$2" ]; then
|
||||
get_orbit_root $2;
|
||||
|
@ -254,10 +283,10 @@ create)
|
|||
|
||||
cd ~
|
||||
sudo wget http://gitlab.tp.rulingcom.com/erictyl/install_r45_on_ubuntu_1804lts_doc/-/raw/master/nginx4-5.conf -O $NGINX_ORBIT_SITES/$site_name
|
||||
sudo perl -pi -e "s/{{ORBIT}}/$site_name/g" $NGINX_ORBIT_SITES/$site_name
|
||||
sudo perl -pi -e "s#{{ORBIT_SITES}}#${ORBIT_SITES}#g" $NGINX_ORBIT_SITES/$site_name
|
||||
sudo perl -pi -e "s/{{PORT}}/$PORT/g" $NGINX_ORBIT_SITES/$site_name
|
||||
sudo perl -pi -e "s/{{SERVER_NAME}}/$SERVER_NAME/g" $NGINX_ORBIT_SITES/$site_name
|
||||
sudo perl -pi -e "s/\{\{ORBIT\}\}/$site_name/g" $NGINX_ORBIT_SITES/$site_name
|
||||
sudo perl -pi -e "s#\{\{ORBIT_SITES\}\}#${ORBIT_SITES}#g" $NGINX_ORBIT_SITES/$site_name
|
||||
sudo perl -pi -e "s/\{\{PORT\}\}/$PORT/g" $NGINX_ORBIT_SITES/$site_name
|
||||
sudo perl -pi -e "s/\{\{SERVER_NAME\}\}/$SERVER_NAME/g" $NGINX_ORBIT_SITES/$site_name
|
||||
sudo service nginx reload
|
||||
sudo su -l $ORBIT_USER -c "mkdir -p $ORBIT_SITES"
|
||||
sudo su -l $ORBIT_USER -c "cd $ORBIT_SITES && git clone $ORBIT_GIT $site_name"
|
||||
|
|
Loading…
Reference in New Issue