@saurabh6790
frappe-bench/config/nginx.conf
upstream frappe-bench-frappe {
server 127.0.0.1:80 fail_timeout=0;
}
upstream frappe-bench-socketio-server {
server 127.0.0.1:9000 fail_timeout=0;
}
setup maps
map $host $site_name_jqtzbpf {
it965.com erpdev;
default $host;
}
server blocks
server {
listen 80;
server_name
erpdev
it965.com
;
root /home/erpdev/frappe-bench/sites;
location /assets {
try_files $uri =404;
}
location ~ ^/protected/(.*) {
internal;
try_files /$site_name_jqtzbpf/$1 =404;
}
location /socket.io {
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header X-Frappe-Site-Name $site_name_jqtzbpf;
proxy_set_header Origin $scheme://$http_host;
proxy_set_header Host $host;
proxy_pass http://frappe-bench-socketio-server;
}
location / {
try_files /$site_name_jqtzbpf/public/$uri @webserver;
}
location @webserver {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Frappe-Site-Name $site_name_jqtzbpf;
proxy_set_header Host $host;
proxy_set_header X-Use-X-Accel-Redirect True;
proxy_read_timeout 120;
proxy_redirect off;
proxy_pass http://frappe-bench-frappe;
}
# error pages
error_page 502 /502.html;
location /502.html {
root /home/erpdev/.bench/bench/config/templates;
internal;
}
# optimizations
sendfile on;
keepalive_timeout 15;
client_max_body_size 50m;
client_body_buffer_size 16K;
client_header_buffer_size 1k;
# enable gzip compresion
# based on https://mattstauffer.co/blog/enabling-gzip-on-nginx-servers-including-laravel-forge
gzip on;
gzip_http_version 1.1;
gzip_comp_level 5;
gzip_min_length 256;
gzip_proxied any;
gzip_vary on;
gzip_types
application/atom+xml
application/javascript
application/json
application/rss+xml
application/vnd.ms-fontobject
application/x-font-ttf
application/font-woff
application/x-web-app-manifest+json
application/xhtml+xml
application/xml
font/opentype
image/svg+xml
image/x-icon
text/css
text/plain
text/x-component
;
# text/html is always compressed by HttpGzipModule
}
frappe-bench/config/supervisor.conf
; Notes:
; priority=1 → Lower priorities indicate programs that start first and shut down last
; killasgroup=true → send kill signal to child processes too
[program:frappe-bench-frappe-web]
command=/home/erpdev/frappe-bench/env/bin/gunicorn -b 127.0.0.1:80 -w 2 -t 120 frappe.app:application --preload
priority=4
autostart=true
autorestart=true
stdout_logfile=/home/erpdev/frappe-bench/logs/web.log
stderr_logfile=/home/erpdev/frappe-bench/logs/web.error.log
user=erpdev
directory=/home/erpdev/frappe-bench/sites
[program:frappe-bench-frappe-schedule]
command=/usr/local/bin/bench schedule
priority=3
autostart=true
autorestart=true
stdout_logfile=/home/erpdev/frappe-bench/logs/schedule.log
stderr_logfile=/home/erpdev/frappe-bench/logs/schedule.error.log
user=erpdev
directory=/home/erpdev/frappe-bench
[program:frappe-bench-frappe-default-worker]
command=/usr/local/bin/bench worker --queue default
priority=4
autostart=true
autorestart=true
stdout_logfile=/home/erpdev/frappe-bench/logs/worker.log
stderr_logfile=/home/erpdev/frappe-bench/logs/worker.error.log
user=erpdev
stopwaitsecs=1560
directory=/home/erpdev/frappe-bench
killasgroup=true
numprocs=1
process_name=%(program_name)s-%(process_num)d
[program:frappe-bench-frappe-short-worker]
command=/usr/local/bin/bench worker --queue short
priority=4
autostart=true
autorestart=true
stdout_logfile=/home/erpdev/frappe-bench/logs/worker.log
stderr_logfile=/home/erpdev/frappe-bench/logs/worker.error.log
user=erpdev
stopwaitsecs=360
directory=/home/erpdev/frappe-bench
killasgroup=true
numprocs=1
process_name=%(program_name)s-%(process_num)d
[program:frappe-bench-frappe-long-worker]
command=/usr/local/bin/bench worker --queue long
priority=4
autostart=true
autorestart=true
stdout_logfile=/home/erpdev/frappe-bench/logs/worker.log
stderr_logfile=/home/erpdev/frappe-bench/logs/worker.error.log
user=erpdev
stopwaitsecs=1560
directory=/home/erpdev/frappe-bench
killasgroup=true
numprocs=1
process_name=%(program_name)s-%(process_num)d
[program:frappe-bench-redis-cache]
command=/usr/bin/redis-server /home/erpdev/frappe-bench/config/redis_cache.conf
priority=1
autostart=true
autorestart=true
stdout_logfile=/home/erpdev/frappe-bench/logs/redis-cache.log
stderr_logfile=/home/erpdev/frappe-bench/logs/redis-cache.error.log
user=erpdev
directory=/home/erpdev/frappe-bench/sites
[program:frappe-bench-redis-queue]
command=/usr/bin/redis-server /home/erpdev/frappe-bench/config/redis_queue.conf
priority=1
autostart=true
autorestart=true
stdout_logfile=/home/erpdev/frappe-bench/logs/redis-queue.log
stderr_logfile=/home/erpdev/frappe-bench/logs/redis-queue.error.log
user=erpdev
directory=/home/erpdev/frappe-bench/sites
[program:frappe-bench-redis-socketio]
command=/usr/bin/redis-server /home/erpdev/frappe-bench/config/redis_socketio.conf
priority=1
autostart=true
autorestart=true
stdout_logfile=/home/erpdev/frappe-bench/logs/redis-socketio.log
stderr_logfile=/home/erpdev/frappe-bench/logs/redis-socketio.error.log
user=erpdev
directory=/home/erpdev/frappe-bench/sites
[program:frappe-bench-node-socketio]
command=/usr/bin/node /home/erpdev/frappe-bench/apps/frappe/socketio.js
priority=4
autostart=true
autorestart=true
stdout_logfile=/home/erpdev/frappe-bench/logs/node-socketio.log
stderr_logfile=/home/erpdev/frappe-bench/logs/node-socketio.error.log
user=erpdev
directory=/home/erpdev/frappe-bench
[group:frappe-bench-web]
programs=frappe-bench-frappe-web,frappe-bench-node-socketio
[group:frappe-bench-workers]
programs=frappe-bench-frappe-schedule,frappe-bench-frappe-default-worker,frappe-bench-frappe-short-worker,frappe-bench-frappe-long-worker
[group:frappe-bench-redis]
programs=frappe-bench-redis-cache,frappe-bench-redis-queue,frappe-bench-redis-socketio
/etc/supervisor/supervisord.conf
; supervisor config file
[unix_http_server]
file=/var/run/supervisor.sock ; (the path to the socket file)
chmod=0700 ; sockef file mode (default 0700)
[supervisord]
logfile=/var/log/supervisor/supervisord.log ; (main log file;default $CWD/supervisord.log)
pidfile=/var/run/supervisord.pid ; (supervisord pidfile;default supervisord.pid)
childlogdir=/var/log/supervisor ; (‘AUTO’ child log dir, default $TEMP)
; the below section must remain in the config file for RPC
; (supervisorctl/web interface) to work, additional interfaces may be
; added by defining them in separate rpcinterface: sections
[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
[supervisorctl]
serverurl=unix:///var/run/supervisor.sock ; use a unix:// URL for a unix socket
; The [include] section can just contain the “files” setting. This
; setting can list multiple files (separated by whitespace or
; newlines). It can also contain wildcards. The filenames are
; interpreted as relative to this file. Included files cannot
; include files themselves.
[include]
files = /etc/supervisor/conf.d/*.conf