Setting up frappe & erpnext v16.0.0-dev environment

I’m trying to setup a frappe & erpnext v16.0.0-dev environment on Mac Silicon using docker compose for MariaDB and redis components.

I keep getting an error setting up the development site;

(venv) ➜  bench bench new-site --db-type mariadb --db-port 3306 --db-host 127.0.0.1 --db-name erpnext001 --admin-password MyAdminPassword --db-root-username root --mariadb-user-host-login-scope='%' --db-root-password MyRootPassword --install-app erpnext --verbose app1.n002213f.local --force --verbose
Created or updated user erpnext001
Created database erpnext001
Granted privileges to user erpnext001 and database erpnext001
Starting database import...
b'ERROR 2026 (HY000): TLS/SSL error: No such file or directory (2)\n'
Traceback (most recent call last):

I noted that v16.0.0-dev now has a requirement for mysqlclient==2.2.7 which by default requires that I setup TLS support on the MariaDB server and the client.

I have setup TLS support for Mariadb server on docker compose and verified it works using a python script using mysqlclient and a client certificate and I can list the database. This rules out my setup of TLS for Mariadb.

import MySQLdb

config = {
        'user': 'root',
        'password': 'MyRootPassword',
        'host': '127.0.0.1',
        'database': 'mysql',
        'charset': 'utf8mb4',
        'port': 3306,
        'ssl': {
            'check_hostname': False,
            'ca': '/path/to/ca.crt',
            'cert': '/path/to/client.crt',
            'key': '/path/to/client.key',
        }
    }

db = MySQLdb.connect(**config)
db.autocommit(True)

cursor = db.cursor()
cursor.execute("SHOW DATABASES")
databases = cursor.fetchall()

for database in databases:
    print(database[0])

To bootstrap the site i run the commands below.

bench init bench --python python3 --frappe-branch develop --skip-redis-config-generation
cd bench
bench set-redis-queue-host 127.0.0.1:11000
bench set-redis-socketio-host 127.0.0.1:12000
bench set-redis-cache-host 127.0.0.1:13000
bench get-app erpnext https://github.com/frappe/erpnext --branch develop
bench new-site --db-type mariadb --db-port 3306 --db-host 127.0.0.1 --db-name erpnext001 --admin-password MyAdminPassword --db-root-username root --mariadb-user-host-login-scope='%' --db-root-password MyRootPassword --install-app erpnext --verbose app1.n002213f.local --force --verbose

I adapt the global common_site_config.json to add the TLS configs

  "db_ssl_ca": "/path/to/ca.crt",
  "db_ssl_cert": "/path/to/client.crt",
  "db_ssl_key": "/path/to/client.key"

When I check the database, I can see the user & database had been created. Its the seed database import that fails.

To debug the connection used to setup the seed database, add a print statement in the frappe/frappe/database/db_manager.py

set -o pipefail; cat /Users/user001/bench/apps/frappe/frappe/database/mariadb/framework_mariadb.sql | sed '/\/\*M\{0,1\}!999999\\- enable the sandbox mode \*\//d' | sed '/\/\*![0-9]* DEFINER=[^ ]* SQL SECURITY DEFINER \*\//d' | /opt/homebrew/bin/mariadb --user=erpnext001 --host=127.0.0.1 --port=3306 --password=B37L4x8yUGSGTjPo '--pager=less -SFX' --safe-updates --no-auto-rehash erpnext001

Clearly the first command uses the TLS configuration, connects and created the database and user. The next command to load the database fails because the command does not have the TLS parameters.

How would I get past this issue to install the latest develop branch?

I managed to resolve the issue. Creation of the database was one step closer.

From the printed command, the load is run using a native mariadb client NOT the driver, this is resolved by supplying client defaults for the client.

I create a file ~/.my.cnf in the frappe user directory

In the file add the following;

[client]
ssl-ca=/path/to/ca.crt
ssl-cert=/path/to/client.crt
ssl-key=/path/to/client.key

Credit to this StackOverflow answer. while it disabling SSL it points to more capability.

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