mirror of
https://github.com/YunoHost-Apps/weblate_ynh.git
synced 2024-10-01 13:35:04 +02:00
Edit global mysql configuration
This commit is contained in:
parent
8f10130e92
commit
da39602afe
6 changed files with 15 additions and 11 deletions
|
@ -6,7 +6,7 @@ The YunoHost team uses [Weblate](https://weblate.org) for its community: http://
|
||||||
|
|
||||||
Weblate [recommands PostgreSQL](https://docs.weblate.org/en/latest/admin/install.html#database-setup-for-weblate), but YunoHost uses Mysql.
|
Weblate [recommands PostgreSQL](https://docs.weblate.org/en/latest/admin/install.html#database-setup-for-weblate), but YunoHost uses Mysql.
|
||||||
|
|
||||||
You should make sure to change this settings in your mysql config file:
|
Carefull, this script modify your mysql config file:
|
||||||
|
|
||||||
* set global innodb_file_format = BARRACUDA;
|
* set global innodb_file_format = BARRACUDA;
|
||||||
* set global innodb_large_prefix = ON;
|
* set global innodb_large_prefix = ON;
|
||||||
|
|
|
@ -52,7 +52,7 @@ DATABASES = {
|
||||||
# Additional database options
|
# Additional database options
|
||||||
'OPTIONS': {
|
'OPTIONS': {
|
||||||
# In case of older MySQL server which has default MariaDB
|
# In case of older MySQL server which has default MariaDB
|
||||||
'init_command': "SET storage_engine=INNODB; SET sql_mode='STRICT_TRANS_TABLES'",
|
# 'init_command': "SET storage_engine=INNODB; ",
|
||||||
# If your server supports it, see Unicode issues above
|
# If your server supports it, see Unicode issues above
|
||||||
'charset': 'utf8mb4',
|
'charset': 'utf8mb4',
|
||||||
}
|
}
|
||||||
|
@ -62,7 +62,7 @@ DATABASES = {
|
||||||
BASE_DIR = '__FINALPATH__'
|
BASE_DIR = '__FINALPATH__'
|
||||||
|
|
||||||
# Data directory
|
# Data directory
|
||||||
DATA_DIR = os.path.join(BASE_DIR, '..', 'data')
|
DATA_DIR = os.path.join(BASE_DIR, 'data')
|
||||||
|
|
||||||
# Local time zone for this installation. Choices can be found here:
|
# Local time zone for this installation. Choices can be found here:
|
||||||
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
|
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
|
||||||
|
|
4
conf/weblate.cnf
Normal file
4
conf/weblate.cnf
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
[mysqld]
|
||||||
|
innodb_large_prefix=on
|
||||||
|
innodb_file_format=barracuda
|
||||||
|
innodb_file_per_table=on
|
|
@ -53,6 +53,8 @@ ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf" "${backup_dir}/etc/nginx/conf
|
||||||
ynh_mysql_dump_db "$db_name" > db.sql
|
ynh_mysql_dump_db "$db_name" > db.sql
|
||||||
ynh_backup "db.sql" "${backup_dir}/db.sql"
|
ynh_backup "db.sql" "${backup_dir}/db.sql"
|
||||||
|
|
||||||
|
ynh_backup "/etc/mysql/conf.d/$app.cnf" "${backup_dir}/etc/mysql/conf.d/$app.cnf"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SPECIFIC BACKUP
|
# SPECIFIC BACKUP
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -88,8 +88,9 @@ ynh_mysql_setup_db $db_name $db_name
|
||||||
# https://docs.weblate.org/en/latest/admin/install.html#unicode-issues-in-mysql
|
# https://docs.weblate.org/en/latest/admin/install.html#unicode-issues-in-mysql
|
||||||
# http://mechanics.flite.com/blog/2014/07/29/using-innodb-large-prefix-to-avoid-error-1071/
|
# http://mechanics.flite.com/blog/2014/07/29/using-innodb-large-prefix-to-avoid-error-1071/
|
||||||
ynh_mysql_execute_as_root "ALTER DATABASE $db_name CHARACTER SET utf8mb4;"
|
ynh_mysql_execute_as_root "ALTER DATABASE $db_name CHARACTER SET utf8mb4;"
|
||||||
ynh_mysql_execute_as_root "set global innodb_file_format = BARRACUDA;"
|
|
||||||
ynh_mysql_execute_as_root "set global innodb_large_prefix = ON;"
|
cp ../conf/weblate.cnf /etc/mysql/conf.d/$app.cnf
|
||||||
|
systemctl restart mysql
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# NGINX CONFIGURATION
|
# NGINX CONFIGURATION
|
||||||
|
@ -149,7 +150,6 @@ virtualenv ${final_path}/venv
|
||||||
# https://docs.weblate.org/en/latest/admin/install.html#installation
|
# https://docs.weblate.org/en/latest/admin/install.html#installation
|
||||||
# TODO: use --extra-search-dir=/path/to/dists
|
# TODO: use --extra-search-dir=/path/to/dists
|
||||||
#=================================================
|
#=================================================
|
||||||
echo "SPECIFIC SETUP settings.py"
|
|
||||||
db_pwd=$(ynh_app_setting_get $app mysqlpwd)
|
db_pwd=$(ynh_app_setting_get $app mysqlpwd)
|
||||||
admin_mail="$(ynh_user_get_info $admin mail)"
|
admin_mail="$(ynh_user_get_info $admin mail)"
|
||||||
key=$(ynh_string_random)
|
key=$(ynh_string_random)
|
||||||
|
@ -170,8 +170,6 @@ ynh_replace_string "__FINALPATH__" "$final_path" $final_path/venv/lib/python2.7/
|
||||||
# SPECIFIC SETUP Filling up the database
|
# SPECIFIC SETUP Filling up the database
|
||||||
# https://docs.weblate.org/en/latest/admin/install.html#filling-up-the-database
|
# https://docs.weblate.org/en/latest/admin/install.html#filling-up-the-database
|
||||||
#==========================================
|
#==========================================
|
||||||
echo "SPECIFIC SETUP Filling up the database"
|
|
||||||
# set up database
|
|
||||||
(
|
(
|
||||||
set +eu
|
set +eu
|
||||||
source ${final_path}/venv/bin/activate
|
source ${final_path}/venv/bin/activate
|
||||||
|
@ -185,7 +183,6 @@ echo "SPECIFIC SETUP Filling up the database"
|
||||||
#=================================================
|
#=================================================
|
||||||
# SETUP CRON
|
# SETUP CRON
|
||||||
#=================================================
|
#=================================================
|
||||||
echo "SETUP CRON"
|
|
||||||
cp ../conf/cron_weblate /etc/cron.d/$app
|
cp ../conf/cron_weblate /etc/cron.d/$app
|
||||||
ynh_replace_string "__FINALPATH__" "$final_path/" /etc/cron.d/$app
|
ynh_replace_string "__FINALPATH__" "$final_path/" /etc/cron.d/$app
|
||||||
|
|
||||||
|
|
|
@ -59,11 +59,12 @@ ynh_restore_file "$final_path"
|
||||||
# RESTORE THE MYSQL DATABASE
|
# RESTORE THE MYSQL DATABASE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
|
ynh_restore_file "/etc/mysql/conf.d/$app.cnf"
|
||||||
|
systemctl restart mysql
|
||||||
|
|
||||||
db_pwd=$(ynh_app_setting_get $app mysqlpwd)
|
db_pwd=$(ynh_app_setting_get $app mysqlpwd)
|
||||||
ynh_mysql_setup_db $db_name $db_name $db_pwd
|
ynh_mysql_setup_db $db_name $db_name $db_pwd
|
||||||
ynh_mysql_connect_as $db_name $db_pwd $db_name < ./db.sql
|
ynh_mysql_connect_as $db_name $db_pwd $db_name < ./db.sql
|
||||||
ynh_mysql_execute_as_root "set global innodb_file_format = BARRACUDA;"
|
|
||||||
ynh_mysql_execute_as_root "set global innodb_large_prefix = ON;"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RECREATE THE DEDICATED USER
|
# RECREATE THE DEDICATED USER
|
||||||
|
|
Loading…
Reference in a new issue