* creates new function `print_db_config` to print out ERPNext required database settings to console * refactors `check_if_ready_for_barracuda` to make use of `print_db_config` * adds a more explicit explanation before showing the `expected_config_for_barracuda` text * adds MariaDB default configuration to documentationversion-14
@@ -2,7 +2,21 @@ | |||||
Let us create a new site and call it `library`. | Let us create a new site and call it `library`. | ||||
You can install a new site, by the command `bench new-site library` | |||||
*Note: Before you create any new site, you need to activate the Barracuda storage engine on your MariaDB installation.* | |||||
*Copy the following default ERPNext database settings into your `my.cnf` file.* | |||||
[mysqld] | |||||
innodb-file-format=barracuda | |||||
innodb-file-per-table=1 | |||||
innodb-large-prefix=1 | |||||
character-set-client-handshake = FALSE | |||||
character-set-server = utf8mb4 | |||||
collation-server = utf8mb4_unicode_ci | |||||
[mysql] | |||||
default-character-set = utf8mb4 | |||||
You can then install a new site, by the command `bench new-site library`. | |||||
This will create a new database and site folder and install `frappe` (which is also an application!) in the new site. The `frappe` application has two built-in modules **Core** and **Website**. The Core module contains the basic models for the application. Frappe is a batteries included framework and comes with a lot of built-in models. These models are called **DocTypes**. More on that later. | This will create a new database and site folder and install `frappe` (which is also an application!) in the new site. The `frappe` application has two built-in modules **Core** and **Website**. The Core module contains the basic models for the application. Frappe is a batteries included framework and comes with a lot of built-in models. These models are called **DocTypes**. More on that later. | ||||
@@ -2,6 +2,21 @@ | |||||
Créons un site et appelons le `library`. | Créons un site et appelons le `library`. | ||||
*Remarque: Avant de créer un nouveau site, vous devez activer le moteur de stockage Barracuda sur votre installation MariaDB.* | |||||
*Copiez les paramètres de base de données ERPNext par défaut suivants dans votre fichier `my.cnf`.* | |||||
[mysqld] | |||||
innodb-file-format=barracuda | |||||
innodb-file-per-table=1 | |||||
innodb-large-prefix=1 | |||||
character-set-client-handshake = FALSE | |||||
character-set-server = utf8mb4 | |||||
collation-server = utf8mb4_unicode_ci | |||||
[mysql] | |||||
default-character-set = utf8mb4 | |||||
Vous pouvez installer un nouveau site avec la commande `bench new-site library` | Vous pouvez installer un nouveau site avec la commande `bench new-site library` | ||||
Cette commande va créer une nouvelle base de données, un repertoire et installer `frappe` (qui est aussi une application!) | Cette commande va créer une nouvelle base de données, un repertoire et installer `frappe` (qui est aussi une application!) | ||||
@@ -2,6 +2,21 @@ | |||||
Vamos criar um novo site e chamá-lo de `library`. | Vamos criar um novo site e chamá-lo de `library`. | ||||
*Nota: Antes de criar um novo site, é necessário ativar o mecanismo de armazenamento Barracuda na instalação do MariaDB.* | |||||
*Copie as seguintes configurações de banco de dados ERPNext padrão para o arquivo `my.cnf`.* | |||||
[mysqld] | |||||
innodb-file-format=barracuda | |||||
innodb-file-per-table=1 | |||||
innodb-large-prefix=1 | |||||
character-set-client-handshake = FALSE | |||||
character-set-server = utf8mb4 | |||||
collation-server = utf8mb4_unicode_ci | |||||
[mysql] | |||||
default-character-set = utf8mb4 | |||||
Você pode instalar um novo site, pelo comando `bench new-site library` | Você pode instalar um novo site, pelo comando `bench new-site library` | ||||
Isto irá criar uma nova pasta para o site e um banco de dados e instalar o `frappe` (que também é uma aplicação!) No novo site. A aplicação `frappe` tem dois módulos embutidos **Core** e **WebSite**. O módulo de Core contém os modelos básicos para a aplicação. Frappe é uma estrutura como as pilhas e vem com um monte de modelos internos. Estes modelos são chamados doctypes **Mais sobre isso mais tarde**. | Isto irá criar uma nova pasta para o site e um banco de dados e instalar o `frappe` (que também é uma aplicação!) No novo site. A aplicação `frappe` tem dois módulos embutidos **Core** e **WebSite**. O módulo de Core contém os modelos básicos para a aplicação. Frappe é uma estrutura como as pilhas e vem com um monte de modelos internos. Estes modelos são chamados doctypes **Mais sobre isso mais tarde**. | ||||
@@ -356,14 +356,25 @@ def check_if_ready_for_barracuda(): | |||||
}.items(): | }.items(): | ||||
if mariadb_variables.get(key) != value: | if mariadb_variables.get(key) != value: | ||||
print "="*80 | |||||
print "Please add this to MariaDB's my.cnf and restart MariaDB before proceeding" | |||||
print expected_config_for_barracuda | |||||
print "="*80 | |||||
site = frappe.local.site | |||||
msg = ("Creation of your site - {x} failed because MariaDB is not properly {sep}" | |||||
"configured to use the Barracuda storage engine. {sep}" | |||||
"Please add the settings below to MariaDB's my.cnf, restart MariaDB then {sep}" | |||||
"run `bench new-site site17.local` again.{sep2}" | |||||
"").format(x=site, sep2="\n"*2, sep="\n") | |||||
print_db_config(msg, expected_config_for_barracuda) | |||||
sys.exit(1) | sys.exit(1) | ||||
# raise Exception, "MariaDB needs to be configured!" | # raise Exception, "MariaDB needs to be configured!" | ||||
def print_db_config(explanation, config_text): | |||||
print ("="*80) | |||||
print (explanation) | |||||
print (config_text) | |||||
print ("="*80) | |||||
def extract_sql_gzip(sql_gz_path): | def extract_sql_gzip(sql_gz_path): | ||||
try: | try: | ||||
subprocess.check_call(['gzip', '-d', '-v', '-f', sql_gz_path]) | subprocess.check_call(['gzip', '-d', '-v', '-f', sql_gz_path]) | ||||