Browse Source

update: remove uwsgi staff

gunicorn
Lucas 7 months ago
parent
commit
ac551141cb
  1. 79
      run.sh

79
run.sh

@ -47,7 +47,7 @@ SERVICE="app.service"
# Descrição do serviço no Systemctl # Descrição do serviço no Systemctl
# Systemctl service description # Systemctl service description
DESCRIPTION="Django VPS uWSGI Emperor" DESCRIPTION="Django VPS"
# Adicionar o certificado digital na aplicação com Certbot. Escreva sim, se já possuir um domínio na internet # Adicionar o certificado digital na aplicação com Certbot. Escreva sim, se já possuir um domínio na internet
# Apply certbot ssl certificate, hit yes if you already have a domain # Apply certbot ssl certificate, hit yes if you already have a domain
@ -364,51 +364,10 @@ enable_ports() {
fi fi
} }
# Corrigir a configuração inicial do nginx
# Manage default nginx config file
manage_default_nginx_file() {
mv /etc/nginx/nginx.conf /etc/nginx/nginx.conf~ &&
cat > /etc/nginx/nginx.conf <<EOF
user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log;
pid /run/nginx.pid;
include /usr/share/nginx/modules/*.conf;
events {
worker_connections 1024;
}
http {
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
include /etc/nginx/mime.types;
default_type application/octet-stream;
include /etc/nginx/conf.d/*.conf;
}
EOF
}
# Criar o arquivo de configurações do NGINX # Criar o arquivo de configurações do NGINX
# Create nginx config file # Create nginx config file
create_nginx_file() { create_nginx_file() {
cat > /etc/nginx/conf.d/$APP.conf <<EOF cat > /etc/nginx/conf.d/$APP.conf <<EOF
upstream django {
server unix:///home/$USERNAME/$APP/mysite.sock;
}
server { server {
listen 80; listen 80;
@ -428,8 +387,7 @@ server {
alias /home/$USERNAME/$APP/static; alias /home/$USERNAME/$APP/static;
} }
location / { location / {
uwsgi_pass django; proxy_pass http://unix:/home/$USERNAME/$APP/$APP.sock;
include /etc/nginx/uwsgi_params;
} }
} }
EOF EOF
@ -438,37 +396,6 @@ if [[ $? -ge 1 ]]; then
fi fi
} }
# Criar o arquivo de inicialização do uWSGI
# Create uwsgi ini file
create_uwsgi_ini_file() {
cat > /home/$USERNAME/$APP/uwsgi.ini <<EOF
[uwsgi]
chdir = /home/$USERNAME/$APP
module = $WSGI_FOLDER_NAME.wsgi
pythonpath = /home/$USERNAME/$APP/$VENV
master = true
processes = 10
socket = /home/$USERNAME/$APP/mysite.sock
vacuum = true
chmod-socket = 666
EOF
if [[ $? -ge 1 ]]; then
update_step_error "$x"
fi
}
# Criar o modo Emperor do uWSGI
# Create uWSGI Emperor mode
criar_emperor_uwsgi() {
mkdir -p /etc/uwsgi/vassals &&
if [[ ! -f /etc/uwsgi/vassals/uwsgi.ini ]]; then
ln -s /home/$USERNAME/$APP/uwsgi.ini /etc/uwsgi/vassals
fi
if [[ $? -ge 1 ]]; then
update_step_error "$x"
fi
}
# Cria um serviço no systemctl # Cria um serviço no systemctl
# Create a systemctl service # Create a systemctl service
create_service_file() { create_service_file() {
@ -480,7 +407,6 @@ After=network.target
[Service] [Service]
User=$USERNAME User=$USERNAME
Group=nginx
WorkingDirectory=/home/$USERNAME/$APP WorkingDirectory=/home/$USERNAME/$APP
ExecStart=/usr/local/bin/$SERVICE.sh ExecStart=/usr/local/bin/$SERVICE.sh
@ -556,7 +482,6 @@ declare -a commands=(
"install_firewall" "install_firewall"
"enable_ports" "enable_ports"
"create_nginx_file" "create_nginx_file"
"criar_emperor_uwsgi"
"create_service_file" "create_service_file"
"create_script_executor" "create_script_executor"
"run_service" "run_service"

Loading…
Cancel
Save