mirror of
https://github.com/YunoHost-Apps/haste_ynh.git
synced 2024-09-03 20:36:28 +02:00
commit
5c75e5b42a
6 changed files with 36 additions and 43 deletions
|
@ -1,17 +1,10 @@
|
||||||
{
|
{
|
||||||
|
|
||||||
"host": "127.0.0.1",
|
"host": "127.0.0.1",
|
||||||
|
|
||||||
"port": __PORT__,
|
"port": __PORT__,
|
||||||
|
|
||||||
"keyLength": 10,
|
"keyLength": 10,
|
||||||
|
|
||||||
"maxLength": 400000,
|
"maxLength": 400000,
|
||||||
|
|
||||||
"staticMaxAge": 86400,
|
"staticMaxAge": 86400,
|
||||||
|
|
||||||
"recompressStaticAssets": true,
|
"recompressStaticAssets": true,
|
||||||
|
|
||||||
"logging": [
|
"logging": [
|
||||||
{
|
{
|
||||||
"level": "verbose",
|
"level": "verbose",
|
||||||
|
@ -19,11 +12,9 @@
|
||||||
"colorize": true
|
"colorize": true
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
|
||||||
"keyGenerator": {
|
"keyGenerator": {
|
||||||
"type": "phonetic"
|
"type": "phonetic"
|
||||||
},
|
},
|
||||||
|
|
||||||
"rateLimits": {
|
"rateLimits": {
|
||||||
"categories": {
|
"categories": {
|
||||||
"normal": {
|
"normal": {
|
||||||
|
@ -32,14 +23,11 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
"storage": {
|
"storage": {
|
||||||
"type": "file",
|
"type": "file",
|
||||||
"path": "__YNH_DATA_PATH__"
|
"path": "__YNH_DATA_PATH__"
|
||||||
},
|
},
|
||||||
|
|
||||||
"documents": {
|
"documents": {
|
||||||
"about": "./about.md"
|
"about": "./about.md"
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@ location __PATH__/ {
|
||||||
rewrite ^ https://$server_name$request_uri? permanent;
|
rewrite ^ https://$server_name$request_uri? permanent;
|
||||||
}
|
}
|
||||||
|
|
||||||
proxy_pass http://localhost:__PORT__;
|
proxy_pass http://127.0.0.1:__PORT__;
|
||||||
proxy_set_header Host $host;
|
proxy_set_header Host $host;
|
||||||
|
|
||||||
proxy_buffering off;
|
proxy_buffering off;
|
||||||
|
|
|
@ -32,8 +32,6 @@ domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info --message="Declaring files to be backed up..."
|
ynh_print_info --message="Declaring files to be backed up..."
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# STANDARD BACKUP STEPS
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP THE APP MAIN DIR
|
# BACKUP THE APP MAIN DIR
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -46,8 +44,6 @@ ynh_backup --src_path="$final_path"
|
||||||
|
|
||||||
ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# SPECIFIC BACKUP
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP LOGROTATE
|
# BACKUP LOGROTATE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -121,9 +121,6 @@ data_path="/home/yunohost.app/${app}"
|
||||||
# Create app folders
|
# Create app folders
|
||||||
mkdir -p "$data_path"
|
mkdir -p "$data_path"
|
||||||
|
|
||||||
# Give permission to the datadir
|
|
||||||
chown -R $app:$app "$data_path"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CONFIGURE HASTE
|
# CONFIGURE HASTE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -149,7 +146,6 @@ ynh_replace_string --match_string="__YNH_HASTE_URL__" --replace_string="${domain
|
||||||
ynh_replace_string --match_string="__PORT__" --replace_string="$port" --target_file="../conf/haste.sh"
|
ynh_replace_string --match_string="__PORT__" --replace_string="$port" --target_file="../conf/haste.sh"
|
||||||
|
|
||||||
cp ../conf/haste.sh /usr/bin/$app
|
cp ../conf/haste.sh /usr/bin/$app
|
||||||
chmod +x /usr/bin/$app
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# GENERIC FINALIZATION
|
# GENERIC FINALIZATION
|
||||||
|
@ -158,7 +154,9 @@ chmod +x /usr/bin/$app
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
chown -R root: $final_path
|
chown -R root: $final_path
|
||||||
chown -R $app "$final_path/static"
|
chown -R $app: "$final_path/static"
|
||||||
|
chown -R $app: "$data_path"
|
||||||
|
chmod +x /usr/bin/$app
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# HANDLE LOG FILES AND SETUP LOGROTATE
|
# HANDLE LOG FILES AND SETUP LOGROTATE
|
||||||
|
|
|
@ -13,9 +13,6 @@ source /usr/share/yunohost/helpers
|
||||||
# MANAGE SCRIPT FAILURE
|
# MANAGE SCRIPT FAILURE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_clean_setup () {
|
|
||||||
true
|
|
||||||
}
|
|
||||||
# Exit if an error occurs during the execution of the script
|
# Exit if an error occurs during the execution of the script
|
||||||
ynh_abort_if_errors
|
ynh_abort_if_errors
|
||||||
|
|
||||||
|
@ -61,7 +58,7 @@ ynh_restore_file --origin_path="$final_path"
|
||||||
ynh_script_progression --message="Recreating the dedicated system user..." --weight=1
|
ynh_script_progression --message="Recreating the dedicated system user..." --weight=1
|
||||||
|
|
||||||
# Create the dedicated user (if not existing)
|
# Create the dedicated user (if not existing)
|
||||||
ynh_system_user_create --username=$app
|
ynh_system_user_create --username=$app --home_dir=$final_path
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SPECIFIC RESTORE
|
# SPECIFIC RESTORE
|
||||||
|
@ -71,27 +68,34 @@ ynh_system_user_create --username=$app
|
||||||
|
|
||||||
ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version
|
ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# RESTORE SYSTEMD
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Restoring the systemd configuration..." --weight=2
|
|
||||||
|
|
||||||
ynh_restore_file --origin_path="/etc/systemd/system/$app.service"
|
|
||||||
systemctl enable $app.service
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE VARIOUS FILES
|
# RESTORE VARIOUS FILES
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_restore_file "/home/yunohost.app/$app"
|
ynh_restore_file "/home/yunohost.app/$app"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# RESTORE BINARY
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
ynh_restore_file --origin_path="/usr/bin/$app"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SECURE FILES AND DIRECTORIES
|
# SECURE FILES AND DIRECTORIES
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
chown -R root: $final_path
|
chown -R root: $final_path
|
||||||
chown -R $app "$final_path/static"
|
chown -R $app: "$final_path/static"
|
||||||
chown -R $app "/home/yunohost.app/$app"
|
chown -R $app: "/home/yunohost.app/$app"
|
||||||
|
chmod +x /usr/bin/$app
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# RESTORE HANDLE LOG FILES
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
mkdir -p /var/log/$app
|
||||||
|
touch /var/log/$app/$app.log
|
||||||
|
chown $app -R /var/log/$app
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# INTEGRATE SERVICE IN YUNOHOST
|
# INTEGRATE SERVICE IN YUNOHOST
|
||||||
|
@ -99,6 +103,14 @@ chown -R $app "/home/yunohost.app/$app"
|
||||||
|
|
||||||
yunohost service add $app --description "Haste is an open-source pastebin software" --log "/var/log/$app/$app.log"
|
yunohost service add $app --description "Haste is an open-source pastebin software" --log "/var/log/$app/$app.log"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# RESTORE SYSTEMD
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Restoring the systemd configuration..." --weight=2
|
||||||
|
|
||||||
|
ynh_restore_file --origin_path="/etc/systemd/system/$app.service"
|
||||||
|
systemctl enable $app.service
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# START SYSTEMD SERVICE
|
# START SYSTEMD SERVICE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -115,7 +127,7 @@ ynh_restore_file --origin_path="/etc/logrotate.d/$app"
|
||||||
#=================================================
|
#=================================================
|
||||||
# GENERIC FINALIZATION
|
# GENERIC FINALIZATION
|
||||||
#=================================================
|
#=================================================
|
||||||
# RELOAD NGINX AND PHP-FPM
|
# RELOAD NGINX
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
|
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
|
||||||
|
|
||||||
|
|
|
@ -171,8 +171,6 @@ ynh_replace_string --match_string="__YNH_HASTE_URL__" --replace_string="${domain
|
||||||
|
|
||||||
cp ../conf/haste.sh /usr/bin/$app
|
cp ../conf/haste.sh /usr/bin/$app
|
||||||
|
|
||||||
chmod +x /usr/bin/$app
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# GENERIC FINALIZATION
|
# GENERIC FINALIZATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -180,8 +178,9 @@ chmod +x /usr/bin/$app
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
chown -R root: $final_path
|
chown -R root: $final_path
|
||||||
chown -R $app "$final_path/static"
|
chown -R $app: "$final_path/static"
|
||||||
chown -R $app "$data_path"
|
chown -R $app: "$data_path"
|
||||||
|
chmod +x /usr/bin/$app
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# START SYSTEMD SERVICE
|
# START SYSTEMD SERVICE
|
||||||
|
|
Loading…
Reference in a new issue