Featured Frappe/ERPNext Technology

Setup ERPNext for Production

When ERPNext is installed in development mode, you will have to restart the instance with the bench start command every time you want to access it. You can however start your instance when the server boots by setting up your instance for production.

In this article, I will show you a simple way to move your instance from development mode to production mode.

We will be using Supervisor to manage to manage the ERPNext process and Nginx as a reverse proxy to access the ERPNext process without using port 8000.

Process

There are two ways this can be done. I will start with the simple and straightforward one.

Run the below commands from your bench directory:

sudo bench setup production [BENCH USER]
sudo supervisorctl restart all

If you are successful, your instance should be in production mode.

If this didn’t work for you, follow the following steps:

First, change the user to your bench user and install Supervisor and Nginx with the following command:

su - erpnext
sudo apt-get -y install supervisor nginx

Next, install the frappe-bench add-on with the following command:

sudo pip3 install frappe-bench

Next, run the following command to configure ERPNext for a production environment:

sudo /home/erpnext/.local/bin/bench setup production erpnext

You should see the following output:

Site erpnext.example.com assigned port: 80
$ sudo /usr/bin/supervisorctl reread
erpnext-redis: available
erpnext-web: available
erpnext-workers: available
$ sudo /usr/bin/supervisorctl update
erpnext-redis: added process group
erpnext-web: added process group
erpnext-workers: added process group
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
$ sudo systemctl reload nginx

At this point, ERPNext is installed and configured to run on port 80. Now, open your web browser and type in Your URL without the port.

 

10 thoughts on “Setup ERPNext for Production

  1. Thanks for the prompt response, i was able to install and run erpenxt with the install guide, but trying to switch to production i am getting errors please help

    erpnext@erpnext:~$ sudo /home/erpnext/.local/bin/bench setup production erpnext
    sudo: /home/erpnext/.local/bin/bench: command not found
    step #3 of this guide.

    thanks again

      1. I try it, but doesn’t works.

        Please see below:

        erpnext@h-98441:~/.local$ cd /
        erpnext@h-98441:/$ cd home
        erpnext@h-98441:/home$ cd erpnext
        erpnext@h-98441:~$ sudo .local/bin/bench setup production erpnext
        sudo: .local/bin/bench: command not found
        erpnext@h-98441:~$ sudo /.local/bin/bench setup production erpnext
        sudo: /.local/bin/bench: command not found
        erpnext@h-98441:~$ cd .local
        erpnext@h-98441:~/.local$ cd bin
        -bash: cd: bin: No such file or directory
        erpnext@h-98441:~/.local$ ls
        share
        erpnext@h-98441:~/.local$ sudo /bin/bench setup production erpnext
        sudo: /bin/bench: command not found
        erpnext@h-98441:~/.local$

Leave a Reply

Open Chat