ERPNext.com Frappe Cloud Support Partners Foundation Frappe School

Install ERPNext Docker without NGINX / LetsEncrypt

Hello,

I would like to install ERPNext Docker but without installing any kind of proxy and/or LetsEncrypt. I already have an external NGINX proxy which I want to use in order to connect to ERPNext.

I guess that I should comment erpnext-nginx in the Docker-Compose file?

Can you please let me know:

  • what container is basically exposing the app to NGINX?
  • what port is exposed, in order for me to route traffic from NGINX to ERPNext?

Thank you

no! that is part of application.

comment the traefik.

erpnext-nginx port 80 is where app is served finally.

all proxies, letsencrypt happens after that.

if you observe, traefik service publishes 80 and 443 for letsencrypt and proxy. use and configure your proxy.

refer frappe_docker wiki for custom howtos

Thank you for the fast reply! I was really pleasantly surprised!

  1. I cannot see Traefik on the Multi-Bench documentation. Does this type of deployment contain any proxy and/or LetsEncrypt integration? In my specific use case it should not.
docker-compose \
    --project-name <project-name> \
    -f installation/docker-compose-common.yml \
    -f installation/docker-compose-erpnext.yml \
    -f installation/docker-compose-networks.yml \
    up -d

Is there any proxy/LE involved in this ^ deployment scenario?

  1. Can you please let me know what variables are not required, in a external proxy environment, for Single Bench deployments when editing env-production (.env)? Here’s the full list, kindly let me know which ones should be commented out:
LETSENCRYPT_EMAIL=email@example.com
ERPNEXT_VERSION=edge
FRAPPE_VERSION=edge
MARIADB_HOST=mariadb
MYSQL_ROOT_PASSWORD=admin
SITE_NAME=erp.example.com
SITES=`erp.example.com`
DB_ROOT_USER=root
ADMIN_PASSWORD=admin
INSTALL_APPS=erpnext
ENTRYPOINT_LABEL=traefik.http.routers.erpnext-nginx.entrypoints=websecure
CERT_RESOLVER_LABEL=traefik.http.routers.erpnext-nginx.tls.certresolver=myresolver
HTTPS_REDIRECT_RULE_LABEL=traefik.http.routers.http-catchall.rule=hostregexp(`{host:.+}`)
HTTPS_REDIRECT_ENTRYPOINT_LABEL=traefik.http.routers.http-catchall.entrypoints=web
HTTPS_REDIRECT_MIDDLEWARE_LABEL=traefik.http.routers.http-catchall.middlewares=redirect-to-https
HTTPS_USE_REDIRECT_MIDDLEWARE_LABEL=traefik.http.middlewares.redirect-to-https.redirectscheme.scheme=https
SKIP_NGINX_TEMPLATE_GENERATION=0
WORKER_CLASS=gthread

Thank you!

it is using https://github.com/evertramos/docker-compose-letsencrypt-nginx-proxy-companion for proxy and letsencrypt

required variables

# needed for setting version tag
ERPNEXT_VERSION=edge
FRAPPE_VERSION=edge

# for Mariadb
MARIADB_HOST=mariadb
MYSQL_ROOT_PASSWORD=admin

# for site
SITE_NAME=erp.example.com
DB_ROOT_USER=root
ADMIN_PASSWORD=admin
INSTALL_APPS=erpnext

# for nginx config
SKIP_NGINX_TEMPLATE_GENERATION=0

# for gunicorn worker type
WORKER_CLASS=gthread

check this for port based sites https://github.com/frappe/frappe_docker/wiki/Port-Based-Multi-Tenancy

Ok, last step I guess. What should I remove from erpnext-nginx? I guess that everything from labels?

  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
      - SKIP_NGINX_TEMPLATE_GENERATION=${SKIP_NGINX_TEMPLATE_GENERATION}
    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"
    volumes:
      - sites-vol:/var/www/html/sites:rw
      - assets-vol:/assets:rw

Here’s everything I did:

  1. I created a new docker-compose.yml file with this exact content:
version: "3"

services:
  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
      - SKIP_NGINX_TEMPLATE_GENERATION=${SKIP_NGINX_TEMPLATE_GENERATION}
    volumes:
      - sites-vol:/var/www/html/sites:rw
      - assets-vol:/assets:rw

  erpnext-python:
    image: frappe/erpnext-worker:${ERPNEXT_VERSION}
    restart: on-failure
    environment:
      - MARIADB_HOST=${MARIADB_HOST}
      - REDIS_CACHE=redis-cache:6379
      - REDIS_QUEUE=redis-queue:6379
      - REDIS_SOCKETIO=redis-socketio:6379
      - SOCKETIO_PORT=9000
      - AUTO_MIGRATE=1
      - WORKER_CLASS=${WORKER_CLASS}
    volumes:
      - sites-vol:/home/frappe/frappe-bench/sites:rw
      - assets-vol:/home/frappe/frappe-bench/sites/assets:rw

  frappe-socketio:
    image: frappe/frappe-socketio:${FRAPPE_VERSION}
    restart: on-failure
    depends_on:
      - redis-socketio
    volumes:
      - sites-vol:/home/frappe/frappe-bench/sites:rw
      - logs-vol:/home/frappe/frappe-bench/logs:rw

  erpnext-worker-default:
    image: frappe/erpnext-worker:${ERPNEXT_VERSION}
    restart: on-failure
    command: worker
    depends_on:
      - redis-queue
      - redis-cache
    volumes:
      - sites-vol:/home/frappe/frappe-bench/sites:rw
      - logs-vol:/home/frappe/frappe-bench/logs:rw

  erpnext-worker-short:
    image: frappe/erpnext-worker:${ERPNEXT_VERSION}
    restart: on-failure
    command: worker
    environment:
      - WORKER_TYPE=short
    depends_on:
      - redis-queue
      - redis-cache
    volumes:
      - sites-vol:/home/frappe/frappe-bench/sites:rw
      - logs-vol:/home/frappe/frappe-bench/logs:rw

  erpnext-worker-long:
    image: frappe/erpnext-worker:${ERPNEXT_VERSION}
    restart: on-failure
    command: worker
    environment:
      - WORKER_TYPE=long
    depends_on:
      - redis-queue
      - redis-cache
    volumes:
      - sites-vol:/home/frappe/frappe-bench/sites:rw

  erpnext-schedule:
    image: frappe/erpnext-worker:${ERPNEXT_VERSION}
    restart: on-failure
    command: schedule
    depends_on:
      - redis-queue
      - redis-cache
    volumes:
      - sites-vol:/home/frappe/frappe-bench/sites:rw
      - logs-vol:/home/frappe/frappe-bench/logs:rw

  redis-cache:
    image: redis:latest
    restart: on-failure
    volumes:
      - redis-cache-vol:/data

  redis-queue:
    image: redis:latest
    restart: on-failure
    volumes:
      - redis-queue-vol:/data

  redis-socketio:
    image: redis:latest
    restart: on-failure
    volumes:
      - redis-socketio-vol:/data

  mariadb:
    image: mariadb:10.3
    restart: on-failure
    environment:
      - MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD}
    volumes:
      - ./installation/frappe-mariadb.cnf:/etc/mysql/conf.d/frappe.cnf
      - mariadb-vol:/var/lib/mysql

  site-creator:
    image: frappe/erpnext-worker:${ERPNEXT_VERSION}
    restart: "no"
    command: new
    depends_on:
      - erpnext-python
    environment:
      - SITE_NAME=${SITE_NAME}
      - DB_ROOT_USER=${DB_ROOT_USER}
      - MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD}
      - ADMIN_PASSWORD=${ADMIN_PASSWORD}
      - INSTALL_APPS=${INSTALL_APPS}
    volumes:
      - sites-vol:/home/frappe/frappe-bench/sites:rw
      - logs-vol:/home/frappe/frappe-bench/logs:rw

volumes:
  mariadb-vol:
  redis-cache-vol:
  redis-queue-vol:
  redis-socketio-vol:
  assets-vol:
  sites-vol:
  cert-vol:
  logs-vol:
  1. I’ve created a /docker/erpnext/nginx.conf file with this contents:
server {
        listen 8001;
        server_name $http_host;

        location / {

                rewrite ^(.+)/$ $1 permanent;
                rewrite ^(.+)/index\.html$ $1 permanent;
                rewrite ^(.+)\.html$ $1 permanent;

                proxy_set_header X-Frappe-Site-Name mysite.localhost;
                proxy_set_header Host erp.avocat-ludusan.ro;
                proxy_pass  http://erpnext-nginx;
        }
}
  1. I’ve ran docker-compose --project-name erp up -d in order to start the ERPNext containers.

  2. I’ve ran docker run --network=erp_default -p 8001:8001 --volume=/docker/erpnext/nginx.conf:/etc/nginx/conf.d/default.conf -d nginx in order to start NGINX

  3. I’ve forwarded http://erp.avocat-ludusan.ro and https://erp.avocat-ludusan.ro to http://192.168.1.203:8001.

Unfortunately I’m getting this:

Not Found

erp.avocat-ludusan.ro does not exist

Any hints?

share access for me to check your servers

Sent in PM. Thank you very much!

also change the site name here.

site name must be whatever you use for the new site created under the setup. e.g. erp.local, or erp.avocat-ludusan.ro

exec into erpnext-python container and list contents of /home/frappe/frappe-bench/sites directory to find out created sites

@revant_one i have followed the same method but my challenge is that the below container is not able to connect with mariadb

Running schedule_1 container below

Mariadb Logs below

any thoughts !!

@Razva - do you also have similar issue ? Is your swarm working :sweat_smile: i have been trying for a while now i do have an Nginx Proxy Manager running already so i’m trying to use the app name “erpnext-nginx with port 80” to access with a domain + SSL

would love to know if it worked for you and how :slight_smile:

it should connect to the frappe-network then it’ll be able to access mariadb

Hello @revant_one , all the containers are in the same network

nginx_default

but i am still getting this error, am i missing something

below is the yml i’m using in Portainer

version: "3"
networks:
  default:
    external:
      name: nginx_default
services:
  erpnext-nginx:
    image: frappe/erpnext-nginx:v13.11.1
    restart: on-failure
    environment:
      - FRAPPE_PY=erpnext-python
      - FRAPPE_PY_PORT=8000
      - FRAPPE_SOCKETIO=frappe-socketio
      - SOCKETIO_PORT=9000
      - SKIP_NGINX_TEMPLATE_GENERATION=0
    volumes:
      - sites-vol:/var/www/html/sites:rw
      - assets-vol:/assets:rw

  erpnext-python:
    image: frappe/erpnext-worker:v13.11.1
    restart: on-failure
    environment:
      - MARIADB_HOST=mariadb
      - REDIS_CACHE=redis-cache:6379
      - REDIS_QUEUE=redis-queue:6379
      - REDIS_SOCKETIO=redis-socketio:6379
      - SOCKETIO_PORT=9000
      - AUTO_MIGRATE=1
      - WORKER_CLASS=gthread
    volumes:
      - sites-vol:/home/frappe/frappe-bench/sites:rw
      - assets-vol:/home/frappe/frappe-bench/sites/assets:rw

  frappe-socketio:
    image: frappe/frappe-socketio:v13.11.0
    restart: on-failure
    depends_on:
      - redis-socketio
    volumes:
      - sites-vol:/home/frappe/frappe-bench/sites:rw
      - logs-vol:/home/frappe/frappe-bench/logs:rw

  erpnext-worker-default:
    image: frappe/erpnext-worker:v13.11.1
    restart: on-failure
    command: worker
    depends_on:
      - redis-queue
      - redis-cache
    volumes:
      - sites-vol:/home/frappe/frappe-bench/sites:rw
      - logs-vol:/home/frappe/frappe-bench/logs:rw

  erpnext-worker-short:
    image: frappe/erpnext-worker:v13.11.1
    restart: on-failure
    command: worker
    environment:
      - WORKER_TYPE=short
    depends_on:
      - redis-queue
      - redis-cache
    volumes:
      - sites-vol:/home/frappe/frappe-bench/sites:rw
      - logs-vol:/home/frappe/frappe-bench/logs:rw

  erpnext-worker-long:
    image: frappe/erpnext-worker:v13.11.1
    restart: on-failure
    command: worker
    environment:
      - WORKER_TYPE=long
    depends_on:
      - redis-queue
      - redis-cache
    volumes:
      - sites-vol:/home/frappe/frappe-bench/sites:rw

  erpnext-schedule:
    image: frappe/erpnext-worker:v13.11.1
    restart: on-failure
    command: schedule
    depends_on:
      - redis-queue
      - redis-cache
    volumes:
      - sites-vol:/home/frappe/frappe-bench/sites:rw
      - logs-vol:/home/frappe/frappe-bench/logs:rw

  redis-cache:
    image: redis:latest
    restart: on-failure
    volumes:
      - redis-cache-vol:/data

  redis-queue:
    image: redis:latest
    restart: on-failure
    volumes:
      - redis-queue-vol:/data

  redis-socketio:
    image: redis:latest
    restart: on-failure
    volumes:
      - redis-socketio-vol:/data

  mariadb:
    image: mariadb:10.3
    restart: on-failure
    environment:
      - MYSQL_ROOT_PASSWORD=frappe
    volumes:
      - ./installation/frappe-mariadb.cnf:/etc/mysql/conf.d/frappe.cnf
      - mariadb-vol:/var/lib/mysql

  site-creator:
    image: frappe/erpnext-worker:v13.11.1
    restart: "no"
    command: new
    depends_on:
      - erpnext-python
    environment:
      - SITE_NAME=erp.ridemystyle.in
      - DB_ROOT_USER=frappe
      - MYSQL_ROOT_PASSWORD=frappe
      - ADMIN_PASSWORD=frappe
      - INSTALL_APPS=erpnext
    volumes:
      - sites-vol:/home/frappe/frappe-bench/sites:rw
      - logs-vol:/home/frappe/frappe-bench/logs:rw

volumes:
  mariadb-vol:
  redis-cache-vol:
  redis-queue-vol:
  redis-socketio-vol:
  assets-vol:
  sites-vol:
  logs-vol:

Please help !!

add admin user to your portainer and share access so I can check. Or give me ssh access.