mirror of
https://github.com/YunoHost-Apps/vikunja_ynh.git
synced 2024-09-03 18:06:26 +02:00
commit
e2735fa13f
10 changed files with 55 additions and 53 deletions
|
@ -7,7 +7,7 @@ Requires=postgresql.service redis.service
|
|||
Type=simple
|
||||
User=__APP__
|
||||
Group=__APP__
|
||||
WorkingDirectory=/opt/__APP__
|
||||
WorkingDirectory=/opt/__APP__/
|
||||
ExecStart=/opt/__APP__/vikunja
|
||||
RestartSec=2s
|
||||
Restart=always
|
||||
|
|
|
@ -11,7 +11,7 @@ services = ["__APP__"]
|
|||
ask = "Set MOTD"
|
||||
type = "string"
|
||||
help = "Set the MOTD message shown in Vikunja login page"
|
||||
bind = "motd:/etc/vikunja/config.yml"
|
||||
bind = "motd:/opt/__APP__/config.yml"
|
||||
|
||||
[main.config.enable_registration]
|
||||
ask = "Enable registration"
|
||||
|
@ -19,5 +19,5 @@ services = ["__APP__"]
|
|||
yes = "true"
|
||||
no = "false"
|
||||
help = "Whether to let new users registering themselves or not"
|
||||
bind = "enableregistration:/etc/vikunja/config.yml"
|
||||
bind = "enableregistration:/opt/__APP__/config.yml"
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
## Configuration
|
||||
|
||||
You can also configure Vikunja by editing this file `/etc/vikunja/config.yml` using the [documentation](https://vikunja.io/docs/config-options/).
|
||||
You can also configure Vikunja by editing this file `/opt/vikunja/config.yml` using the [documentation](https://vikunja.io/docs/config-options/).
|
||||
|
||||
|
||||
The API is accesible with this path: https://domain.ltd/api/v1/docs
|
|
@ -1,3 +1,3 @@
|
|||
## Configuration
|
||||
|
||||
Vous pouvez configurer Vikunja en modifiant le fichier `/etc/vikunja/config.yml` en vous aidant de la [documentation](https://vikunja.io/docs/config-options/).
|
||||
Vous pouvez configurer Vikunja en modifiant le fichier `/opt/vikunja/config.yml` en vous aidant de la [documentation](https://vikunja.io/docs/config-options/).
|
|
@ -24,6 +24,7 @@ ynh_print_info --message="Loading installation settings..."
|
|||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||
backend_path=$(ynh_app_setting_get --app=$app --key=backend_path)
|
||||
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||
|
||||
|
@ -39,11 +40,8 @@ ynh_print_info --message="Declaring files to be backed up..."
|
|||
# Frontend
|
||||
ynh_backup --src_path="$final_path"
|
||||
|
||||
# Config
|
||||
ynh_backup --src_path="/etc/$app/config.yml"
|
||||
|
||||
# Backend
|
||||
ynh_backup --src_path="/opt/$app"
|
||||
ynh_backup --src_path="$backend_path"
|
||||
|
||||
#=================================================
|
||||
# BACKUP THE NGINX CONFIGURATION
|
||||
|
|
|
@ -28,6 +28,7 @@ ynh_script_progression --message="Loading installation settings..." --weight=1
|
|||
|
||||
# Needed for helper "ynh_add_nginx_config"
|
||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||
backend_path=$(ynh_app_setting_get --app=$app --key=backend_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
|
||||
|
@ -117,9 +118,9 @@ ynh_script_progression --message="Adding a configuration file..." --weight=1
|
|||
domain="$new_domain"
|
||||
path="$new_path"
|
||||
redis_db=$(ynh_redis_get_free_db)
|
||||
ynh_add_config --template="../conf/config.yml" --destination="/etc/$app/config.yml"
|
||||
ynh_add_config --template="../conf/config.yml" --destination="$backend_path/config.yml"
|
||||
|
||||
chmod 600 "/etc/$app/config.yml"
|
||||
chmod 600 "$backend_path/config.yml"
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALISATION
|
||||
|
|
|
@ -37,6 +37,7 @@ enable_registration="true"
|
|||
ynh_script_progression --message="Validating installation parameters..." --weight=1
|
||||
|
||||
final_path=/var/www/$app
|
||||
backend_path=/opt/$app
|
||||
test ! -e "$final_path" || ynh_die --message="This path already contains a folder"
|
||||
|
||||
# Register (book) web path
|
||||
|
@ -107,16 +108,18 @@ chown -R $app:www-data "$final_path"
|
|||
#=================================================
|
||||
ynh_script_progression --message="Setting up backend..." --weight=1
|
||||
|
||||
ynh_app_setting_set --app=$app --key=backend_path --value=$backend_path
|
||||
|
||||
# Download, check integrity, uncompress and patch the source from app.src
|
||||
mkdir -p "/opt/$app"
|
||||
mkdir -p "/opt/$app/files"
|
||||
mkdir -p "$backend_path"
|
||||
mkdir -p "$backend_path/files"
|
||||
tempdir="$(mktemp -d)"
|
||||
ynh_setup_source --dest_dir=$tempdir --source_id=$YNH_ARCH
|
||||
back="$(find $tempdir -name "vikunja-*" \! -name "*.sha256")"
|
||||
cp "$back" "/opt/$app/vikunja"
|
||||
cp "$back" "$backend_path/vikunja"
|
||||
|
||||
chmod +x "/opt/$app/vikunja"
|
||||
chown -R $app:www-data "/opt/$app/files"
|
||||
chmod +x "$backend_path/vikunja"
|
||||
chown -R $app:www-data "$backend_path/files"
|
||||
|
||||
#=================================================
|
||||
# NGINX CONFIGURATION
|
||||
|
@ -131,12 +134,11 @@ ynh_add_nginx_config
|
|||
#=================================================
|
||||
ynh_script_progression --message="Adding a configuration file..." --weight=1
|
||||
|
||||
mkdir -p "/etc/$app"
|
||||
redis_db=$(ynh_redis_get_free_db)
|
||||
ynh_add_config --template="../conf/config.yml" --destination="/etc/$app/config.yml"
|
||||
ynh_add_config --template="../conf/config.yml" --destination="$backend_path/config.yml"
|
||||
|
||||
chmod 400 "/etc/$app/config.yml"
|
||||
chown $app:$app "/etc/$app/config.yml"
|
||||
chmod 400 "$backend_path/config.yml"
|
||||
chown $app:$app "$backend_path/config.yml"
|
||||
|
||||
#=================================================
|
||||
# SETUP SYSTEMD
|
||||
|
|
|
@ -19,6 +19,7 @@ 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)
|
||||
backend_path=$(ynh_app_setting_get --app=$app --key=backend_path)
|
||||
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||
db_user=$db_name
|
||||
|
||||
|
@ -74,6 +75,9 @@ ynh_script_progression --message="Removing $app main directory..." --weight=6
|
|||
# Remove the app directory securely
|
||||
ynh_secure_remove --file="$final_path"
|
||||
|
||||
# Remove backend
|
||||
ynh_secure_remove --file="$backend_path"
|
||||
|
||||
#=================================================
|
||||
# REMOVE NGINX CONFIGURATION
|
||||
#=================================================
|
||||
|
@ -92,14 +96,6 @@ ynh_script_progression --message="Removing the dedicated system user..." --weigh
|
|||
# Delete a system user
|
||||
ynh_system_user_delete --username=$app
|
||||
|
||||
#=================================================
|
||||
# REMOVE BACKEND
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing backend..." --weight=1
|
||||
|
||||
# Delete /opt/vikunja
|
||||
ynh_secure_remove --file="/opt/$app"
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
|
|
@ -26,6 +26,7 @@ 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)
|
||||
backend_path=$(ynh_app_setting_get --app=$app --key=backend_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=psqlpwd)
|
||||
|
@ -65,13 +66,10 @@ chmod 750 "$final_path"
|
|||
chmod -R o-rwx "$final_path"
|
||||
chown -R $app:www-data "$final_path"
|
||||
|
||||
# Config
|
||||
ynh_restore_file --origin_path="/etc/$app/config.yml"
|
||||
|
||||
# Backend
|
||||
ynh_restore_file --origin_path="/opt/$app"
|
||||
chmod +x "/opt/$app/vikunja"
|
||||
chown -R $app:www-data "/opt/$app/files"
|
||||
ynh_restore_file --origin_path="$backend_path"
|
||||
chmod +x "$backend_path/vikunja"
|
||||
chown -R $app:www-data "$backend_path/files"
|
||||
|
||||
#=================================================
|
||||
# REINSTALL DEPENDENCIES
|
||||
|
|
|
@ -19,6 +19,7 @@ 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)
|
||||
backend_path=$(ynh_app_setting_get --app=$app --key=backend_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
|
||||
|
@ -35,11 +36,31 @@ enable_registration=$(ynh_app_setting_get --app=$app --key=enable_registration)
|
|||
|
||||
upgrade_type=$(ynh_check_app_version_changed)
|
||||
|
||||
#=================================================
|
||||
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
||||
#=================================================
|
||||
ynh_script_progression --message="Backing up $app before upgrading (may take a while)..." --weight=4
|
||||
|
||||
# Backup the current version of the app
|
||||
ynh_backup_before_upgrade
|
||||
ynh_clean_setup () {
|
||||
# restore it if the upgrade fails
|
||||
ynh_restore_upgradebackup
|
||||
}
|
||||
# Exit if an error occurs during the execution of the script
|
||||
ynh_abort_if_errors
|
||||
|
||||
#=================================================
|
||||
# ENSURE DOWNWARD COMPATIBILITY
|
||||
#=================================================
|
||||
ynh_script_progression --message="Ensuring downward compatibility..." --weight=1
|
||||
|
||||
# If backend_path doesn't exist, create it
|
||||
if [ -z "$backend_path" ]; then
|
||||
backend_path=/opt/$app
|
||||
ynh_app_setting_set --app=$app --key=backend_path --value=$backend_path
|
||||
fi
|
||||
|
||||
if [ -z "$set_motd" ]; then
|
||||
set_motd=""
|
||||
ynh_app_setting_set --app=$app --key=set_motd --value=$set_motd
|
||||
|
@ -62,20 +83,6 @@ if ! ynh_permission_exists --permission="api"; then
|
|||
ynh_permission_create --permission="api" --url="/api" --allowed="visitors" --auth_header="false" --show_tile="false" --protected="true"
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
||||
#=================================================
|
||||
ynh_script_progression --message="Backing up $app before upgrading (may take a while)..." --weight=4
|
||||
|
||||
# Backup the current version of the app
|
||||
ynh_backup_before_upgrade
|
||||
ynh_clean_setup () {
|
||||
# restore it if the upgrade fails
|
||||
ynh_restore_upgradebackup
|
||||
}
|
||||
# Exit if an error occurs during the execution of the script
|
||||
ynh_abort_if_errors
|
||||
|
||||
#=================================================
|
||||
# STANDARD UPGRADE STEPS
|
||||
#=================================================
|
||||
|
@ -103,21 +110,21 @@ then
|
|||
|
||||
# Download, check integrity, uncompress and patch the source from app.src
|
||||
# Frontend
|
||||
ynh_setup_source --dest_dir="$final_path" --source_id="front" --keep="/etc/$app/config.yml"
|
||||
ynh_setup_source --dest_dir="$final_path" --source_id="front"
|
||||
|
||||
# Backend
|
||||
mkdir -p "/opt/$app/files"
|
||||
mkdir -p "$backend_path/files"
|
||||
tempdir="$(mktemp -d)"
|
||||
ynh_setup_source --dest_dir=$tempdir --source_id=$YNH_ARCH
|
||||
back="$(find $tempdir -name "vikunja-*" \! -name "*.sha256")"
|
||||
cp "$back" "/opt/$app/vikunja"
|
||||
cp "$back" "$backend_path/vikunja"
|
||||
fi
|
||||
|
||||
chmod 750 "$final_path"
|
||||
chmod -R o-rwx "$final_path"
|
||||
chown -R $app:www-data "$final_path"
|
||||
chmod +x "/opt/$app/vikunja"
|
||||
chown -R $app:www-data "/opt/$app/files"
|
||||
chmod +x "$backend_path/vikunja"
|
||||
chown -R $app:www-data "$backend_path/files"
|
||||
|
||||
#=================================================
|
||||
# NGINX CONFIGURATION
|
||||
|
|
Loading…
Add table
Reference in a new issue