Browse Source

initial

gunicorn
Lucas 7 months ago
parent
commit
693bfbe6f9
  1. 28
      run.sh

28
run.sh

@ -290,7 +290,7 @@ update_debug() {
# Install required packages # Install required packages
install_packages() { install_packages() {
dnf config-manager --set-enabled crb dnf config-manager --set-enabled crb
dnf update && dnf update -y &&
yum -y install vim && yum -y install vim &&
yum -y install epel-release && yum -y install epel-release &&
yum -y install bind-utils && yum -y install bind-utils &&
@ -416,6 +416,12 @@ server {
server_name $PUB_IP; server_name $PUB_IP;
charset utf-8; charset utf-8;
client_max_body_size 75M; client_max_body_size 75M;
server_tokens off;
access_log /var/log/nginx/$APP.access.log;
error_log /var/log/nginx/$APP.error.log;
location = /favicon.ico { access_log off; log_not_found off;}
location /media { location /media {
alias /home/$USERNAME/$APP/media; alias /home/$USERNAME/$APP/media;
} }
@ -471,17 +477,13 @@ create_service_file() {
====== ======
[Unit] [Unit]
Description=$DESCRIPTION Description=$DESCRIPTION
After=syslog.target After=network.target
[Service] [Service]
ExecStart=/usr/local/bin/$SERVICE.sh
RuntimeDirectory=uwsgi
Restart=always
KillSignal=SIGQUIT
Type=notify
StandardError=syslog
NotifyAccess=all
User=$USERNAME User=$USERNAME
Group=nginx
WorkingDirectory=/home/$USERNAME/$APP
ExecStart=/usr/local/bin/$SERVICE.sh
[Install] [Install]
WantedBy=multi-user.target WantedBy=multi-user.target
@ -494,10 +496,10 @@ fi
# Criar o script que executa o modo Emperor do uWSGI # Criar o script que executa o modo Emperor do uWSGI
# Create the script called by systemctl service # Create the script called by systemctl service
create_script_emperor() { create_script_executor() {
cat > /usr/local/bin/$SERVICE.sh <<EOF cat > /usr/local/bin/$SERVICE.sh <<EOF
#!/bin/bash #!/bin/bash
/home/$USERNAME/$APP/$VENV/bin/uwsgi --emperor /etc/uwsgi/vassals --uid centos --gid centos /home/$USERNAME/$APP/$VENV/bin/gunicorn --access-logfile - --workers 3 --bind unix:/home/$USERNAME/$APP/$APP.sock $WSGI_FOLDER_NAME.wsgi:application
EOF EOF
chmod +x /usr/local/bin/$SERVICE.sh chmod +x /usr/local/bin/$SERVICE.sh
if [[ $? -ge 1 ]]; then if [[ $? -ge 1 ]]; then
@ -554,12 +556,10 @@ declare -a commands=(
"execute_collec_mig_createsup" "execute_collec_mig_createsup"
"install_firewall" "install_firewall"
"enable_ports" "enable_ports"
"manage_default_nginx_file"
"create_nginx_file" "create_nginx_file"
"create_uwsgi_ini_file"
"criar_emperor_uwsgi" "criar_emperor_uwsgi"
"create_service_file" "create_service_file"
"create_script_emperor" "create_script_executor"
"run_service" "run_service"
) )

Loading…
Cancel
Save