ERPNext.com Frappe Cloud Support Partners Foundation Frappe School

404 page not found after docker installation on localhost

I am trying to install Erpnext on docker in Ubuntu 18.04. I used the method on https://github.com/frappe/frappe_docker
with single bench for local setup.
The only thing I changed was the host ports( 80 and 443 to 9080 and 6443) in docker-compose.yml as I have some other apps that use these ports . I didn’t change anything on .env file.
I didn’t see any error while installing and last line on site_creator log was
***. Scheduler is disabled *** with no errors
After installation when I try localhost:6443/9080 I get the error 404 page not found.
I wonder if anyone could help me with this?

Refer the traefik docs for configuration if more advance settings are needed.

If you have multiple apps on same server you need common traefik or any other service which routes to all internal services. Refer docker swarm setup and refer how traefik is proxying portainer, traefik dashboard and other erpnext sites.

I wasn’t trying to proxy any external service through traefik. Erpnext is the only app on docker and the port 6443 in my case should have opened erpnext.

No it won’t work just by changing ports.
Traefik in single deployment setup is used to quickly bootstrap and manage letsencrypt.

1 Like

Since this is only local setup can I not use let’s encrypt ? Is there a guide to install erpnext with this ports

refer env-local instead of env-production file

Note the ENTRYPOINT_LABEL=traefik.http.routers.erpnext-nginx.entrypoints=web and mock labels e.g. erpnext.local.no-cert-resolver

I was using env-local . I just renamed it to .env and changed the ports 80 and 443 in docker-compose because they were used by nginx reverse proxy . Can you tell me how should I edit this ?

version: "3"

services:
  traefik:
    image: "traefik:v2.2"
    command:
      - "--log.level=DEBUG"
      - "--providers.docker=true"
      - "--providers.docker.exposedbydefault=false"
      - "--entrypoints.web.address=:80"
    labels:
      - "traefik.enable=true"
    ports:
      - "9080:80"
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock:ro

  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})"
      - "traefik.http.routers.erpnext-nginx.entrypoints=web"
      - "traefik.http.services.erpnext-nginx.loadbalancer.server.port=80"
    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
    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

  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

  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

  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

  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-configurator:
    image: mariadb:10.3
    deploy:
      restart_policy:
        condition: none
    command:
      - "bash"
      - "-c"
      - >
        echo -e "[mysqld]\n
        skip-host-cache\n
        skip-name-resolve\n
        character-set-client-handshake = FALSE\n
        character-set-server = utf8mb4\n
        collation-server = utf8mb4_unicode_ci\n
        [mysql]\n
        default-character-set = utf8mb4\n
        [mysqld_safe]\n
        skip_log_error\n
        syslog\n" > /data/frappe.cnf
    volumes:
      - mariadb-conf-vol:/data:rw

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

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

volumes:
  mariadb-vol:
  redis-cache-vol:
  redis-queue-vol:
  redis-socketio-vol:
  assets-vol:
  sites-vol:
  cert-vol:
  mariadb-conf-vol:

This yaml worked for me locally. It started http://mysite.localhost:9080.

These spells may not work with upgraded or lower version of traefik.

I came up with single bench setup to keep things simple for this use case. I don’t know much about traefik, I just refer traefik docs whenever I need and get things working.

ERPNext is not easy to setup in any format.
Decent knowledge about shell scripts and linux cli is needed for easy_install or manual install
Knowledge about docker, containers, docker networking is required for docker setup.

Thank you. Now at least I have a webpage with “Sorry! We will be back soon.”
Where do I check for Log files to check errors?

The logs are found here /home/frappe/frappe-bench/logs - refer to this https://frappeframework.com/docs/user/en/directory-structure

sites volume only stores sites

check container logs.

erpnext-nginx has nginx logs
erpnext-python has gunicorn logs
erpnext-worker-* have python rq worker logs
erpnext-schedule has scheduler logs

example

docker logs <project-name>_erpnext-nginx --follow

for more options,

docker logs --help
1 Like

Ah ok thanks revant

So although volumes are like directories or folders, unlike a conventional hierarchical file system, you must use container commands to refer and ‘cd’ move between volumes…

sites-vol:/home/frappe/frappe-bench/sites

It is just a mount point.

anything that is in “sites-vol” is mounted at location /home/frappe/frappe-bench/sites

logs are located ../logs i.e. /home/frappe/frappe-bench/logs out of scope for mounted location.

exec into container, cd ../logs and logs will be there generated by that specific container.
if the app is scaled and has multiple load-balanced containers the logs will be inside that specific container.

sites-vol remain common across number of containers because it is mounted.
logs are per container.

All logs that go in files in frappe framework are also available as stdout for containers. That is what we see when we do bench start.

In cloud environment all these container logs are aggregated to a service for faster searching and filtering.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.