1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/codimd_ynh.git synced 2024-09-03 18:16:32 +02:00
This commit is contained in:
ericgaspar 2021-05-08 12:13:28 +02:00
parent 98b38573b0
commit bb593ea42f
No known key found for this signature in database
GPG key ID: 574F281483054D44
5 changed files with 22 additions and 20 deletions

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) port=$(ynh_app_setting_get --app=$app --key=port)
db_name=$(ynh_app_setting_get --app=$app --key=db_name) db_name=$(ynh_app_setting_get --app=$app --key=db_name)
db_user=$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 # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
@ -113,7 +113,7 @@ fi
ynh_backup_if_checksum_is_different --file="$final_path/config.json" ynh_backup_if_checksum_is_different --file="$final_path/config.json"
domain=$new_domain domain=$new_domain
path_url=$new_path path_url=${path_url:1}
cp ../conf/config.json.example "$final_path/config.json" cp ../conf/config.json.example "$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 ynh_script_progression --message="Starting a systemd service..." --weight=1
# Start a systemd service # 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 # RELOAD NGINX

View file

@ -117,7 +117,7 @@ ynh_script_progression --message="Building CodiMD... (this will take some time a
pushd "$final_path" || ynh_die pushd "$final_path" || ynh_die
ynh_use_nodejs ynh_use_nodejs
bin/setup ynh_exec_warn_less bin/setup
ynh_exec_warn_less yarn run build ynh_exec_warn_less yarn run build
popd || ynh_die popd || ynh_die
@ -126,8 +126,8 @@ popd || ynh_die
#================================================= #=================================================
ynh_script_progression --message="Configuring a systemd service..." --weight=1 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="__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="__YNH_NPM__" --replace_string="$ynh_npm" --target_file="../conf/systemd.service"
ynh_add_systemd_config ynh_add_systemd_config
@ -152,6 +152,7 @@ ynh_script_progression --message="Securing files and directories..."
chown -R $app:$app $final_path chown -R $app:$app $final_path
chmod o-rwx $final_path chmod o-rwx $final_path
chmod 600 $final_path/config.json chmod 600 $final_path/config.json
chmod 600 $final_path/.sequelizerc
#================================================= #=================================================
# INTEGRATE SERVICE IN YUNOHOST # INTEGRATE SERVICE IN YUNOHOST
@ -166,12 +167,12 @@ yunohost service add $app --description="Collaborative Markdown notes" --log="/v
ynh_script_progression --message="Starting a systemd service..." --weight=2 ynh_script_progression --message="Starting a systemd service..." --weight=2
# Start a systemd service # 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 # 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 # Make app public if necessary or protect it
if [ $is_public -eq 1 ] if [ $is_public -eq 1 ]

View file

@ -17,10 +17,9 @@ ynh_script_progression --message="Loading installation settings..." --weight=1
app=$YNH_APP_INSTANCE_NAME app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get --app=$app --key=domain) 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_name=$(ynh_app_setting_get --app=$app --key=db_name)
db_user=$db_name db_user=$db_name
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
#================================================= #=================================================
# STANDARD REMOVE # 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) final_path=$(ynh_app_setting_get --app=$app --key=final_path)
db_name=$(ynh_app_setting_get --app=$app --key=db_name) db_name=$(ynh_app_setting_get --app=$app --key=db_name)
db_user=$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 # CHECK IF THE APP CAN BE RESTORED
@ -74,6 +74,7 @@ ynh_script_progression --message="Restoring user rights..."
# Restore permissions on app files # Restore permissions on app files
chown -R $app:$app $final_path chown -R $app:$app $final_path
chmod o-rwx $final_path
#================================================= #=================================================
# SPECIFIC RESTORATION # SPECIFIC RESTORATION
@ -83,7 +84,7 @@ chown -R $app:$app $final_path
ynh_script_progression --message="Reinstalling dependencies..." --weight=7 ynh_script_progression --message="Reinstalling dependencies..." --weight=7
# Define and install dependencies # Define and install dependencies
ynh_install_app_dependencies $pkg_dependencies ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies
# Install Nodejs # Install Nodejs
ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version
@ -120,7 +121,7 @@ yunohost service add $app --description="Collaborative Markdown notes" --log="/v
#================================================= #=================================================
ynh_script_progression --message="Starting a systemd service..." --weight=1 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 # GENERIC FINALIZATION

View file

@ -135,7 +135,7 @@ then
pushd "$final_path" || ynh_die pushd "$final_path" || ynh_die
ynh_use_nodejs ynh_use_nodejs
bin/setup ynh_exec_warn_less bin/setup
ynh_exec_warn_less yarn run build ynh_exec_warn_less yarn run build
popd || ynh_die popd || ynh_die
fi fi
@ -143,18 +143,18 @@ fi
#================================================= #=================================================
# MODIFY A CONFIG FILE # MODIFY A CONFIG FILE
#================================================= #=================================================
ynh_script_progression --message="Modifying a config file..." --weight=2 #ynh_script_progression --message="Modifying a config file..." --weight=2
path=${path_url:1} #path=${path_url:1}
ynh_add_config --template="../conf/config.json.example" --destination="$final_path/config.json" #ynh_add_config --template="../conf/config.json.example" --destination="$final_path/config.json"
#================================================= #=================================================
# SETUP SYSTEMD # SETUP SYSTEMD
#================================================= #=================================================
ynh_script_progression --message="Configuring a systemd service..." --weight=2 ynh_script_progression --message="Configuring a systemd service..." --weight=2
ynh_replace_string --match_string="__ENV_PATH__" --replace_string="$PATH" --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_replace_string --match_string="__YNH_NPM__" --replace_string="$ynh_npm" --target_file="../conf/systemd.service"
# Create a dedicated systemd config # Create a dedicated systemd config
ynh_add_systemd_config ynh_add_systemd_config
@ -168,6 +168,7 @@ ynh_script_progression --message="Securing files and directories..." --weight=1
# Set permissions on app files # Set permissions on app files
chown -R $app:$app $final_path chown -R $app:$app $final_path
chmod o-rwx $final_path
#================================================= #=================================================
# INTEGRATE SERVICE IN YUNOHOST # INTEGRATE SERVICE IN YUNOHOST
@ -181,7 +182,7 @@ yunohost service add $app --description="Collaborative Markdown notes" --log="/v
#================================================= #=================================================
ynh_script_progression --message="Starting a systemd service..." --weight=1 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 # RELOAD NGINX