How can I make erp available in LAN, deployed with docker?

Hi there!

I am trying to deploy ERP on my local server on a VM of Ubuntu Server 18. I have followed this steps from here.

I don’t know what i have missed… but when i try to access the site name or the ip address of VM does not work…

Any help please?

you want to access the site from your own machine where the VM resides or from another machine on your local network?

I’d recommend not to use docker then.

Docker in Ubuntu VM/Virtualbox on Windows?

If you’re already on Ubuntu 18.04 VM, try using easy install script directly.

or https://erpnext.org/download

Hi!

I use vmware hyper-V on bare metal server. I have a VM with Ubuntu Server where i have installed Docker.

I’ve not installed ERPNext inside docker on a vm to be accessed from LAN.

General points to consider.

  • Only Dns multi tenancy is available in docker.
  • Site names resolve to sites created, ip won’t serve sites
  • if it’s single machine trying to resolve site, edit /etc/hosts file for that machine.
  • if machines from lan want to access the site, setup local DNS server, map the ip with custom domain and use that dns server from all machines trying to access ERPNext site.

I’ve not done this myself, so can’t know what can go wrong.

Ok. Than my question is: How can someone who access my local IP of VM to be redirected to the ERP docker container inside that VM?

  1. Docker publish port on host, in this case VM. Allow firewall rules on VM for published ports.
  2. Port-foward vm ports to bare metal, Allow firewall rules on bare metal for port-forwarded ports.

Can you please be more explicit in what means

Docker publish port on host

and how to do that?

In my local area everyone has access to everyone, so the firerules are not a problem. Just to know how to configure properly the Docker containers.

the section in docker-compose file for ports: publishes the ports on docker host.

once the ports are published the container can be accessed via localhost:port inside vm,

then you’ll need to port forward vm to bare-metal machine.

Sorry, but this don’t help me… docker-compose.yml is already well configured; it is already publishing ports to host…

I don’t know anything about Vmware Hyper V.

In Virtualbox I have to right click vm, settings > Network > Advance > Port Forwarding
and add host and guest ports, after that I am able to access ports from virtualbox vm on my laptop.

Well… is not the hyper V the problem… the problem is inside the VM. I am asking how can I redirect someone who access my local ip at 80 port to the docker container(or to host of erp) ?

You can us iptables (google iptables forward host port 80 to container)… If your use case is not for a large scape deployment, perhaps you should reconsider whether you want to deploy with docker… if your host is an Ubuntu VM - and you need containerization, consider using lxd instead. lxd installs easily via snap and the resultant container is like a linux vm in which you can use all the std bench commands, etc, - for which you will find lot of help on this forum… just my two cents.

1 Like

Hi! Thanks for advice, but I would like to deploy ERP with Docker. It is really strange what is happening… I can access ERP from http://localhost from inside of VM but when I try to access 192.168.x.x (the local ip of VM) i get this 404 page not found error page:

If the docker containers are stopped, i get this page error:

Do you havee any clue how to debug this thing?

What is DNS based multi tenancy? Multitenant Setup · frappe/bench Wiki · GitHub

This means the url you enter in browser is treated as sitename.

If you enter http://localhost then there should be a site called “localhost” instead of “mysite.localhost” or “example.com”. Same applies with http://192.168.x.x

here is similar issue How to access erpnext from another host on the same local area network · Issue #340 · frappe/frappe_docker · GitHub

Lan Access is not the problem.

404 page not found is from traefik container. It means connection to docker in established.

Try these steps.

  1. Add following labels to erpnext-nginx service
      - "traefik.http.routers.erpnext-nginx.rule=HostRegexp(`{catchall:.*}`)"
      - "traefik.http.middlewares.erpnext-nginx.headers.customrequestheaders.Host=erpnext-nginx"
      - "traefik.http.routers.erpnext-nginx.middlewares=erpnext-nginx"
  erpnext-nginx:
    image: frappe/erpnext-nginx:${ERPNEXT_VERSION}
    restart: on-failure
    environment:
      - FRAPPE_PY=erpnext-python
      - FRAPPE_PY_PORT=8000
      - FRAPPE_SOCKETIO=frappe-socketio
      - SOCKETIO_PORT=9000
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.erpnext-nginx.rule=Host(${SITES})"
      - "${ENTRYPOINT_LABEL}"
      - "${CERT_RESOLVER_LABEL}"
      - "traefik.http.services.erpnext-nginx.loadbalancer.server.port=80"
      - "traefik.http.routers.erpnext-nginx.rule=HostRegexp(`{catchall:.*}`)"
      - "traefik.http.middlewares.erpnext-nginx.headers.customrequestheaders.Host=erpnext-nginx"
      - "traefik.http.routers.erpnext-nginx.middlewares=erpnext-nginx"
    volumes:
      - sites-vol:/var/www/html/sites:rw
      - assets-vol:/assets:rw
  1. copy env-local to .env and change mysite.localhost to erpnext-nginx
cp env-local .env

# change mysite.localhost to erpnext-nginx
sed -i -e "s/mysite.localhost/erpnext-nginx/g" .env

NOTE: recommended to use exact versions like (frappe v12.9.1 and erpnext v12.11.2) instead of edge or v12 tag

  1. add a file sites/currentsite.txt e.g. execute in container echo erpnext-nginx > currentsite.txt, refer frappe_docker/site-operations.md at main · frappe/frappe_docker · GitHub
  • This configuration sets default site for the deployment.
  • traefik labels: these tell all the incoming requests to be reverse proxied to erpnext-nginx container and also sets the Host header to erpnext-nginx.
  • erpnext-nginx container gets host header as erpnext-nginx irrespective of any site input in request and serves the site mentioned in currentsite.txt, erpnext-nginx
4 Likes

First: Thank you very much!!

Second: this versions are the last ones?

Yes.

Check latest versions on github release page

Please help me understand what this is and where/how do I achieve that.

Also, is this approach to get the Docker installation working in a VirtualBox VM still applicable with v13.16?

Thanks so much