Problems installation a production version (v12) with Docker

I’m installing ERPNext “v12” on a clean VM (2vCPU’s & 4GB Memory) with Ubuntu 18.04.

Let’s assume the public IP of my VM: 136.244.70.110 and I want to use ERPNext on this custom domain: https://erpnext.mycompany.com (I already linked this domain to the VM’s IP).

Here’s the script I run to prepare the VM:

#! /bin/bash

sudo apt-get update
sudo apt-get -y install \
    apt-transport-https \
    ca-certificates \
    curl \
    gnupg-agent \
    software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo apt-key fingerprint 0EBFCD88
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
sudo apt-get update
sudo apt-get -y install docker-ce docker-ce-cli containerd.io docker-compose

git clone https://github.com/evertramos/docker-compose-letsencrypt-nginx-proxy-companion.git
git clone https://github.com/frappe/frappe_docker.git

After this script runs successfully, here’s what I do:

cd docker-compose-letsencrypt-nginx-proxy-companion/
cp .env.sample .env
nano .env
# change IP=0.0.0.0 to IP=136.244.70.110
# save changes
./start.sh

cd ../frappe_docker/
cp env-example .env
nano .env
# change content to:
# => VERSION=v12
# => MARIADB_HOST=mariadb
# => MYSQL_ROOT_PASSWORD=insertstrongpasswordhere123@
# => SITES=erpnext.mycompany.com
# => LETSENCRYPT_EMAIL=admin@mycompany.com
# save changes

docker-compose \
    --project-name erpnext-mycompany \
    -f installation/docker-compose-common.yml \
    -f installation/docker-compose-erpnext.yml \
    -f installation/docker-compose-networks.yml \
    up -d

docker ps
# => https://pastebin.com/raw/zgATSUm0

Docker compose runs without errors and all containers are running but when visiting erpnext.mycompany.com in Chrome I get the error:
Your connection is not private

Attackers might be trying to steal your information from  **erpnext.mycompany.com**  (for example, passwords, messages or credit cards). [Learn more](chrome-error://chromewebdata/#)

NET::ERR_CERT_INVALID

When visiting erpnext.mycompany.com with Firefox I get this error:

When doing docker logs {ID OF CONTAINER "erpnextmycompany_erpnext-python_1"} I get

[2020-05-07 16:55:58 +0000] [25] [ERROR] Error handling request /
Traceback (most recent call last):
  File "/home/frappe/frappe-bench/apps/frappe/frappe/app.py", line 53, in application
    init_request(request)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/app.py", line 108, in init_request
    frappe.init(site=site, sites_path=_sites_path)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/__init__.py", line 150, in init
    local.conf = _dict(get_site_config())
  File "/home/frappe/frappe-bench/apps/frappe/frappe/__init__.py", line 224, in get_site_config
    sys.exit(1)
SystemExit: 1

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/frappe/frappe-bench/env/lib/python3.7/site-packages/werkzeug/local.py", line 72, in __getattr__
    return self.__storage__[self.__ident_func__()][name]
KeyError: 'conf'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/frappe/frappe-bench/env/lib/python3.7/site-packages/werkzeug/local.py", line 309, in _get_current_object
    return getattr(self.__local, self.__name__)
  File "/home/frappe/frappe-bench/env/lib/python3.7/site-packages/werkzeug/local.py", line 74, in __getattr__
    raise AttributeError(name)
AttributeError: conf

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/frappe/frappe-bench/env/lib/python3.7/site-packages/gunicorn/workers/gthread.py", line 280, in handle
    keepalive = self.handle_request(req, conn)
  File "/home/frappe/frappe-bench/env/lib/python3.7/site-packages/gunicorn/workers/gthread.py", line 329, in handle_request
    respiter = self.wsgi(environ, resp.start_response)
  File "/home/frappe/frappe-bench/env/lib/python3.7/site-packages/werkzeug/local.py", line 231, in application
    return ClosingIterator(app(environ, start_response), self.cleanup)
  File "/home/frappe/frappe-bench/env/lib/python3.7/site-packages/werkzeug/wrappers/base_request.py", line 237, in application
    resp = f(*args[:-2] + (request,))
  File "/home/frappe/frappe-bench/apps/frappe/frappe/app.py", line 96, in application
    frappe.monitor.stop(response)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/monitor.py", line 26, in stop
    if frappe.conf.monitor and hasattr(frappe.local, "monitor"):
  File "/home/frappe/frappe-bench/env/lib/python3.7/site-packages/werkzeug/local.py", line 348, in __getattr__
    return getattr(self._get_current_object(), name)
  File "/home/frappe/frappe-bench/env/lib/python3.7/site-packages/werkzeug/local.py", line 311, in _get_current_object
    raise RuntimeError("no object bound to %s" % self.__name__)
RuntimeError: no object bound to conf

I’ve tried changing frappe_docker/.env SITES to http://erpnext.mycompany.com but this gives me a

503 Service Temporarily Unavailable

nginx/1.17.10

When visiting the website.

What am I doing wrong?

Did you create any site?

Once site is created, try restarting nginx-web, nginx-letsencrypt and nginx-gen containers. One of them gets the certificate

Also the docker-compose yaml(s) are for simple example. Make your own yaml with exact version tags. Don’t use v12. Use v12.7.1 and v12.5.1 for image tags.

Alternative production setup.

1 Like

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