mirror of
https://github.com/YunoHost-Apps/borgwarehouse_ynh.git
synced 2024-09-03 18:16:17 +02:00
use data_dir
This commit is contained in:
parent
d749234c0a
commit
bb255b8ce7
8 changed files with 29 additions and 46 deletions
|
@ -8,7 +8,7 @@ Type=simple
|
||||||
User=__APP__
|
User=__APP__
|
||||||
Group=__APP__
|
Group=__APP__
|
||||||
Environment="__YNH_NODE_LOAD_PATH__"
|
Environment="__YNH_NODE_LOAD_PATH__"
|
||||||
WorkingDirectory=/home/yunohost.app/__APP__/app
|
WorkingDirectory=__DATA_DIR__/app
|
||||||
Environment=PORT=__PORT__
|
Environment=PORT=__PORT__
|
||||||
ExecStart=__YNH_NPM__ run start
|
ExecStart=__YNH_NPM__ run start
|
||||||
Restart=on-failure
|
Restart=on-failure
|
||||||
|
|
|
@ -54,6 +54,8 @@ ram.runtime = "50M"
|
||||||
|
|
||||||
[resources.install_dir]
|
[resources.install_dir]
|
||||||
|
|
||||||
|
[resources.data_dir]
|
||||||
|
|
||||||
[resources.permissions]
|
[resources.permissions]
|
||||||
main.url = "/"
|
main.url = "/"
|
||||||
api.url = "/api"
|
api.url = "/api"
|
||||||
|
|
|
@ -15,18 +15,11 @@ source /usr/share/yunohost/helpers
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info --message="Declaring files to be backed up..."
|
ynh_print_info --message="Declaring files to be backed up..."
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# BACKUP THE APP MAIN DIR
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
ynh_backup --src_path="/home/yunohost.app/$app/app"
|
|
||||||
ynh_backup --src_path="/home/yunohost.app/$app/.ssh"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP THE REPOS DIRECTORY
|
# BACKUP THE REPOS DIRECTORY
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_backup --src_path="/home/yunohost.app/$app/repos" --is_big
|
ynh_backup --src_path="$data_dir" --is_big
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP THE NGINX CONFIGURATION
|
# BACKUP THE NGINX CONFIGURATION
|
||||||
|
@ -34,16 +27,8 @@ ynh_backup --src_path="/home/yunohost.app/$app/repos" --is_big
|
||||||
|
|
||||||
ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# BACKUP SYSTEMD
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
ynh_backup --src_path="/etc/systemd/system/$app.service"
|
ynh_backup --src_path="/etc/systemd/system/$app.service"
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# BACKUP VARIOUS FILES
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
ynh_backup --src_path="/etc/cron.d/$app"
|
ynh_backup --src_path="/etc/cron.d/$app"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -30,10 +30,10 @@ ynh_change_url_nginx_config
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Adding a configuration file..." --weight=1
|
ynh_script_progression --message="Adding a configuration file..." --weight=1
|
||||||
|
|
||||||
ynh_add_config --template=".env" --destination="/home/yunohost.app/$app/app/.env.local"
|
ynh_add_config --template=".env" --destination="$data_dir/app/.env.local"
|
||||||
|
|
||||||
chmod 400 "/home/yunohost.app/$app/app/.env.local"
|
chmod 400 "$data_dir/app/.env.local"
|
||||||
chown $app:$app "/home/yunohost.app/$app/app/.env.local"
|
chown $app:$app "$data_dir/app/.env.local"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# GENERIC FINALISATION
|
# GENERIC FINALISATION
|
||||||
|
|
|
@ -35,21 +35,19 @@ ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Setting up source files..." --weight=1
|
ynh_script_progression --message="Setting up source files..." --weight=1
|
||||||
|
|
||||||
mkdir "/home/yunohost.app/$app" && chmod 700 "/home/yunohost.app/$app"
|
|
||||||
|
|
||||||
# Download, check integrity, uncompress and patch the source from manifest.toml
|
# Download, check integrity, uncompress and patch the source from manifest.toml
|
||||||
ynh_setup_source --dest_dir="/home/yunohost.app/$app/app"
|
ynh_setup_source --dest_dir="$data_dir/app"
|
||||||
|
|
||||||
chmod 700 "/home/yunohost.app/$app"
|
chmod 700 "$data_dir"
|
||||||
|
|
||||||
mkdir "/home/yunohost.app/$app/.ssh" && chmod 700 "/home/yunohost.app/$app/.ssh"
|
mkdir "$data_dir/.ssh" && chmod 700 "$data_dir/.ssh"
|
||||||
touch "/home/yunohost.app/$app/.ssh/authorized_keys" && chmod 600 "/home/yunohost.app/$app/.ssh/authorized_keys"
|
touch "$data_dir/.ssh/authorized_keys" && chmod 600 "$data_dir/.ssh/authorized_keys"
|
||||||
|
|
||||||
chmod 700 "/home/yunohost.app/$app/app/helpers/shells/"*
|
chmod 700 "$data_dir/app/helpers/shells/"*
|
||||||
|
|
||||||
mkdir "/home/yunohost.app/$app/repos" && chmod 700 "/home/yunohost.app/$app/repos"
|
mkdir "$data_dir/repos" && chmod 700 "$data_dir/repos"
|
||||||
|
|
||||||
chown -R $app:www-data "/home/yunohost.app/$app"
|
chown -R $app:www-data "$data_dir"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SYSTEM CONFIGURATION
|
# SYSTEM CONFIGURATION
|
||||||
|
@ -73,10 +71,10 @@ yunohost service add $app --description="WebUI for BorgBackup" --log="/var/log/$
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Adding a configuration file..." --weight=1
|
ynh_script_progression --message="Adding a configuration file..." --weight=1
|
||||||
|
|
||||||
ynh_add_config --template=".env" --destination="/home/yunohost.app/$app/app/.env.local"
|
ynh_add_config --template=".env" --destination="$data_dir/app/.env.local"
|
||||||
|
|
||||||
chmod 400 "/home/yunohost.app/$app/app/.env.local"
|
chmod 400 "$data_dir/app/.env.local"
|
||||||
chown $app:$app "/home/yunohost.app/$app/app/.env.local"
|
chown $app:$app "$data_dir/app/.env.local"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# INSTALL BORGWARHOUSE
|
# INSTALL BORGWARHOUSE
|
||||||
|
|
|
@ -31,8 +31,6 @@ ynh_remove_nodejs
|
||||||
|
|
||||||
ynh_secure_remove --file="/etc/cron.d/$app"
|
ynh_secure_remove --file="/etc/cron.d/$app"
|
||||||
|
|
||||||
ynh_secure_remove --file="/home/yunohost.app/$app"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -15,17 +15,17 @@ source /usr/share/yunohost/helpers
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Restoring the app main directory..." --weight=1
|
ynh_script_progression --message="Restoring the app main directory..." --weight=1
|
||||||
|
|
||||||
mkdir -p "/home/yunohost.app/$app" && chmod 700 "/home/yunohost.app/$app"
|
mkdir -p "$data_dir" && chmod 700 "$data_dir"
|
||||||
|
|
||||||
ynh_restore_file --origin_path="/home/yunohost.app/$app/app"
|
ynh_restore_file --origin_path="$data_dir/app"
|
||||||
ynh_restore_file --origin_path="/home/yunohost.app/$app/.ssh"
|
ynh_restore_file --origin_path="$data_dir/.ssh"
|
||||||
|
|
||||||
ynh_restore_file --origin_path="/home/yunohost.app/$app/repos" --not_mandatory
|
ynh_restore_file --origin_path="$data_dir/repos" --not_mandatory
|
||||||
|
|
||||||
chmod -R 700 "/home/yunohost.app/$app"
|
chmod -R 700 "$data_dir"
|
||||||
chmod 600 "/home/yunohost.app/$app/.ssh/authorized_keys"
|
chmod 600 "$data_dir/.ssh/authorized_keys"
|
||||||
|
|
||||||
chown -R $app:www-data "/home/yunohost.app/$app"
|
chown -R $app:www-data "$data_dir"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# REINSTALL DEPENDENCIES
|
# REINSTALL DEPENDENCIES
|
||||||
|
|
|
@ -32,9 +32,9 @@ ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd"
|
||||||
ynh_script_progression --message="Upgrading source files..." --weight=1
|
ynh_script_progression --message="Upgrading source files..." --weight=1
|
||||||
|
|
||||||
# Download, check integrity, uncompress and patch the source from manifest.toml
|
# Download, check integrity, uncompress and patch the source from manifest.toml
|
||||||
ynh_setup_source --dest_dir="/home/yunohost.app/$app/app" --keep="app/.env.local app/config/users.json app/config/repo.json"
|
ynh_setup_source --dest_dir="$data_dir/app" --keep="app/.env.local app/config/users.json app/config/repo.json"
|
||||||
|
|
||||||
chown -R $app:www-data "/home/yunohost.app/$app/app"
|
chown -R $app:www-data "$data_dir/app"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# REAPPLY SYSTEM CONFIGURATIONS
|
# REAPPLY SYSTEM CONFIGURATIONS
|
||||||
|
@ -59,10 +59,10 @@ yunohost service add $app --description="WebUI for BorgBackup" --log="/var/log/$
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Updating a configuration file..." --weight=1
|
ynh_script_progression --message="Updating a configuration file..." --weight=1
|
||||||
|
|
||||||
ynh_add_config --template=".env" --destination="/home/yunohost.app/$app/app/.env.local"
|
ynh_add_config --template=".env" --destination="$data_dir/app/.env.local"
|
||||||
|
|
||||||
chmod 400 "/home/yunohost.app/$app/app/.env.local"
|
chmod 400 "$data_dir/app/.env.local"
|
||||||
chown $app:$app "/home/yunohost.app/$app/app/.env.local"
|
chown $app:$app "$data_dir/app/.env.local"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# INSTALL BORGWARHOUSE
|
# INSTALL BORGWARHOUSE
|
||||||
|
|
Loading…
Reference in a new issue