This commit is contained in:
Lucas F 2022-01-20 17:18:22 -03:00
parent fa34d894b5
commit 6026829ca0
5 changed files with 97 additions and 14 deletions

23
run.sh
View file

@ -18,7 +18,7 @@ ARQ_CONF="centos.conf"
USERNAME="centos"
# Nome do App no repositório
# App name on repo
# Application name in repository
APP="appname"
# Nome do ambiente virtual python
@ -33,8 +33,8 @@ GIT_USER="username"
# Git project url
GITURL="https://repo.com/$GIT_USER/$APP.git"
# IP público ou domínio
# Public IP address or domain
# IP público ou domínio. Se deixar em branco o script vai capturar o endereço de IP com o comando hostname
# Public IP address or domain. If you leave it blank, the script'll catch the IP address with hostname command
PUB_IP=""
# Nome da pasta que está no mesmo nível do arquivo wsgi.py
@ -130,7 +130,7 @@ fi
if [[ -f "$SCRIPT_STEP_FILE" ]]; then
. "$SCRIPT_STEP_FILE"
fi
echo "step>$STEP"
# Verifica se deve exibir as mensagens em português do Brasil
# Check if the language pt_br has been chosen
if [[ ${PTBR,,} == "yes" ]] || [[ ${PTBR,,} == "sim" ]]; then
@ -166,10 +166,12 @@ fi
# Obtém o IP
# Get IP address
if [[ -n $(man hostname | awk '{RS="";FS="\n"} /-i,/ {print}') ]];then
PUB_IP=$(hostname -i | cut -d" " -f1)
else
PUB_IP=$(hostname -I | cut -d" " -f1)
if [[ ! -n $PUB_IP ]]; then
if [[ -n $(man hostname | awk '{RS="";FS="\n"} /-i,/ {print}') ]]; then
PUB_IP=$(hostname -i | cut -d" " -f1)
else
PUB_IP=$(hostname -I | cut -d" " -f1)
fi
fi
update_step_error() {
@ -292,6 +294,7 @@ install_packages() {
yum -y install python3-devel &&
yum -y install gcc &&
yum -y install nginx &&
yum -y install net-tools &&
yum -y install policycoreutils-python-utils.noarch &&
dnf update
if [[ $? -ge 1 ]]; then
@ -325,7 +328,7 @@ execute_collec_mig_createsup() {
if [[ -d /home/$USERNAME/$APP/staticfiles ]]; then
mkdir -p /home/$USERNAME/$APP/staticfiles
fi
/home/$USERNAME/$APP/$VENV/bin/python3 /manage.py collectstatic &&
/home/$USERNAME/$APP/$VENV/bin/python3 /manage.py collectstatic --noinput &&
/home/$USERNAME/$APP/$VENV/bin/python3 /manage.py migrate &&
/home/$USERNAME/$APP/$VENV/bin/python3 /manage.py createsuperuser
}
@ -502,6 +505,7 @@ fi
# Start service
run_service() {
chmod -R 751 /home/$USERNAME
chmod -R 755 /home/$USERNAME/$APP
chmod 664 /etc/systemd/system/$SERVICE &&
chown -R $USERNAME:$USERNAME /home/$USERNAME &&
systemctl daemon-reload &&
@ -571,6 +575,7 @@ else
echo "${commands[$x]}_$x"
${commands[$x]} $x
done
echo "\033[32m${MSGS[done]}\033[0m"
fi
fi
fi