switch from MySQL to PostgreSQL
MySQL version not compatible. version provided: 10.1.37 / version requested: 10.2.7
This commit is contained in:
parent
f842945c5f
commit
8a1f103115
@ -30,8 +30,8 @@ bindIP: 0.0.0.0
|
||||
db:
|
||||
type: mysql
|
||||
# PostgreSQL / MySQL / MariaDB / MS SQL Server only:
|
||||
host: localhost
|
||||
port: 3306
|
||||
host: postgres
|
||||
port: 5432
|
||||
user: __DB_NAME__
|
||||
pass: __DB_PWD__
|
||||
db: __DB_NAME__
|
||||
|
@ -19,8 +19,7 @@
|
||||
},
|
||||
"multi_instance": true,
|
||||
"services": [
|
||||
"nginx",
|
||||
"mysql"
|
||||
"nginx"
|
||||
],
|
||||
"arguments": {
|
||||
"install" : [
|
||||
|
@ -51,10 +51,10 @@ ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||
#ynh_backup "/etc/php5/fpm/pool.d/$app.conf"
|
||||
|
||||
#=================================================
|
||||
# BACKUP THE MYSQL DATABASE
|
||||
# BACKUP THE POSTGRESQL DATABASE
|
||||
#=================================================
|
||||
|
||||
ynh_mysql_dump_db "$db_name" > db.sql
|
||||
ynh_psql_dump_db "$db_name" > db.sql
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC BACKUP
|
||||
|
@ -100,7 +100,7 @@ ynh_install_app_dependencies redis-server
|
||||
ynh_install_nodejs 10
|
||||
|
||||
#=================================================
|
||||
# CREATE A MYSQL DATABASE
|
||||
# CREATE A POSTGRESQL DATABASE
|
||||
#=================================================
|
||||
|
||||
### Use these lines if you need a database for the application.
|
||||
@ -108,13 +108,17 @@ ynh_install_nodejs 10
|
||||
### The password will be stored as 'mysqlpwd' into the app settings,
|
||||
### and will be available as $db_pwd
|
||||
### If you're not using these lines:
|
||||
### - Remove the section "BACKUP THE MYSQL DATABASE" in the backup script
|
||||
### - Remove also the section "REMOVE THE MYSQL DATABASE" in the remove script
|
||||
### - As well as the section "RESTORE THE MYSQL DATABASE" in the restore script
|
||||
### - Remove the section "BACKUP THE POSTGRESQL DATABASE" in the backup script
|
||||
### - Remove also the section "REMOVE THE POSTGRESQL DATABASE" in the remove script
|
||||
### - As well as the section "RESTORE THE POSTGRESQL DATABASE" in the restore script
|
||||
|
||||
db_name=$(ynh_sanitize_dbid $app)
|
||||
ynh_app_setting_set $app db_name $db_name
|
||||
ynh_mysql_setup_db $db_name $db_name
|
||||
db_pwd=$(ynh_string_random 30)
|
||||
ynh_app_setting_set "$app" psql_db "$db_name"
|
||||
ynh_app_setting_set "$app" psqlpwd "$db_pwd"
|
||||
ynh_psql_test_if_first_run
|
||||
ynh_psql_create_user "$db_name" "$db_pwd"
|
||||
ynh_psql_create_db "$db_name" "$db_name" "$db_pwd"
|
||||
|
||||
#=================================================
|
||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||
|
@ -51,11 +51,11 @@ ynh_use_nodejs
|
||||
ynh_remove_nodejs
|
||||
|
||||
#=================================================
|
||||
# REMOVE THE MYSQL DATABASE
|
||||
# REMOVE THE POSTGRESQL DATABASE
|
||||
#=================================================
|
||||
|
||||
# Remove a database if it exists, along with the associated user
|
||||
ynh_mysql_remove_db $db_user $db_name
|
||||
ynh_psql_remove_db "$db_name" "$db_name"
|
||||
|
||||
#=================================================
|
||||
# REMOVE APP MAIN DIR
|
||||
|
@ -55,12 +55,14 @@ ynh_restore_file "/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||
ynh_restore_file "$final_path"
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE MYSQL DATABASE
|
||||
# RESTORE THE POSTGRESQL DATABASE
|
||||
#=================================================
|
||||
|
||||
db_pwd=$(ynh_app_setting_get $app mysqlpwd)
|
||||
ynh_mysql_setup_db $db_name $db_name $db_pwd
|
||||
ynh_mysql_connect_as $db_name $db_pwd $db_name < ./db.sql
|
||||
ynh_install_app_dependencies postgresql postgresql-contrib
|
||||
ynh_psql_test_if_first_run
|
||||
ynh_psql_create_user "$db_name" "$db_pwd"
|
||||
ynh_psql_create_db "$db_name" "$db_name" "$db_pwd"
|
||||
ynh_psql_execute_file_as_root ./db.sql "$db_name"
|
||||
|
||||
#=================================================
|
||||
# RECREATE THE DEDICATED USER
|
||||
|
Loading…
x
Reference in New Issue
Block a user