This commit is contained in:
BoHung Chiu 2022-08-24 14:55:16 +08:00
parent 48ecc13113
commit a0fcc3de96
3 changed files with 22 additions and 24 deletions

View File

@ -3,7 +3,7 @@ function escape_str(){
echo $1|sed -E 's/\\+//g' |sed -E 's/[\/\.\*]/\\\0/g'
}
ubuntu_ver="$(lsb_release -rs)"
sudo echo ""
sudo apt install -y make
org_pwd="$(pwd)"
cpu_cores="$(nproc --all)"
openssl_ver="$(openssl version|xargs| awk '{print $2}')"

View File

@ -1,7 +1,8 @@
#!/bin/bash
ubuntu_version=$(lsb_release -rs)
sudo apt update
sudo apt install git -y
sudo apt install -y git
sudo apt install -y make
org_pwd=$(pwd)
if [[ $ubuntu_version =~ '14' ]]; then
sudo apt install libgmp-dev -y
@ -83,7 +84,7 @@ else
fi
# build ImageMagick and install
if [ -z $(which convert) ]; then
sudo bash -l -c "cd /root && \
sudo bash -l -c "tmp_pwd=$(pwd) && cd /root && \
apt-get install libjpeg62 -y && \
wget -nc http://download.sourceforge.net/libpng/libpng-1.5.13.tar.gz && \
tar xvfz libpng-1.5.13.tar.gz && \
@ -96,10 +97,8 @@ if [ -z $(which convert) ]; then
apt install -y cmake pkg-config libbrotli-dev && \
wget -nc https://imagemagick.org/archive/ImageMagick.tar.gz && \
tar xvfz ImageMagick.tar.gz && \
cd $(ls -d ImageMagick-7*) && \
chown $USER:$USER . -R"
tmp_pwd=$(pwd)
cd $(ls -d /root/libpng-1.5.13/ImageMagick-7*)
cd $(ls -d /root/libpng-1.5.13/ImageMagick-7*) && \
chown $USER:$USER . -R && \
sudo bash -l -c "./configure --with-bzlib=yes --with-fontconfig=yes --with-freetype=yes --with-gslib=yes --with-gvc=yes --with-jpeg=yes --with-jp2=yes --with-png=yes --with-tiff=yes --disable-shared --with-modules &&
make && make install && \
ln -s /usr/local/lib/* /usr/lib/. && \

View File

@ -28,8 +28,10 @@ else
fi
ORBIT_SITES=`pwd`
ORBIT_GIT=http://gitlab.tp.rulingcom.com/saurabh/orbit4-5.git
NGINX_ORBIT_SITES=/etc/nginx/orbit_sites
ORBIT_GIT='http://gitlab.tp.rulingcom.com/core/orbit-kernel.git'
ORBIT_BUILT_IN_EXT='http://gitlab.tp.rulingcom.com/core/default-modules/-/raw/orbit/built_in_extensions.rb'
ORBIT_DEFAULT_THEME='http://gitlab.tp.rulingcom.com/themes/default-theme.git'
NGINX_ORBIT_SITES='/etc/nginx/orbit_sites'
RAILS_ENV=production
@ -167,11 +169,6 @@ restart|reload)
exit 0;
;;
create)
if [ "$0" == "/etc/init.d/orbit" ]; then
echo "Don't use service to create."
echo "Use: orbit create $2"
exit 0
fi
test -s "$NGINX_ORBIT_SITES/$2" && echo "Site $2 already exist." && exit 0
test -s "$ORBIT_SITES/$2" && echo "File $ORBIT_SITES/$2 already exist." && exit 0
@ -179,11 +176,11 @@ create)
read -p "nginx server name: " SERVER_NAME
if [ ! -z "$SERVER_NAME" ]; then break; fi
done
while true; do
read -p "port number: " PORT
if [ ! -z "$PORT" ]; then break; fi
done
read -p "port number: " PORT
if [ -z "$PORT" ]; then
PORT="80";
fi
while true; do
read -p "database name: " DATABASE
@ -215,16 +212,18 @@ create)
sudo perl -pi -e "s/{{SERVER_NAME}}/$SERVER_NAME/g" $NGINX_ORBIT_SITES/$2
sudo service nginx reload
sudo su -l $ORBIT_USER -c "cd $ORBIT_SITES && git clone $ORBIT_GIT $2 && cd $2 && bundle"
sudo su -l $ORBIT_USER -c "cd $ORBIT_SITES && git clone $ORBIT_GIT $2"
sudo su -l $ORBIT_USER -c "cd $ORBIT_SITES/$2 && wget $ORBIT_BUILT_IN_EXT && git clone $ORBIT_DEFAULT_THEME app/templates/default-theme && bundle install"
sudo su -l $ORBIT_USER -c "cd $ORBIT_SITES/$2 && perl -pi -e \"s/orbit_4_5/$DATABASE/g\" config/mongoid.yml"
sudo su -l $ORBIT_USER -c "cd $ORBIT_SITES/$2 && bundle exec rake assets:precompile RAILS_ENV=production"
sudo su -l $ORBIT_USER -c "cd $ORBIT_SITES/$2 && bundle exec unicorn_rails -D -E $RAILS_ENV -c $ORBIT_SITES/$2/config/unicorn.rb"
sudo su -l $ORBIT_USER -c "cd $ORBIT_SITES/$2 && bundle exec rake orbit_cron:install"
# sudo su -l $ORBIT_USER -c "cd $ORBIT_SITES/$2 && bundle exec rake assets:precompile RAILS_ENV=production"
sudo su -l $ORBIT_USER -c "cd $ORBIT_SITES/$2 && bundle exec unicorn_rails -c config/unicorn.rb -D -E $RAILS_ENV"
echo "-----------------------------------------------------"
echo "$2 is ready"
echo "Path: $ORBIT_SITES/$2"
echo http://`ifconfig eth0 2>/dev/null|awk '/inet addr:/ {print $2}'|sed 's/addr://'`:$PORT
interface_name=`ip route get 8.8.8.8|xargs|awk '{print $5}'`;
local_ip=`ip a|grep "$interface_name" | grep -ohP '(?<=inet ).*(?=/24)'|sed 's/\s*$//g'|xargs|awk '{print $1}'`
echo http://$local_ip:$PORT
echo "-----------------------------------------------------"
exit 0