mirror of
https://github.com/YunoHost-Apps/mattermost_ynh.git
synced 2024-09-03 19:36:29 +02:00
ec8fa5570a
* backup script for PostgreSQL (#376)
Inspired from https://github.com/YunoHost-Apps/moodle_ynh/blob/master/scripts/backup
* Adapt to PostgreSQL (#375)
Question: in https://docs.mattermost.com/install/install-debian.html#install-postgresql-database-server, I see `BindsTo=postgresql.service` while in the original file here I find `Requires=mysql.service`. I don't know which one makes sense, so I keep the orinigal Yunohost version (Requires)
* config.json for PostgreSQL (#374)
Inspired from the original MySQL config.json and from Mattermost documentation https://docs.mattermost.com/install/install-debian.html#install-postgresql-database-server
* Install with PostgreSQL (#373)
I took inspiration from https://github.com/YunoHost-Apps/commento_ynh/blob/master/scripts/install
* install postgresql
* Reordering
* reset config file
* Update _common.sh
* Update config.json
* Fix
* Migration (#382)
* add migration
* Update upgrade
* Update upgrade
* Update upgrade
* Update upgrade
* Update upgrade
* Update upgrade
* Update upgrade
* Update upgrade
* Update upgrade
* Update upgrade
* Update upgrade
* Update upgrade
* Update upgrade
* Fix
* Fix
* Fix
* Update install
* Update upgrade
* Fix
* Update install
* Update upgrade
* Update upgrade
* Update upgrade
* Update upgrade
* Update upgrade
* Update upgrade
* Update upgrade
* Update upgrade
* Update upgrade
* Update upgrade
* Update upgrade
* Update upgrade
* Update upgrade
* Update upgrade
* Update upgrade
* Update install
* Fix
* Fix
* Fix
* Update upgrade
* Cleaning up
* Update upgrade
* Update _common.sh
* Update check_process
* Update _common.sh
* Fix
* Update mysql-to-pg.conf
* Update upgrade
* Update systemd.service
* Cleaning
* Update _common.sh
* Fix
* Update upgrade
* Update _common.sh
* Update upgrade
* Update backup
* Fix
* Fix
* Update upgrade
* Update upgrade
* Update systemd.service
* Update _common.sh
* Revert "Update _common.sh"
This reverts commit d880150af9
.
* Cleaning
* Fix
* Update check_process
* Fix
* Update _common.sh
* Fix
* Update _common.sh
* Fix
* Update manifest.json
* Update install
* Update _common.sh
* Update upgrade
* Fix
* Update _common.sh
* Update _common.sh
* Update _common.sh
* Update _common.sh
* Update _common.sh
* Update _common.sh
* Update _common.sh
* Update _common.sh
* Auto-update README
* Update _common.sh
* Upgrade to v7.4.0
* Auto-update README
* Upgrade to v7.5.2
* Auto-update README
* Update config.json
* [fix] mariadb to postgres migration
* Auto-update README
* [fix] Update manifest requirements
* Update manifest.json
* Update config.json
* upgrade config to upstream
* Fix linter
* Update _common.sh
* Fix typo
* Auto-update README
* Update upgrade
* Update scripts/upgrade
Co-authored-by: Pierre de La Morinerie <kemenaran@gmail.com>
* [enh] Indentation
* Apply suggestions from code review
Co-authored-by: Pierre de La Morinerie <kemenaran@gmail.com>
* [enh] COmments
* Increase timeout for table creation
Co-authored-by: Pierre de La Morinerie <kemenaran@gmail.com>
* test upgrade from 7.2.0
* Auto-update README
* fix db_name in case of multi_instance
* Fix 7.3.0 migration
* delete only the problematic value in db_migrations
* Added explanation for migration management from 7.3.0
* mariadb-to-pg: drop stray columns
These should have been removed in a previous migration, but weren't.
See https://github.com/mattermost/mattermost-server/issues/18351#issuecomment-1325648058
* mariadb-to-pg: increase mattermost timeout
On a small VPS the 2 mn timeout is almost reached.
Increase it to 3 mn.
---------
Co-authored-by: biva <biva@users.noreply.github.com>
Co-authored-by: yunohost-bot <yunohost@yunohost.org>
Co-authored-by: yunohost-bot <yunohost-bot@users.noreply.github.com>
Co-authored-by: ljf <ljf+git@grimaud.me>
Co-authored-by: ljf (zamentur) <zamentur@users.noreply.github.com>
Co-authored-by: Pierre de La Morinerie <kemenaran@gmail.com>
Co-authored-by: Kay0u <pierre@kayou.io>
154 lines
5.3 KiB
Bash
154 lines
5.3 KiB
Bash
#!/bin/bash
|
|
|
|
#=================================================
|
|
# GENERIC START
|
|
#=================================================
|
|
# IMPORT GENERIC HELPERS
|
|
#=================================================
|
|
|
|
source ../settings/scripts/_common.sh
|
|
source /usr/share/yunohost/helpers
|
|
|
|
#=================================================
|
|
# MANAGE SCRIPT FAILURE
|
|
#=================================================
|
|
|
|
ynh_clean_setup () {
|
|
ynh_clean_check_starting
|
|
}
|
|
# Exit if an error occurs during the execution of the script
|
|
ynh_abort_if_errors
|
|
|
|
#=================================================
|
|
# LOAD SETTINGS
|
|
#=================================================
|
|
ynh_script_progression --message="Loading installation settings..." --weight=1
|
|
|
|
app=$YNH_APP_INSTANCE_NAME
|
|
|
|
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
|
path_url=$(ynh_app_setting_get --app=$app --key=path)
|
|
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
|
port=$(ynh_app_setting_get --app=$app --key=port)
|
|
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
|
db_user=$db_name
|
|
data_path=$(ynh_app_setting_get --app=$app --key=data_path)
|
|
|
|
#=================================================
|
|
# CHECK IF THE APP CAN BE RESTORED
|
|
#=================================================
|
|
ynh_script_progression --message="Validating restoration parameters..." --weight=1
|
|
|
|
test ! -d $final_path \
|
|
|| ynh_die --message="There is already a directory: $final_path "
|
|
|
|
#=================================================
|
|
# STANDARD RESTORATION STEPS
|
|
#=================================================
|
|
# RESTORE THE NGINX CONFIGURATION
|
|
#=================================================
|
|
ynh_script_progression --message="Restoring the NGINX web server configuration..." --weight=1
|
|
|
|
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
|
|
|
#=================================================
|
|
# RECREATE THE DEDICATED USER
|
|
#=================================================
|
|
ynh_script_progression --message="Recreating the dedicated system user..." --weight=1
|
|
|
|
# Create the dedicated user (if not existing)
|
|
ynh_system_user_create --username=$app --home_dir="$final_path"
|
|
|
|
#=================================================
|
|
# RESTORE THE APP MAIN DIR
|
|
#=================================================
|
|
ynh_script_progression --message="Restoring the app main directory..." --weight=2
|
|
|
|
ynh_restore_file --origin_path="$final_path"
|
|
|
|
chmod 750 "$final_path"
|
|
chmod -R o-rwx "$final_path"
|
|
chown -R $app:www-data "$final_path"
|
|
|
|
#=================================================
|
|
# RESTORE THE DATA DIRECTORY
|
|
#=================================================
|
|
ynh_script_progression --message="Restoring the data directory..." --weight=4
|
|
|
|
ynh_restore_file --origin_path="$data_path" --not_mandatory
|
|
|
|
mkdir -p $data_path
|
|
|
|
chmod 750 "$data_path"
|
|
chmod -R o-rwx "$data_path"
|
|
chown -R $app:www-data "$data_path"
|
|
|
|
#=================================================
|
|
# REINSTALL DEPENDENCIES
|
|
#=================================================
|
|
ynh_script_progression --message="Reinstalling dependencies..." --weight=10
|
|
|
|
# Define and install dependencies
|
|
ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies
|
|
|
|
#=================================================
|
|
# RESTORE THE DATABASE
|
|
#=================================================
|
|
ynh_script_progression --message="Restoring the database..." --weight=6
|
|
|
|
db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd)
|
|
ynh_psql_test_if_first_run
|
|
ynh_psql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd
|
|
ynh_psql_execute_file_as_root --file="./db.sql" --database=$db_name
|
|
|
|
#=================================================
|
|
# RESTORE USER RIGHTS
|
|
#=================================================
|
|
|
|
logs_path="/var/log/$app"
|
|
mkdir -p $logs_path
|
|
chown -R $app: $logs_path
|
|
|
|
#=================================================
|
|
# SPECIFIC RESTORATION
|
|
#=================================================
|
|
# RESTORE SYSTEMD
|
|
#=================================================
|
|
|
|
ynh_restore_file "/etc/systemd/system/$app.service"
|
|
systemctl enable $app.service --quiet
|
|
|
|
#=================================================
|
|
# ADVERTISE SERVICE IN ADMIN PANEL
|
|
#=================================================
|
|
|
|
yunohost service add $app --description="Collaboration platform built for developers" --log="/var/log/$app/$app.log"
|
|
|
|
#=================================================
|
|
# START SYSTEMD SERVICE
|
|
#=================================================
|
|
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"
|
|
|
|
#=================================================
|
|
# RESTORE THE LOGROTATE CONFIGURATION
|
|
#=================================================
|
|
|
|
ynh_restore_file --origin_path="/etc/logrotate.d/$app"
|
|
|
|
#=================================================
|
|
# GENERIC FINALIZATION
|
|
#=================================================
|
|
# RELOAD NGINX
|
|
#=================================================
|
|
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
|
|
|
|
ynh_systemd_action --service_name=nginx --action=reload
|
|
|
|
#=================================================
|
|
# END OF SCRIPT
|
|
#=================================================
|
|
|
|
ynh_script_progression --message="Restoration completed for $app" --last
|