mirror of
https://github.com/YunoHost-Apps/mattermost_ynh.git
synced 2024-09-03 19:36:29 +02:00
Update upgrade
This commit is contained in:
parent
d5e10029b4
commit
069bc0c34d
1 changed files with 23 additions and 37 deletions
|
@ -31,10 +31,6 @@ path_url=$(ynh_app_setting_get --app=$app --key=path)
|
|||
port=$(ynh_app_setting_get --app=$app --key=port)
|
||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||
language=$(ynh_app_setting_get --app=$app --key=language)
|
||||
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||
db_user=$db_name
|
||||
db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd)
|
||||
mysql_db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
|
||||
version=$(ynh_app_setting_get --app=$app --key=version)
|
||||
data_path=$(ynh_app_setting_get --app=$app --key=data_path)
|
||||
team_display_name=$(ynh_app_setting_get --app=$app --key=team_display_name)
|
||||
|
@ -86,10 +82,10 @@ if [ -z "$version" ]; then
|
|||
ynh_app_setting_set --app=$app --key=version --value=$version
|
||||
fi
|
||||
|
||||
if [ -z "$db_name" ]; then
|
||||
db_name="$app"
|
||||
ynh_app_setting_set --app=$app --key=db_name --value=$db_name
|
||||
fi
|
||||
# if [ -z "$db_name" ]; then
|
||||
# db_name="$app"
|
||||
# ynh_app_setting_set --app=$app --key=db_name --value=$db_name
|
||||
# fi
|
||||
|
||||
# if [ -z "$db_pwd" ]; then
|
||||
# db_pwd=$(ynh_string_random --length=24)
|
||||
|
@ -185,9 +181,12 @@ if mysqlshow | grep -q "^| $db_name "; then
|
|||
|
||||
ynh_script_progression --message="Creating a PostgreSQL database..." --weight=10
|
||||
|
||||
db_name=$(ynh_sanitize_dbid --db_name=$app)
|
||||
db_user=$db_name
|
||||
mysql_db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
|
||||
|
||||
postgres_db_pwd=$(ynh_string_random --length=24)
|
||||
ynh_app_setting_set --app=$app --key=postgres_db_pwd --value=$postgres_db_pwd
|
||||
|
||||
ynh_psql_test_if_first_run
|
||||
ynh_psql_create_user $db_user $postgres_db_pwd
|
||||
ynh_psql_execute_as_root --sql="CREATE DATABASE $db_name ENCODING 'UTF8' LC_COLLATE='C' LC_CTYPE='C' TEMPLATE template0 OWNER $db_user"
|
||||
|
@ -196,6 +195,15 @@ if mysqlshow | grep -q "^| $db_name "; then
|
|||
pgloader mysql://$db_user:$mysql_db_pwd@localhost:3306/$db_name postgresql://$db_user:$postgres_db_pwd@localhost:5432/$db_name
|
||||
# Removinging MySQL database
|
||||
ynh_mysql_remove_db --db_user=$db_user --db_name=$db_name
|
||||
|
||||
smtp_user_pwd=$(ynh_string_random --length=24)
|
||||
url=https://$domain$path_url
|
||||
$postgres_db_pwd=$db_pwd
|
||||
ynh_add_config --template="../conf/config.json" --destination="$final_path/config/config.json"
|
||||
|
||||
chmod 400 "$final_path/config/config.json"
|
||||
chown $app:$app "$final_path/config/config.json"
|
||||
|
||||
else
|
||||
ynh_print_info --message="No migration needed"
|
||||
fi
|
||||
|
@ -203,15 +211,15 @@ fi
|
|||
#=================================================
|
||||
# UPDATE A CONFIG FILE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Updating a configuration file..." --weight=3
|
||||
# ynh_script_progression --message="Updating a configuration file..." --weight=3
|
||||
|
||||
smtp_user_pwd=$(ynh_string_random --length=24)
|
||||
url=https://$domain$path_url
|
||||
# smtp_user_pwd=$(ynh_string_random --length=24)
|
||||
# url=https://$domain$path_url
|
||||
|
||||
ynh_add_config --template="../conf/config.json" --destination="$final_path/config/config.json"
|
||||
# ynh_add_config --template="../conf/config.json" --destination="$final_path/config/config.json"
|
||||
|
||||
chmod 400 "$final_path/config/config.json"
|
||||
chown $app:$app "$final_path/config/config.json"
|
||||
# chmod 400 "$final_path/config/config.json"
|
||||
# chown $app:$app "$final_path/config/config.json"
|
||||
|
||||
#=================================================
|
||||
# SETUP SYSTEMD
|
||||
|
@ -244,28 +252,6 @@ ynh_script_progression --message="Starting a systemd service..." --weight=2
|
|||
# Start a systemd service
|
||||
ynh_systemd_action --service_name=$app --action=start --log_path=systemd --line_match="Started Mattermost"
|
||||
|
||||
#=================================================
|
||||
# CREATE ADMIN AND FIRST TEAM
|
||||
#=================================================
|
||||
# ynh_script_progression --message="Create the first administrator and team..." --weight=1
|
||||
|
||||
# team_name=$(echo "$team_display_name" | iconv -f utf8 -t ascii//TRANSLIT//IGNORE | sed -e 's/[^[:alnum:]]/-/g' | tr -s '-' | tr A-Z a-z)
|
||||
# bin_mmctl="$final_path/bin/mmctl"
|
||||
|
||||
# # mmctl is not packaged with ARM versions yet
|
||||
# if [[ -f "$bin_mmctl" ]]; then
|
||||
# export MMCTL_LOCAL=true
|
||||
# export MMCTL_LOCAL_SOCKET_PATH="$local_socket_path"
|
||||
|
||||
# ynh_exec_warn_less sudo --preserve-env -u $app "$bin_mmctl" user create --username "$admin" --email "$email" --password "$password" --locale "$language" --email-verified --system-admin
|
||||
# ynh_exec_warn_less sudo --preserve-env -u $app "$bin_mmctl" team create --name "$team_name" --display_name "$team_display_name" --email "$email"
|
||||
# ynh_exec_warn_less sudo --preserve-env -u $app "$bin_mmctl" team users add "$team_name" "$admin"
|
||||
# fi
|
||||
|
||||
# # Disable mmctl passwordless access
|
||||
# ynh_replace_string '"EnableLocalMode": true' '"EnableLocalMode": false' "$final_path/config/config.json"
|
||||
# ynh_systemd_action --service_name=$app --action=restart --log_path=systemd --line_match="Started Mattermost"
|
||||
|
||||
#=================================================
|
||||
# RELOAD NGINX
|
||||
#=================================================
|
||||
|
|
Loading…
Add table
Reference in a new issue