-
Notifications
You must be signed in to change notification settings - Fork 0
WSGI Production Deployment
Note: This post applies to an older version of ERPNext
Use Frappe Bench
For production use, we recommend a production ready wsgi server (eg gunicorn) and reverse proxied via nginx. Also, in production you should use nginx to serve static files.
###WSGI Server
- Install gunicorn,
pip install gunicorn
###Supervisor
-
Everytime the code is updated, the wsgi server has to restart to load the changes. As the wsgi server is a long running process, you should use a process manager like supervisord.
-
Install:
sudo apt-get install supervisor
orsudo yum install supervisor
-
Configuration: Add a file gunicorn.conf to /etc/supervisor/conf.d/
[program:gunicorn] command=gunicorn -b 127.0.0.1:8000 -w 2 -t 120 lib.webnotes.app:application directory=/path/to/erpnext user=erpnext process_name=%(program_name)s autostart=True autorestart=True redirect_stderr=True
-
sudo supervisorctl reload
###NGINX
-
Install
- Installing nginx on CentOS: http://www.rackspace.com/knowledge_center/article/centos-installing-nginx-via-yum Installing nginx on Ubuntu: https://www.digitalocean.com/community/articles/how-to-install-the-latest-version-of-nginx-on-ubuntu-12-10
-
configure, /etc/nginx/nginx.conf
worker_processes 1;
user www-data www-data;
pid /var/run/nginx.pid;
error_log /tmp/nginx.error.log;
events {
worker_connections 1024;
accept_mutex off;
}
http {
include mime.types;
default_type application/octet-stream;
access_log /tmp/nginx.access.log combined;
sendfile on;
types_hash_max_size 2048;
upstream erpnext {
server 127.0.0.1:8000 fail_timeout=0;
}
server {
listen 80 default;
client_max_body_size 4G;
server_name localhost;
keepalive_timeout 5;
sendfile on;
root /path/to/erpnext;
location /private/ {
internal;
try_files /$uri =424;
}
location / {
try_files /public/$uri @magic;
}
location @magic {
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Use-X-Accel-Redirect True;
proxy_set_header Host $http_host;
proxy_read_timeout 120;
proxy_redirect off;
proxy_pass http://erpnext;
}
}
}
###Updating
cd /path/to/erpnext
./lib/wnf.py --pull origin master
./lib/wnf.py --latest
./lib/wnf.py --build
sudo supervisorctl restart gunicorn
Optionally, you can also use Apache to reverse proxy to gunicorn/uwsgi. However, it is not possible to serve static files directly via Apache.
https://help.ubuntu.com/community/ApacheReverseProxy http://stackoverflow.com/questions/1997001/setting-up-a-basic-web-proxy-in-apache#answer-1997047
####Community Wiki
- [Install ERPNext on Debian based systems](Install ERPNext on Debian based systems)
- [Install ERPNext on RedHat based systems](Install ERPNext on RedHat based systems)
- [Country wise Chart of Accounts](Country wise Chart of Accounts)
- [Developer Docs](Developer Docs)
- [Some Useful Aliases](Some Useful Aliases)
- [Test Checklists](Test Checklists)
- [Community Developed Custom Scripts](Community Developed Custom Scripts)
- [Legacy Print Formats (Category)](Legacy Print Formats (Category))
- [WSGI Production Deployment](WSGI Production Deployment)
- [Version 4 Permission Use Cases](Version 4 Permission Use Cases)
- [Adding Custom Form to Website](Adding Custom Form to Website)
- [Apache HTTP Settings for Mac OS](Apache HTTP Settings for Mac OS)
- [ERPNext Upgrade to Version 5](ERPNext Upgrade to Version 5)
- [Feature Suggestions](Feature Suggestions)
- [How to Install ERPNext Version 3](How to Install ERPNext Version 3)
- [Future Development: Tracking Productivity](Future Development: Tracking Productivity)
- [Improve Precision of Stock Valuation](Improve Precision of Stock Valuation)
- [Integrating Emails in ERPNext](Integrating Emails in ERPNext)
- [Migrating your erpnext instance to wsgi](Migrating your erpnext instance to wsgi)
- [MySQL configuration file](MySQL configuration file)
- [Restoring From ERPNext Backup](Restoring From ERPNext Backup)
- [Setting up Backup Manager](Setting up Backup Manager)
- [Setting up TLS SSL certificates Let's Encrypt for ERPNext sites](Setting up TLS SSL certificates Let's Encrypt for ERPNext sites)
- [Ubuntu HA Cluster with lsyncd, remote MariaDB, Apache Reverse Proxy Setup Guide](Ubuntu HA Cluster with lsyncd, remote MariaDB, Apache Reverse Proxy Setup Guide)
- [Updating ERPNext Instance](Updating ERPNext Instance)
- [Agri Farm ERPNext](Agri Farm ERPNext)
- [Troubleshooting Guide Template](Troubleshooting Guide Template)
- ["Expense or Difference account is mandatory for [YOUR ITEM HERE] as it impacts overall stock value"]("Expense or Difference account is mandatory for [YOUR ITEM HERE] as it impacts overall stock value")