Installing ERPnext on ubuntu VPS already serving multiple sites using nginx

Hello,
I am new to Frappe and ERPnext, and I’m seeking some insight into a my specific setup.

I own a dedicated server running Ubuntu, which I use to host multiple websites based on different CRMs/frameworks(wordpreas, Express.js, etc…).

So on this server I am already using Nginx, MySQL, node, python, docker, etc

My question is if it is possible to install a production ready ERPnext on that same server, alongside these applications (Note: the server has enough RAM and disk space)

In other words, my main concerns are:

  1. Would it work? And if so, is it better to go the docker way?

  2. The docker installation requires traefik. Wouldn’t traefik cause a conflict with the already running Nginx webserver?

  3. If if turns out to be possible, how can make ERPnext be accessed via a subdomain? (I have configured the base domain to serve the company’s website). What is the proper way to configure both Nginx & ERPNext for that matter.

Thank you for taking the time to read this. Any help is appreciated, whether partial or complete.

Thank you.

@T33KS I dont recommand docker , use the normal method . just setup the production mode using a different port . you can install many erpnext servers along with other applications .

On same server can work, but the risks you carry is unwarranted changes to config, apt, pip packages which may not be compatible with old or new set-up (now or in future)
I would call this as experimental.

if you don’t want to go with docker, lxd is good alternative to maintain isolation.

Btw traefik can be configured to be behind nginx getting only erpnext related requests. Or alternatively traefik can be ahead forwarding all non erpnext request to your existing nginx.

1 Like

It doesn’t require traefik.

Traefik is just used to make letsencrypt automated.

The frontend service serves the sites on port 8080 you can map it internally to any port and then keep using nginx reverse proxy

Send traffic from your nginx to internal 8080 which is served by erpnext docker compose.

It figures out the site to serve by looking at the host header. So you need to make sure the host header is forwarded.

If you wish to serve only one site then override the host header in your nginx and set it to the default site name to serve.

If you already use docker, using docker is easy as adding a service or stack. Dependencies and updates won’t be a problem in that case.

1 Like

The developer prefer the docker installation.

Github: GitHub - frappe/erpnext: Free and Open Source Enterprise Resource Planning (ERP)

Containerized Installation

Use docker to deploy ERPNext in production or for development of Frappe apps. See GitHub - frappe/frappe_docker: Docker images for production and development setups of the Frappe framework and ERPNext for more details.

Why you didn’t recommand the Docker method?

Better is podman.

Greets
jannis

1 Like

we decided to use lxd - as it is already included in ubuntu/debian and does not require docker daemon to be running all the time (our setup is small with mariadb, wordpress and erp containers). Each container is its own server and so the setup / install commands for erp stay same as in a standalone server - and a lot of documentation can be found on this forum. database container is shared and its internal ip address can be specified in erpnext under db_host in site_config. you can use a front facing “gatekeeper” container like haproxy or nginx as a reverse proxy to redirect traffic to the desired container (wordpress sites or erp sites not mariadb) based on url - and learning curve is minimal as you only need to learn some rudimentary commands around managing / bashing in/out of containers. Automated backup is easy.

docker is also good - and perhaps better suited for large company installs - it does not consume as much storage (read up on application container vs os install for each container for lxd) - which is better depends on your requirements… frankly I am not a developer and find docker commands confusing. have not researched podman.

2 Likes

As much as I enjoy reading posts about docker I’ve found it nearly impossible to use for ERPNext deployment. It sounds interesting when the pros use it but a noob (like me) will fall into a bottomless pit if you attempt it without some level of knowledge about how to manipulate docker beyond reading ‘how to’ posts here (trust me I have tried and failed many times).

LXD seems the easiest route at the moment except you have a deep knowledge of docker in which case I’d say go for it.

1 Like

Thank you for all your answers.
I can see that there are different opinions/preferences.

I am going to first try the docker way, since it won’t affect any of my local files.

My config is the following:

  • myurl.com is pointed at my server IP and a local installation of Nginx forwards it to the wordpress site through reverse proxy.

  • Now I would like my ERPnext instance to be accessible on erp.myurl,com

Do I need some specific option turned on/modified during the ERPnext setup, if the site I am linking is actually a subdomain? (while researching this I came across multi-tenancy being referred to).

Should I install Traefik or I can manage the Let’s Encrypt manually?

Thank you

If you are aware of managing it manually or doing it already then continue with same process.

I’ll suggest check automation tools that work for you.

chances are no one will help you with traefik here, you’ll have to check Google, stackoverflow or traefik docs and forum.

1 Like

Thanks again for your answer.

I have two questions:

  1. I skipped the Traefik docker compose step from here:
    frappe_docker/single-server-example.md at main · frappe/frappe_docker · GitHub

Now how do I exclude it from the erpnext docker compose?

  1. I have pointed my sub.domain.com to my server, but how can I configure my local nginx installation to forward sub.domain.com to the docker image?

Thank you

you can just reverse proxy the port localhost:8080 or whichever you have published in compose.

check example here frappe_docker/docs/port-based-multi-tenancy.md at main · frappe/frappe_docker · GitHub

make sure proxy_set_header X-Frappe-Site-Name and proxy_set_header Host point to the site name or $host.

1 Like

Thanks you.

I am still not sure which file I should amend to exclude Traefic from docker-compose.

Which file are you referencing here?

Thanks again

in your erpnext compose there is no traefik.

traefik is installed separately.

erpnext container has frontend service which serves site on port 8080.

traefik is configured using service labels on frontend service, those labels are useless if traefik is not installed. You can expose that service on port 8080 using ports: Once it is available on localhost 8080 you can configure /etc/nginx/conf.d/erpnext.conf or place a conf in nginx config directory that reverse proxy to localhost 8080.

line in code for label:

Thanks again,

I sent you a PM with a particular issue.

One additional thing:

If I create the local nginx block from this link:

I get the following error in local nginx:

nginx: [emerg] host not found in upstream “erpnext-nginx” in /etc/nginx/conf.d/erpn.conf:13

(even if I useproxy_pass http://erpnext-nginx instead of http://frontend)

that example if for containers.
it is trying to access the backend containers with container host name.

use localhost for non container setup of nginx. The localhost is where 8080 is going to be exposed.

I am using a container setup (docker). I followed these instructions:

But I am getting the above error.

And when I check Portainer, I can’t see any published ports.
(I sent you my Portainer credentials via PM, it would be great if you could check it when you have time)

I solved it.

I had to delete the directory on my Ubuntu server:

~/data/mariadb:/var/lib/mysql

For more info check the issue I closed on GitHub