diff --git a/README_id.md b/README_id.md index 05306b9..eeb6ae8 100644 --- a/README_id.md +++ b/README_id.md @@ -39,7 +39,7 @@ Vikunja is a self-hosted open-source to-do list application for all platforms. - Website aplikasi resmi: - Dokumentasi admin resmi: -- Repositori kode aplikasi hulu: +- Depot kode aplikasi hulu: - Gudang YunoHost: - Laporkan bug: diff --git a/conf/config.yml b/conf/config.yml index f7f11a8..e7f1585 100644 --- a/conf/config.yml +++ b/conf/config.yml @@ -21,7 +21,7 @@ service: # The base path on the file system where the binary and assets are. # Vikunja will also look in this path for a config file, so you could provide only this variable to point to a folder # with a config file which will then be used. - rootpath: "/opt/vikunja/" + rootpath: "__INSTALL_DIR__" # Path on the file system to serve static files from. Set to the path of the frontend files to host frontend alongside the api. staticpath: "" # The max number of items which can be returned per page diff --git a/conf/nginx.conf b/conf/nginx.conf index e693a5d..860493d 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -1,18 +1,9 @@ #sub_path_only rewrite ^__PATH__$ __PATH__/ permanent; location __PATH__/ { - # Path to source - alias __INSTALL_DIR__/; - - try_files $uri $uri/ /; - - index index.html index.htm; + proxy_pass http://127.0.0.1:__PORT__; + client_max_body_size 20M; # Include SSOWAT user panel. include conf.d/yunohost_panel.conf.inc; } - -location ~* ^/(api|dav|\.well-known)/ { - proxy_pass http://127.0.0.1:__PORT__; - client_max_body_size 20M; -} diff --git a/conf/systemd.service b/conf/systemd.service index 8d1a42d..8bb8aa2 100644 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -7,8 +7,8 @@ Requires=postgresql.service redis.service Type=simple User=__APP__ Group=__APP__ -WorkingDirectory=/opt/__APP__/ -ExecStart=/opt/__APP__/vikunja +WorkingDirectory=__INSTALL_DIR__/ +ExecStart=__INSTALL_DIR__/vikunja RestartSec=2s Restart=always diff --git a/config_panel.toml b/config_panel.toml index 64d977b..ac24e5d 100644 --- a/config_panel.toml +++ b/config_panel.toml @@ -13,7 +13,7 @@ services = ["__APP__"] ask.fr = "Définir le MOTD" type = "string" help = "Set the MOTD message shown in Vikunja login page" - bind = "motd:/opt/__APP__/config.yml" + bind = "motd:/var/www/__APP__/config.yml" [main.config.enable_registration] ask.en = "Enable registration" @@ -22,7 +22,7 @@ services = ["__APP__"] yes = "true" no = "false" help = "Whether to let new users registering themselves or not" - bind = "enableregistration:/opt/__APP__/config.yml" + bind = "enableregistration:/var/www/__APP__/config.yml" [main.config.enable_linksharing] ask.en = "Enable links sharing" @@ -31,7 +31,7 @@ services = ["__APP__"] yes = "true" no = "false" help = "Enable sharing of lists via a link" - bind = "enablelinksharing:/opt/__APP__/config.yml" + bind = "enablelinksharing:/var/www/__APP__/config.yml" [main.config.enable_taskattachments] ask.en = "Enable tasks attachments" @@ -40,7 +40,7 @@ services = ["__APP__"] yes = "true" no = "false" help = "Whether to enable task attachments or not" - bind = "enabletaskattachments:/opt/__APP__/config.yml" + bind = "enabletaskattachments:/var/www/__APP__/config.yml" [main.config.enable_taskcomments] ask.en = "Enable task comments" @@ -49,7 +49,7 @@ services = ["__APP__"] yes = "true" no = "false" help = "Whether task comments should be enabled or not" - bind = "enabletaskcomments:/opt/__APP__/config.yml" + bind = "enabletaskcomments:/var/www/__APP__/config.yml" [main.config.enable_emailreminders] ask.en = "Enable email reminders" @@ -58,7 +58,7 @@ services = ["__APP__"] yes = "true" no = "false" help = "If enabled, vikunja will send an email to everyone who is either assigned to a task or created it when a task reminder is due." - bind = "enableemailreminders:/opt/__APP__/config.yml" + bind = "enableemailreminders:/var/www/__APP__/config.yml" [main.config.enable_userdeletion] ask.en = "Enable user deletion" @@ -67,19 +67,19 @@ services = ["__APP__"] yes = "true" no = "false" help = "If true, will allow users to request the complete deletion of their account. When using external authentication methods it may be required to coordinate with them in order to delete the account. This setting will not affect the cli commands for user deletion" - bind = "enableuserdeletion:/opt/__APP__/config.yml" + bind = "enableuserdeletion:/var/www/__APP__/config.yml" [main.config.maxavatarsize] ask.en = "Max avatar size" ask.fr = "Taille maximum de l'avatar" type = "number" help = "The maximum size clients will be able to request for user avatars. If clients request a size bigger than this, it will be changed on the fly" - bind = "maxavatarsize:/opt/__APP__/config.yml" + bind = "maxavatarsize:/var/www/__APP__/config.yml" [main.config.maxitemsperpage] ask.en = "Max items per page" ask.fr = "Nombre d'éléments maximum par page" type = "number" help = "The max number of items which can be returned per page" - bind = "maxitemsperpage:/opt/__APP__/config.yml" + bind = "maxitemsperpage:/var/www/__APP__/config.yml" diff --git a/manifest.toml b/manifest.toml index 5d85273..89e51ca 100644 --- a/manifest.toml +++ b/manifest.toml @@ -1,3 +1,5 @@ +#:schema https://raw.githubusercontent.com/YunoHost/apps/master/schemas/manifest.v2.schema.json + packaging_format = 2 id = "vikunja" @@ -46,26 +48,23 @@ ram.runtime = "50M" [resources] [resources.sources] - [resources.sources.back] - arm64.url = "https://dl.vikunja.io/api/0.22.1/vikunja-v0.22.1-linux-arm64-full.zip" - arm64.sha256 = "50a1670c0fde858c1cd7bc72cc670c4011a688a20b07ee62fab11bcca3eab01e" - amd64.url = "https://dl.vikunja.io/api/0.22.1/vikunja-v0.22.1-linux-amd64-full.zip" - amd64.sha256 = "c3e21ca5ccace3f9eaa423bab8c1cfc3e7de15d5c593db0aa6e4dbd9883469e6" - armhf.url = "https://dl.vikunja.io/api/0.22.1/vikunja-v0.22.1-linux-arm-7-full.zip" - armhf.sha256 = "72f50404df57d75060bdd0d162e12cba20269a0def7b38993e1b61c4cf3d69d2" - i386.url = "https://dl.vikunja.io/api/0.22.1/vikunja-v0.22.1-linux-386-full.zip" - i386.sha256 = "de1e271b6d3fe6024b790b95c1bf946a415598b31192638ef85589cd2c35f996" + [resources.sources.main] + arm64.url = "https://dl.vikunja.io/vikunja/0.24.1/vikunja-v0.24.1-linux-arm64-full.zip" + arm64.sha256 = "6642be9e0822ac8086c76823a2c090257f9cd5cacc2fd349ed12af520478ce55" + amd64.url = "https://dl.vikunja.io/vikunja/0.24.1/vikunja-v0.24.1-linux-amd64-full.zip" + amd64.sha256 = "62a5e936c7dc193fc0a2db46767ea015f2e45a06fd0e40b5b0918b05bfb2d1ff" + armhf.url = "https://dl.vikunja.io/vikunja/0.24.1/vikunja-v0.24.1-linux-arm-7-full.zip" + armhf.sha256 = "f7ff14b789376fd4cd41e331e6bd399538a64626891bd77f14258b3fec901346" + i386.url = "https://dl.vikunja.io/vikunja/0.24.1/vikunja-v0.24.1-linux-386-full.zip" + i386.sha256 = "a552c4e031cbe4f69b13636d326f4bfa525905211469e615e51bd6d8cc85f923" in_subdir = false format = "zip" - [resources.sources.front] - url = "https://dl.vikunja.io/frontend/vikunja-frontend-0.24.1.zip" - sha256 = "2278ba1d7f50bf656a771378a7a47434730496fe1867d4d4964020a2e7a713ff" - in_subdir = false - format = "zip" - - - [resources.ports] + autoupdate.strategy = "latest_gitea_release" + autoupdate.asset.amd64 = "tarball" + autoupdate.asset.i386 = "tarball" + autoupdate.asset.arm64 = "tarball" + autoupdate.asset.armhf = "tarball" [resources.system_user] allow_email = true @@ -79,6 +78,8 @@ ram.runtime = "50M" api.allowed = "visitors" api.auth_header = false + [resources.ports] + [resources.apt] packages = "postgresql" diff --git a/scripts/backup b/scripts/backup index 64e1a14..c711f03 100644 --- a/scripts/backup +++ b/scripts/backup @@ -18,22 +18,14 @@ ynh_print_info --message="Declaring files to be backed up..." # BACKUP THE APP MAIN DIR #================================================= -# Frontend ynh_backup --src_path="$install_dir" -# Backend -ynh_backup --src_path="$backend_path" - #================================================= -# BACKUP THE NGINX CONFIGURATION +# SYSTEM CONFIGURATION #================================================= ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf" -#================================================= -# BACKUP SYSTEMD -#================================================= - ynh_backup --src_path="/etc/systemd/system/$app.service" #================================================= diff --git a/scripts/change_url b/scripts/change_url index a639a04..e8cbf6f 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -40,9 +40,9 @@ ynh_script_progression --message="Adding a configuration file..." --weight=1 domain="$new_domain" path="$new_path" -ynh_add_config --template="../conf/config.yml" --destination="$backend_path/config.yml" +ynh_add_config --template="config.yml" --destination="$install_dir/config.yml" -chmod 600 "$backend_path/config.yml" +chmod 600 "$install_dir/config.yml" #================================================= # GENERIC FINALISATION diff --git a/scripts/install b/scripts/install index 30293fd..a3fae88 100644 --- a/scripts/install +++ b/scripts/install @@ -16,7 +16,6 @@ source /usr/share/yunohost/helpers timezone="$(cat /etc/timezone)" secret=$(ynh_string_random --length=32) redis_db=$(ynh_redis_get_free_db) -backend_path=/opt/$app set_motd="" enable_registration="true" @@ -32,7 +31,6 @@ maxitemsperpage=50 # STORE SETTINGS FROM MANIFEST #================================================= -ynh_app_setting_set --app=$app --key=backend_path --value=$backend_path ynh_app_setting_set --app=$app --key=set_motd --value=$set_motd ynh_app_setting_set --app=$app --key=enable_registration --value=$enable_registration ynh_app_setting_set --app=$app --key=enable_linksharing --value=$enable_linksharing @@ -44,31 +42,28 @@ ynh_app_setting_set --app=$app --key=maxavatarsize --value=$maxavatarsize ynh_app_setting_set --app=$app --key=maxitemsperpage --value=$maxitemsperpage #================================================= -# INSTALL FRONTEND +# INSTALL Vikunja #================================================= -ynh_script_progression --message="Setting up frontend..." --weight=1 +ynh_script_progression --message="Setting up source files..." --weight=1 # Download, check integrity, uncompress and patch the source from app.src -ynh_setup_source --dest_dir="$install_dir" --source_id="front" +ynh_setup_source --dest_dir="$install_dir" +executable="$(find $install_dir -name "vikunja-*" \! -name "*.sha256")" +mv "$executable" "$install_dir/vikunja" +chmod +x "$install_dir/vikunja" chmod -R o-rwx "$install_dir" chown -R $app:www-data "$install_dir" #================================================= -# INSTALL BACKEND +# ADD A CONFIGURATION #================================================= -ynh_script_progression --message="Setting up backend..." --weight=1 +ynh_script_progression --message="Adding a configuration file..." --weight=1 -# Download, check integrity, uncompress and patch the source from app.src -mkdir -p "$backend_path" -mkdir -p "$backend_path/files" -tempdir="$(mktemp -d)" -ynh_setup_source --dest_dir=$tempdir --source_id="back" -back="$(find $tempdir -name "vikunja-*" \! -name "*.sha256")" -cp "$back" "$backend_path/vikunja" +ynh_add_config --template="config.yml" --destination="$install_dir/config.yml" -chmod +x "$backend_path/vikunja" -chown -R $app:www-data "$backend_path/files" +chmod 400 "$install_dir/config.yml" +chown "$app:$app" "$install_dir/config.yml" #================================================= # SYSTEM CONFIGURATION @@ -81,23 +76,13 @@ ynh_add_systemd_config yunohost service add $app --description="Self-hosted To-Do list application" --log="/var/log/$app/$app.log" -#================================================= -# ADD A CONFIGURATION -#================================================= -ynh_script_progression --message="Adding a configuration file..." --weight=1 - -ynh_add_config --template="config.yml" --destination="$backend_path/config.yml" - -chmod 400 "$backend_path/config.yml" -chown $app:$app "$backend_path/config.yml" - #================================================= # START SYSTEMD SERVICE #================================================= -ynh_script_progression --message="Starting a systemd service..." --weight=2 +ynh_script_progression --message="Starting $app's systemd service..." --weight=2 # Start a systemd service -ynh_systemd_action --service_name=$app --action=start --log_path=systemd #--line_match="server started on" +ynh_systemd_action --service_name="$app" --action=start --log_path=systemd #--line_match="server started on" #================================================= # END OF SCRIPT diff --git a/scripts/remove b/scripts/remove index 0e09476..e63c3ec 100644 --- a/scripts/remove +++ b/scripts/remove @@ -12,7 +12,7 @@ source /usr/share/yunohost/helpers #================================================= # REMOVE SYSTEM CONFIGURATIONS #================================================= -# REMOVE SYSTEMD SERVICE +# REMOVE SYSTEMD SERVICE #================================================= ynh_script_progression --message="Removing system configurations related to $app..." --weight=1 @@ -28,9 +28,6 @@ ynh_remove_systemd_config ynh_redis_remove_db "$redis_db" -# Remove backend -ynh_secure_remove --file="$backend_path" - # Remove the dedicated NGINX config ynh_remove_nginx_config diff --git a/scripts/restore b/scripts/restore index 8e89323..72d6098 100644 --- a/scripts/restore +++ b/scripts/restore @@ -14,16 +14,10 @@ source /usr/share/yunohost/helpers #================================================= ynh_script_progression --message="Restoring $app main directory..." --weight=4 -# Frontend ynh_restore_file --origin_path="$install_dir" -chmod 750 "$install_dir" -chmod -R o-rwx "$install_dir" -chown -R $app:www-data "$install_dir" -# Backend -ynh_restore_file --origin_path="$backend_path" -chmod +x "$backend_path/vikunja" -chown -R $app:www-data "$backend_path/files" +chmod -R o-rwx "$install_dir" +chown -R "$app:www-data" "$install_dir" #================================================= # RESTORE THE POSTGRESQL DATABASE diff --git a/scripts/upgrade b/scripts/upgrade index 0ed8ea6..61c7ba1 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -17,71 +17,65 @@ timezone="$(cat /etc/timezone)" secret=$(ynh_string_random --length=32) redis_db=$(ynh_redis_get_free_db) -#================================================= -# CHECK VERSION -#================================================= - -upgrade_type=$(ynh_check_app_version_changed) - #================================================= # 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 + ynh_app_setting_set --app="$app" --key="set_motd" --value="$set_motd" fi if [ -z "${enable_registration:-}" ]; then enable_registration="true" - ynh_app_setting_set --app=$app --key=enable_registration --value=$enable_registration + ynh_app_setting_set --app="$app" --key="enable_registration" --value="$enable_registration" fi if [ -z "${enable_linksharing:-}" ]; then enable_linksharing="true" - ynh_app_setting_set --app=$app --key=enable_linksharing --value=$enable_linksharing + ynh_app_setting_set --app="$app" --key="enable_linksharing" --value="$enable_linksharing" fi if [ -z "${enable_taskattachments:-}" ]; then enable_taskattachments="true" - ynh_app_setting_set --app=$app --key=enable_taskattachments --value=$enable_taskattachments + ynh_app_setting_set --app="$app" --key="enable_taskattachments" --value="$enable_taskattachments" fi if [ -z "${enable_taskcomments:-}" ]; then enable_taskcomments="true" - ynh_app_setting_set --app=$app --key=enable_taskcomments --value=$enable_taskcomments + ynh_app_setting_set --app="$app" --key="enable_taskcomments" --value="$enable_taskcomments" fi if [ -z "${enable_emailreminders:-}" ]; then enable_emailreminders="true" - ynh_app_setting_set --app=$app --key=enable_emailreminders --value=$enable_emailreminders + ynh_app_setting_set --app="$app" --key="enable_emailreminders" --value="$enable_emailreminders" fi if [ -z "${enable_userdeletion:-}" ]; then enable_userdeletion="true" - ynh_app_setting_set --app=$app --key=enable_userdeletion --value=$enable_userdeletion + ynh_app_setting_set --app="$app" --key="enable_userdeletion" --value="$enable_userdeletion" fi if [ -z "${maxavatarsize:-}" ]; then maxavatarsize=1024 - ynh_app_setting_set --app=$app --key=maxavatarsize --value=$maxavatarsize + ynh_app_setting_set --app="$app" --key="maxavatarsize" --value="$maxavatarsize" fi if [ -z "${maxitemsperpage:-}" ]; then maxitemsperpage=50 - ynh_app_setting_set --app=$app --key=maxitemsperpage --value=$maxitemsperpage + ynh_app_setting_set --app="$app" --key="maxitemsperpage" --value="$maxitemsperpage" fi if [ -z "${language:-}" ]; then language="en" - ynh_app_setting_set --app=$app --key=language --value=$language + ynh_app_setting_set --app="$app" --key="language" --value="$language" +fi + +if ynh_compare_current_package_version --comparison lt --version "0.23.0~ynh1"; then + mv "$backend_path/config.yml" "$install_dir/config.yml" + ynh_secure_remove "$backend_path" + ynh_app_setting_delete --app="$app" --key="backend_path" fi #================================================= @@ -96,41 +90,31 @@ ynh_systemd_action --service_name=$app --action=stop --log_path=systemd #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= +ynh_script_progression --message="Upgrading source files..." --weight=5 -if [ "$upgrade_type" == "UPGRADE_APP" ] -then - ynh_script_progression --message="Upgrading source files..." --weight=5 +ynh_setup_source --dest_dir="$install_dir" +executable="$(find $install_dir -name "vikunja-*" \! -name "*.sha256")" +mv "$executable" "$install_dir/vikunja" - # Frontend - ynh_setup_source --dest_dir="$install_dir" --source_id="front" - - # Backend - mkdir -p "$backend_path/files" - tempdir="$(mktemp -d)" - ynh_setup_source --dest_dir=$tempdir --source_id="back" - back="$(find $tempdir -name "vikunja-*" \! -name "*.sha256")" - cp "$back" "$backend_path/vikunja" -fi +chmod +x "$install_dir/vikunja" chmod -R o-rwx "$install_dir" chown -R $app:www-data "$install_dir" -chmod +x "$backend_path/vikunja" -chown -R $app:www-data "$backend_path/files" #================================================= -# UPGRADE A CONFIGURATION +# UPDATE A CONFIG FILE #================================================= -ynh_script_progression --message="Upgrading a configuration file..." --weight=1 +ynh_script_progression --message="Updating $app's configuration files..." --weight=1 -ynh_add_config --template="config.yml" --destination="$backend_path/config.yml" +ynh_add_config --template="config.yml" --destination="$install_dir/config.yml" -chmod 400 "$backend_path/config.yml" -chown $app:$app "$backend_path/config.yml" +chmod 400 "$install_dir/config.yml" +chown $app:$app "$install_dir/config.yml" #================================================= -# NGINX CONFIGURATION +# REAPPLY SYSTEM CONFIGURATIONS #================================================= -ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=2 +ynh_script_progression --message="Upgrading system configurations related to $app..." --weight=1 ynh_add_nginx_config diff --git a/tests.toml b/tests.toml index 98df2e1..58b03fd 100644 --- a/tests.toml +++ b/tests.toml @@ -1,3 +1,5 @@ +#:schema https://raw.githubusercontent.com/YunoHost/apps/master/schemas/tests.v1.schema.json + test_format = 1.0 [default] @@ -12,4 +14,4 @@ test_format = 1.0 # Commits to test upgrade from # ------------------------------- - test_upgrade_from.4cf807ee10e609d85147ac389ea7f62260c733b2.name = "Upgrade from 0.20.2" + #test_upgrade_from.4cf807ee10e609d85147ac389ea7f62260c733b2.name = "Upgrade from 0.20.2"