Fix bug.
This commit is contained in:
parent
48ecc13113
commit
a0fcc3de96
|
@ -3,7 +3,7 @@ function escape_str(){
|
||||||
echo $1|sed -E 's/\\+//g' |sed -E 's/[\/\.\*]/\\\0/g'
|
echo $1|sed -E 's/\\+//g' |sed -E 's/[\/\.\*]/\\\0/g'
|
||||||
}
|
}
|
||||||
ubuntu_ver="$(lsb_release -rs)"
|
ubuntu_ver="$(lsb_release -rs)"
|
||||||
sudo echo ""
|
sudo apt install -y make
|
||||||
org_pwd="$(pwd)"
|
org_pwd="$(pwd)"
|
||||||
cpu_cores="$(nproc --all)"
|
cpu_cores="$(nproc --all)"
|
||||||
openssl_ver="$(openssl version|xargs| awk '{print $2}')"
|
openssl_ver="$(openssl version|xargs| awk '{print $2}')"
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
ubuntu_version=$(lsb_release -rs)
|
ubuntu_version=$(lsb_release -rs)
|
||||||
sudo apt update
|
sudo apt update
|
||||||
sudo apt install git -y
|
sudo apt install -y git
|
||||||
|
sudo apt install -y make
|
||||||
org_pwd=$(pwd)
|
org_pwd=$(pwd)
|
||||||
if [[ $ubuntu_version =~ '14' ]]; then
|
if [[ $ubuntu_version =~ '14' ]]; then
|
||||||
sudo apt install libgmp-dev -y
|
sudo apt install libgmp-dev -y
|
||||||
|
@ -83,7 +84,7 @@ else
|
||||||
fi
|
fi
|
||||||
# build ImageMagick and install
|
# build ImageMagick and install
|
||||||
if [ -z $(which convert) ]; then
|
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 && \
|
apt-get install libjpeg62 -y && \
|
||||||
wget -nc http://download.sourceforge.net/libpng/libpng-1.5.13.tar.gz && \
|
wget -nc http://download.sourceforge.net/libpng/libpng-1.5.13.tar.gz && \
|
||||||
tar xvfz 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 && \
|
apt install -y cmake pkg-config libbrotli-dev && \
|
||||||
wget -nc https://imagemagick.org/archive/ImageMagick.tar.gz && \
|
wget -nc https://imagemagick.org/archive/ImageMagick.tar.gz && \
|
||||||
tar xvfz ImageMagick.tar.gz && \
|
tar xvfz ImageMagick.tar.gz && \
|
||||||
cd $(ls -d ImageMagick-7*) && \
|
cd $(ls -d /root/libpng-1.5.13/ImageMagick-7*) && \
|
||||||
chown $USER:$USER . -R"
|
chown $USER:$USER . -R && \
|
||||||
tmp_pwd=$(pwd)
|
|
||||||
cd $(ls -d /root/libpng-1.5.13/ImageMagick-7*)
|
|
||||||
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 &&
|
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 && \
|
make && make install && \
|
||||||
ln -s /usr/local/lib/* /usr/lib/. && \
|
ln -s /usr/local/lib/* /usr/lib/. && \
|
||||||
|
|
|
@ -28,8 +28,10 @@ else
|
||||||
fi
|
fi
|
||||||
|
|
||||||
ORBIT_SITES=`pwd`
|
ORBIT_SITES=`pwd`
|
||||||
ORBIT_GIT=http://gitlab.tp.rulingcom.com/saurabh/orbit4-5.git
|
ORBIT_GIT='http://gitlab.tp.rulingcom.com/core/orbit-kernel.git'
|
||||||
NGINX_ORBIT_SITES=/etc/nginx/orbit_sites
|
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
|
RAILS_ENV=production
|
||||||
|
|
||||||
|
@ -167,11 +169,6 @@ restart|reload)
|
||||||
exit 0;
|
exit 0;
|
||||||
;;
|
;;
|
||||||
create)
|
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 "$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
|
test -s "$ORBIT_SITES/$2" && echo "File $ORBIT_SITES/$2 already exist." && exit 0
|
||||||
|
|
||||||
|
@ -180,10 +177,10 @@ create)
|
||||||
if [ ! -z "$SERVER_NAME" ]; then break; fi
|
if [ ! -z "$SERVER_NAME" ]; then break; fi
|
||||||
done
|
done
|
||||||
|
|
||||||
while true; do
|
|
||||||
read -p "port number: " PORT
|
read -p "port number: " PORT
|
||||||
if [ ! -z "$PORT" ]; then break; fi
|
if [ -z "$PORT" ]; then
|
||||||
done
|
PORT="80";
|
||||||
|
fi
|
||||||
|
|
||||||
while true; do
|
while true; do
|
||||||
read -p "database name: " DATABASE
|
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 perl -pi -e "s/{{SERVER_NAME}}/$SERVER_NAME/g" $NGINX_ORBIT_SITES/$2
|
||||||
sudo service nginx reload
|
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 && 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 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 unicorn_rails -c config/unicorn.rb -D -E $RAILS_ENV"
|
||||||
sudo su -l $ORBIT_USER -c "cd $ORBIT_SITES/$2 && bundle exec rake orbit_cron:install"
|
|
||||||
|
|
||||||
echo "-----------------------------------------------------"
|
echo "-----------------------------------------------------"
|
||||||
echo "$2 is ready"
|
echo "$2 is ready"
|
||||||
echo "Path: $ORBIT_SITES/$2"
|
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 "-----------------------------------------------------"
|
echo "-----------------------------------------------------"
|
||||||
|
|
||||||
exit 0
|
exit 0
|
||||||
|
|
Loading…
Reference in New Issue