fix: obter ip, criar a pasta staticfiles
This commit is contained in:
parent
632ce923ef
commit
2ca3e8c7a1
1 changed files with 6 additions and 12 deletions
18
run.sh
18
run.sh
|
|
@ -3,7 +3,7 @@
|
|||
# ===============================================
|
||||
# Esse script foi desenvolvido por Lucas F.
|
||||
# This script was developed by Lucas F.
|
||||
#
|
||||
#
|
||||
# Novembro de 2019
|
||||
# 2019, November
|
||||
#
|
||||
|
|
@ -110,7 +110,7 @@ SCRIPT_STEP_FILE="$SCRIPT_PATH/centos_django.step"
|
|||
CHARS="abcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*(-_=+)"
|
||||
for ((i=0;i<${#CHARS};i++)); do ARRAY[$i]="${CHARS:i:1}"; done
|
||||
|
||||
# Cria uma sequência de 50 caracteres aleatórios
|
||||
# Cria uma sequência de 50 caracteres aleatórios
|
||||
# Create 50 random chars
|
||||
key_gen() {
|
||||
for ((c=1; c<=50; c++)); do
|
||||
|
|
@ -167,11 +167,7 @@ fi
|
|||
# Obtém o IP
|
||||
# Get IP address
|
||||
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
|
||||
PUB_IP=$(hostname -I | cut -d" " -f1)
|
||||
fi
|
||||
|
||||
update_step_error() {
|
||||
|
|
@ -286,6 +282,7 @@ update_debug() {
|
|||
# Instala pacotes necessários
|
||||
# Install required packages
|
||||
install_packages() {
|
||||
dnf update &&
|
||||
yum -y install vim &&
|
||||
yum -y install epel-release &&
|
||||
yum -y install bind-utils &&
|
||||
|
|
@ -296,7 +293,6 @@ install_packages() {
|
|||
yum -y install nginx &&
|
||||
yum -y install net-tools &&
|
||||
yum -y install policycoreutils-python-utils.noarch &&
|
||||
dnf update
|
||||
if [[ $? -ge 1 ]]; then
|
||||
update_step_error "$x"
|
||||
fi
|
||||
|
|
@ -325,12 +321,9 @@ install_dependencies() {
|
|||
# Coletar arquivos estáticos, criar tabelas e criar super usuário
|
||||
# Perform collectstatic, migrate and createsuperuser
|
||||
execute_collec_mig_createsup() {
|
||||
if [[ -d /home/$USERNAME/$APP/staticfiles ]]; then
|
||||
mkdir -p /home/$USERNAME/$APP/staticfiles
|
||||
fi
|
||||
mkdir -p /home/$USERNAME/$APP/staticfiles &&
|
||||
/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
|
||||
}
|
||||
|
||||
# Instala o firewall
|
||||
|
|
@ -547,6 +540,7 @@ declare -a commands=(
|
|||
"install_packages"
|
||||
"create_venv"
|
||||
"install_dependencies"
|
||||
"execute_collec_mig_createsup",
|
||||
"install_firewall"
|
||||
"enable_ports"
|
||||
"manage_default_nginx_file"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue