1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/hedgedoc_ynh.git synced 2024-09-03 19:25:52 +02:00

Cleaning up

This commit is contained in:
ericgaspar 2021-03-10 21:41:28 +01:00
parent 7079fcc54d
commit 7642364191
No known key found for this signature in database
GPG key ID: 574F281483054D44
11 changed files with 52 additions and 62 deletions

View file

@ -29,7 +29,7 @@ When you finished editing the configuration, for your changes to take effect, yo
## Documentation
* Official documentation: https://github.com/hedgedoc/hedgedoc/tree/master/docs
* YunoHost documentation: https://yunohost.org/#/app_hedgedoc
* YunoHost documentation: https://yunohost.org/en/app_hedgedoc
## YunoHost specific features

View file

@ -29,7 +29,7 @@ Lorsque vous avez terminé de modifier la configuration, pour que vos modificati
## Documentation
* Documentation officielle : https://github.com/hedgedoc/hedgedoc/tree/master/docs
* Documentation YunoHost : https://yunohost.org/#/app_hedgedoc_fr
* Documentation YunoHost : https://yunohost.org/fr/app_hedgedoc
## Caractéristiques spécifiques YunoHost

View file

@ -4,5 +4,5 @@ module.exports = {
'config': path.resolve('config.json'),
'migrations-path': path.resolve('lib', 'migrations'),
'models-path': path.resolve('lib', 'models'),
'url': 'postgres://__DB_USER__:__DB_PASS__@localhost:5432/__DB_NAME__'
'url': 'postgres://__DB_USER__:__DB_PWD__@localhost:5432/__DB_NAME__'
}

View file

@ -31,7 +31,7 @@
},
"db": {
"username": "__DB_USER__",
"password": "__DB_PASS__",
"password": "__DB_PWD__",
"database": "__DB_NAME__",
"host": "localhost",
"port": "5432",
@ -49,6 +49,3 @@
}
}
}

View file

@ -13,7 +13,7 @@
"name": "eric_G"
},
"requirements": {
"yunohost": ">= 3.8.1"
"yunohost": ">= 4.1.7"
},
"multi_instance": true,
"services": [

View file

@ -13,6 +13,4 @@
## Package_check results
---
*If you have access to [App Continuous Integration for packagers](https://yunohost.org/#/packaging_apps_ci) you can provide a link to the package_check results like below, replacing '-NUM-' in this link by the PR number and USERNAME by your username on the ci-apps-dev. Or you provide a screenshot or a pastebin of the results*
[![Build Status](https://ci-apps-dev.yunohost.org/jenkins/job/hedgedoc_ynh%20PR-NUM-%20(USERNAME)/badge/icon)](https://ci-apps-dev.yunohost.org/jenkins/job/hedgedoc_ynh%20PR-NUM-%20(USERNAME)/)
* An automatic package_check will be launch at https://ci-apps-dev.yunohost.org/, when you add a specific comment to your Pull Request: "!testme", "!gogogadgetoci" or "By the power of systemd, I invoke The Great App CI to test this Pull Request!"*

View file

@ -31,7 +31,7 @@ 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
db_pwd=$(ynh_app_setting_get --app=$app --key=db_pwd)
db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd)
#=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
@ -73,7 +73,7 @@ fi
#=================================================
ynh_script_progression --message="Stopping a systemd service..." --weight=1
ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app/$app.log"
ynh_systemd_action --service_name=$app --action=stop --log_path="/var/log/$app/$app.log"
#=================================================
# MODIFY URL IN NGINX CONF
@ -122,7 +122,7 @@ ynh_replace_string --match_string="__DOMAIN__" --replace_string="$domain" --t
ynh_replace_string --match_string="__PATH__" --replace_string="${path_url:1}" --target_file="$final_path/config.json"
ynh_replace_string --match_string="__DB_USER__" --replace_string="$db_user" --target_file="$final_path/config.json"
ynh_replace_string --match_string="__DB_NAME__" --replace_string="$db_name" --target_file="$final_path/config.json"
ynh_replace_string --match_string="__DB_PASS__" --replace_string="$db_pwd" --target_file="$final_path/config.json"
ynh_replace_string --match_string="__DB_PWD__" --replace_string="$db_pwd" --target_file="$final_path/config.json"
ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="$final_path/config.json"
ynh_store_file_checksum --file="$final_path/config.json"
@ -135,7 +135,7 @@ ynh_store_file_checksum --file="$final_path/config.json"
ynh_script_progression --message="Starting a systemd service..." --weight=1
# Start a systemd service
ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="HTTP Server listening"
ynh_systemd_action --service_name=$app --action=start --log_path=systemd --line_match="HTTP Server listening"
#=================================================
# RELOAD NGINX

View file

@ -45,9 +45,8 @@ ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url
#=================================================
ynh_script_progression --message="Storing installation settings..." --weight=2
ynh_app_setting_set --app=$app --key=domain --value=$domain
ynh_app_setting_set --app=$app --key=path --value=$path_url
ynh_app_setting_set --app=$app --key=is_public --value=$is_public
ynh_app_setting_set --app=$app --key=domain --value=$domain
ynh_app_setting_set --app=$app --key=path --value=$path_url
#=================================================
# STANDARD MODIFICATIONS
@ -80,11 +79,7 @@ ynh_script_progression --message="Creating a PostgreSQL database..." --weight=2
db_name=$(ynh_sanitize_dbid --db_name=$app)
db_user=$db_name
db_pwd=$(ynh_string_random --length=30)
ynh_app_setting_set --app=$app --key=db_name --value=$db_name
ynh_app_setting_set --app=$app --key=db_pwd --value=$db_pwd
ynh_psql_test_if_first_run
ynh_psql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd
@ -130,8 +125,8 @@ popd || ynh_die
#=================================================
ynh_script_progression --message="Configuring a systemd service..." --weight=1
ynh_replace_string --match_string="__ENV_PATH__" --replace_string="$PATH" --target_file="../conf/systemd.service"
ynh_replace_string --match_string="__YNH_NPM__" --replace_string="$ynh_npm" --target_file="../conf/systemd.service"
ynh_replace_string --match_string="__ENV_PATH__" --replace_string="$PATH" --target_file="../conf/systemd.service"
ynh_replace_string --match_string="__YNH_NPM__" --replace_string="$ynh_npm" --target_file="../conf/systemd.service"
ynh_add_systemd_config
@ -140,26 +135,29 @@ ynh_add_systemd_config
#=================================================
ynh_script_progression --message="Modifying a config file..." --weight=1
cp ../conf/config.json.example "$final_path/config.json"
# cp ../conf/config.json.example "$final_path/config.json"
path_url=${path_url:1}
# Main config File
ynh_replace_string --match_string="__PORT__" --replace_string="$port" --target_file="$final_path/config.json"
ynh_replace_string --match_string="__DOMAIN__" --replace_string="$domain" --target_file="$final_path/config.json"
ynh_replace_string --match_string="__PATH__" --replace_string="${path_url:1}" --target_file="$final_path/config.json"
ynh_replace_string --match_string="__DB_USER__" --replace_string="$db_user" --target_file="$final_path/config.json"
ynh_replace_string --match_string="__DB_NAME__" --replace_string="$db_name" --target_file="$final_path/config.json"
ynh_replace_string --match_string="__DB_PASS__" --replace_string="$db_pwd" --target_file="$final_path/config.json"
ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="$final_path/config.json"
# ynh_replace_string --match_string="__PORT__" --replace_string="$port" --target_file="$final_path/config.json"
# ynh_replace_string --match_string="__DOMAIN__" --replace_string="$domain" --target_file="$final_path/config.json"
# ynh_replace_string --match_string="__PATH__" --replace_string="${path_url:1}" --target_file="$final_path/config.json"
# ynh_replace_string --match_string="__DB_USER__" --replace_string="$db_user" --target_file="$final_path/config.json"
# ynh_replace_string --match_string="__DB_NAME__" --replace_string="$db_name" --target_file="$final_path/config.json"
# ynh_replace_string --match_string="__DB_PWD__" --replace_string="$db_pwd" --target_file="$final_path/config.json"
# ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="$final_path/config.json"
ynh_add_config --template="../conf/config.json.example" --destination="$final_path/config.json"
ynh_store_file_checksum --file="$final_path/config.json"
cp ../conf/.sequelizerc.example "$final_path/.sequelizerc"
# cp ../conf/.sequelizerc.example "$final_path/.sequelizerc"
# DB Config File
ynh_replace_string --match_string="__DB_USER__" --replace_string="$db_user" --target_file="$final_path/.sequelizerc"
ynh_replace_string --match_string="__DB_NAME__" --replace_string="$db_name" --target_file="$final_path/.sequelizerc"
ynh_replace_string --match_string="__DB_PASS__" --replace_string="$db_pwd" --target_file="$final_path/.sequelizerc"
# # DB Config File
# ynh_replace_string --match_string="__DB_USER__" --replace_string="$db_user" --target_file="$final_path/.sequelizerc"
# ynh_replace_string --match_string="__DB_NAME__" --replace_string="$db_name" --target_file="$final_path/.sequelizerc"
# ynh_replace_string --match_string="__DB_PWD__" --replace_string="$db_pwd" --target_file="$final_path/.sequelizerc"
ynh_add_config --template="../conf/.sequelizerc.example" --destination="$final_path/.sequelizerc"
ynh_store_file_checksum --file="$final_path/.sequelizerc"
#=================================================
@ -170,7 +168,7 @@ ynh_store_file_checksum --file="$final_path/.sequelizerc"
ynh_script_progression --message="Securing files and directories..." --weight=1
# Set permissions to app files
chown -R $app:$app $final_path
chown -R $app: $final_path
#=================================================
# INTEGRATE SERVICE IN YUNOHOST
@ -185,19 +183,17 @@ yunohost service add $app --description="Collaborative Markdown editor" --log="/
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="HTTP Server listening"
ynh_systemd_action --service_name=$app --action=start --log_path=systemd --line_match="HTTP Server listening"
#=================================================
# SETUP SSOWAT
#=================================================
ynh_script_progression --message="Configuring SSOwat..." --weight=1
ynh_script_progression --message="Configuring permissions..." --weight=1
# Make app public if necessary or protect it
if [ $is_public -eq 1 ]
then
# Everyone can access the app.
# The "main" permission is automatically created before the install script.
ynh_permission_update --permission "main" --add "visitors"
ynh_permission_update --permission="main" --add="visitors"
fi
#=================================================

View file

@ -17,10 +17,9 @@ ynh_script_progression --message="Loading installation settings..." --weight=1
app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get --app=$app --key=domain)
port=$(ynh_app_setting_get --app=$app --key=port)
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
db_user=$db_name
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
#=================================================
# STANDARD REMOVE

View file

@ -31,7 +31,7 @@ path_url=$(ynh_app_setting_get --app=$app --key=path)
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
db_user=$db_name
db_pwd=$(ynh_app_setting_get --app=$app --key=db_pwd)
db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd)
#=================================================
# CHECK IF THE APP CAN BE RESTORED
@ -73,7 +73,7 @@ ynh_system_user_create --username=$app
ynh_script_progression --message="Restoring user rights..." --weight=2
# Restore permissions on app files
chown -R $app:$app $final_path
chown -R $app: $final_path
#=================================================
# SPECIFIC RESTORATION
@ -120,7 +120,7 @@ yunohost service add $app --description="Collaborative Markdown editor" --log="/
#=================================================
ynh_script_progression --message="Starting a systemd service..." --weight=1
ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="HTTP Server listening"
ynh_systemd_action --service_name=$app --action=start --log_path=systemd --line_match="HTTP Server listening"
#=================================================
# GENERIC FINALIZATION

View file

@ -18,13 +18,11 @@ app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get --app=$app --key=domain)
path_url=$(ynh_app_setting_get --app=$app --key=path)
is_public=$(ynh_app_setting_get --app=$app --key=is_public)
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
db_pwd=$(ynh_app_setting_get --app=$app --key=db_pwd)
db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd)
#=================================================
# CHECK VERSION
@ -136,17 +134,19 @@ ynh_script_progression --message="Modifying a config file..." --weight=2
ynh_backup_if_checksum_is_different --file="$final_path/config.json"
cp ../conf/config.json.example "$final_path/config.json"
path_url=${path_url:1}
# cp ../conf/config.json.example "$final_path/config.json"
# Main config File
ynh_replace_string --match_string="__PORT__" --replace_string="$port" --target_file="$final_path/config.json"
ynh_replace_string --match_string="__DOMAIN__" --replace_string="$domain" --target_file="$final_path/config.json"
ynh_replace_string --match_string="__PATH__" --replace_string="${path_url:1}" --target_file="$final_path/config.json"
ynh_replace_string --match_string="__DB_USER__" --replace_string="$db_user" --target_file="$final_path/config.json"
ynh_replace_string --match_string="__DB_NAME__" --replace_string="$db_name" --target_file="$final_path/config.json"
ynh_replace_string --match_string="__DB_PASS__" --replace_string="$db_pwd" --target_file="$final_path/config.json"
ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="$final_path/config.json"
# # Main config File
# ynh_replace_string --match_string="__PORT__" --replace_string="$port" --target_file="$final_path/config.json"
# ynh_replace_string --match_string="__DOMAIN__" --replace_string="$domain" --target_file="$final_path/config.json"
# ynh_replace_string --match_string="__PATH__" --replace_string="${path_url:1}" --target_file="$final_path/config.json"
# ynh_replace_string --match_string="__DB_USER__" --replace_string="$db_user" --target_file="$final_path/config.json"
# ynh_replace_string --match_string="__DB_NAME__" --replace_string="$db_name" --target_file="$final_path/config.json"
# ynh_replace_string --match_string="__DB_PWD__" --replace_string="$db_pwd" --target_file="$final_path/config.json"
# ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="$final_path/config.json"
ynh_add_config --template="../conf/config.json.example" --destination="$final_path/config.json"
# Recalculate and store the checksum of the file for the next upgrade.
ynh_store_file_checksum --file="$final_path/config.json"
@ -169,7 +169,7 @@ ynh_add_systemd_config
ynh_script_progression --message="Securing files and directories..." --weight=1
# Set permissions on app files
chown -R $app:$app $final_path
chown -R $app: $final_path
#=================================================
# INTEGRATE SERVICE IN YUNOHOST
@ -183,7 +183,7 @@ yunohost service add $app --description="Collaborative Markdown editor" --log="/
#=================================================
ynh_script_progression --message="Starting a systemd service..." --weight=1
ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="HTTP Server listening"
ynh_systemd_action --service_name=$app --action=start --log_path=systemd --line_match="HTTP Server listening"
#=================================================
# RELOAD NGINX