1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/vikunja_ynh.git synced 2024-09-03 18:06:26 +02:00

Merge pull request #71 from CodeShakingSheep/v0.24

Fix single source installation
This commit is contained in:
eric_G 2024-07-29 23:07:38 +02:00 committed by GitHub
commit 7bed2368db
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 81 additions and 125 deletions

View file

@ -21,7 +21,7 @@ service:
# The base path on the file system where the binary and assets are. # 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 # 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. # 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. # 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: "" staticpath: ""
# The max number of items which can be returned per page # The max number of items which can be returned per page

View file

@ -1,18 +1,9 @@
#sub_path_only rewrite ^__PATH__$ __PATH__/ permanent; #sub_path_only rewrite ^__PATH__$ __PATH__/ permanent;
location __PATH__/ { location __PATH__/ {
# Path to source proxy_pass http://127.0.0.1:__PORT__;
alias __INSTALL_DIR__/; client_max_body_size 20M;
try_files $uri $uri/ /;
index index.html index.htm;
# Include SSOWAT user panel. # Include SSOWAT user panel.
include conf.d/yunohost_panel.conf.inc; 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;
}

View file

@ -7,8 +7,8 @@ Requires=postgresql.service redis.service
Type=simple Type=simple
User=__APP__ User=__APP__
Group=__APP__ Group=__APP__
WorkingDirectory=/opt/__APP__/ WorkingDirectory=__INSTALL_DIR__/
ExecStart=/opt/__APP__/vikunja ExecStart=__INSTALL_DIR__/vikunja
RestartSec=2s RestartSec=2s
Restart=always Restart=always

View file

@ -13,7 +13,7 @@ services = ["__APP__"]
ask.fr = "Définir le MOTD" ask.fr = "Définir le MOTD"
type = "string" type = "string"
help = "Set the MOTD message shown in Vikunja login page" 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] [main.config.enable_registration]
ask.en = "Enable registration" ask.en = "Enable registration"
@ -22,7 +22,7 @@ services = ["__APP__"]
yes = "true" yes = "true"
no = "false" no = "false"
help = "Whether to let new users registering themselves or not" 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] [main.config.enable_linksharing]
ask.en = "Enable links sharing" ask.en = "Enable links sharing"
@ -31,7 +31,7 @@ services = ["__APP__"]
yes = "true" yes = "true"
no = "false" no = "false"
help = "Enable sharing of lists via a link" 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] [main.config.enable_taskattachments]
ask.en = "Enable tasks attachments" ask.en = "Enable tasks attachments"
@ -40,7 +40,7 @@ services = ["__APP__"]
yes = "true" yes = "true"
no = "false" no = "false"
help = "Whether to enable task attachments or not" 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] [main.config.enable_taskcomments]
ask.en = "Enable task comments" ask.en = "Enable task comments"
@ -49,7 +49,7 @@ services = ["__APP__"]
yes = "true" yes = "true"
no = "false" no = "false"
help = "Whether task comments should be enabled or not" 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] [main.config.enable_emailreminders]
ask.en = "Enable email reminders" ask.en = "Enable email reminders"
@ -58,7 +58,7 @@ services = ["__APP__"]
yes = "true" yes = "true"
no = "false" 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." 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] [main.config.enable_userdeletion]
ask.en = "Enable user deletion" ask.en = "Enable user deletion"
@ -67,19 +67,19 @@ services = ["__APP__"]
yes = "true" yes = "true"
no = "false" 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" 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] [main.config.maxavatarsize]
ask.en = "Max avatar size" ask.en = "Max avatar size"
ask.fr = "Taille maximum de l'avatar" ask.fr = "Taille maximum de l'avatar"
type = "number" 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" 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] [main.config.maxitemsperpage]
ask.en = "Max items per page" ask.en = "Max items per page"
ask.fr = "Nombre d'éléments maximum par page" ask.fr = "Nombre d'éléments maximum par page"
type = "number" type = "number"
help = "The max number of items which can be returned per page" 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"

View file

@ -1,3 +1,5 @@
#:schema https://raw.githubusercontent.com/YunoHost/apps/master/schemas/manifest.v2.schema.json
packaging_format = 2 packaging_format = 2
id = "vikunja" id = "vikunja"
@ -46,26 +48,23 @@ ram.runtime = "50M"
[resources] [resources]
[resources.sources] [resources.sources]
[resources.sources.back] [resources.sources.main]
arm64.url = "https://dl.vikunja.io/api/0.22.1/vikunja-v0.22.1-linux-arm64-full.zip" arm64.url = "https://dl.vikunja.io/vikunja/0.24.1/vikunja-v0.24.1-linux-arm64-full.zip"
arm64.sha256 = "50a1670c0fde858c1cd7bc72cc670c4011a688a20b07ee62fab11bcca3eab01e" arm64.sha256 = "6642be9e0822ac8086c76823a2c090257f9cd5cacc2fd349ed12af520478ce55"
amd64.url = "https://dl.vikunja.io/api/0.22.1/vikunja-v0.22.1-linux-amd64-full.zip" amd64.url = "https://dl.vikunja.io/vikunja/0.24.1/vikunja-v0.24.1-linux-amd64-full.zip"
amd64.sha256 = "c3e21ca5ccace3f9eaa423bab8c1cfc3e7de15d5c593db0aa6e4dbd9883469e6" amd64.sha256 = "62a5e936c7dc193fc0a2db46767ea015f2e45a06fd0e40b5b0918b05bfb2d1ff"
armhf.url = "https://dl.vikunja.io/api/0.22.1/vikunja-v0.22.1-linux-arm-7-full.zip" armhf.url = "https://dl.vikunja.io/vikunja/0.24.1/vikunja-v0.24.1-linux-arm-7-full.zip"
armhf.sha256 = "72f50404df57d75060bdd0d162e12cba20269a0def7b38993e1b61c4cf3d69d2" armhf.sha256 = "f7ff14b789376fd4cd41e331e6bd399538a64626891bd77f14258b3fec901346"
i386.url = "https://dl.vikunja.io/api/0.22.1/vikunja-v0.22.1-linux-386-full.zip" i386.url = "https://dl.vikunja.io/vikunja/0.24.1/vikunja-v0.24.1-linux-386-full.zip"
i386.sha256 = "de1e271b6d3fe6024b790b95c1bf946a415598b31192638ef85589cd2c35f996" i386.sha256 = "a552c4e031cbe4f69b13636d326f4bfa525905211469e615e51bd6d8cc85f923"
in_subdir = false in_subdir = false
format = "zip" format = "zip"
[resources.sources.front] autoupdate.strategy = "latest_gitea_release"
url = "https://dl.vikunja.io/frontend/vikunja-frontend-0.24.1.zip" autoupdate.asset.amd64 = "tarball"
sha256 = "2278ba1d7f50bf656a771378a7a47434730496fe1867d4d4964020a2e7a713ff" autoupdate.asset.i386 = "tarball"
in_subdir = false autoupdate.asset.arm64 = "tarball"
format = "zip" autoupdate.asset.armhf = "tarball"
[resources.ports]
[resources.system_user] [resources.system_user]
allow_email = true allow_email = true
@ -79,6 +78,8 @@ ram.runtime = "50M"
api.allowed = "visitors" api.allowed = "visitors"
api.auth_header = false api.auth_header = false
[resources.ports]
[resources.apt] [resources.apt]
packages = "postgresql" packages = "postgresql"

View file

@ -18,22 +18,14 @@ ynh_print_info --message="Declaring files to be backed up..."
# BACKUP THE APP MAIN DIR # BACKUP THE APP MAIN DIR
#================================================= #=================================================
# Frontend
ynh_backup --src_path="$install_dir" 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" 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"
#================================================= #=================================================

View file

@ -40,9 +40,9 @@ ynh_script_progression --message="Adding a configuration file..." --weight=1
domain="$new_domain" domain="$new_domain"
path="$new_path" 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 # GENERIC FINALISATION

View file

@ -16,7 +16,6 @@ source /usr/share/yunohost/helpers
timezone="$(cat /etc/timezone)" timezone="$(cat /etc/timezone)"
secret=$(ynh_string_random --length=32) secret=$(ynh_string_random --length=32)
redis_db=$(ynh_redis_get_free_db) redis_db=$(ynh_redis_get_free_db)
backend_path=/opt/$app
set_motd="" set_motd=""
enable_registration="true" enable_registration="true"
@ -32,7 +31,6 @@ maxitemsperpage=50
# STORE SETTINGS FROM MANIFEST # 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=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_registration --value=$enable_registration
ynh_app_setting_set --app=$app --key=enable_linksharing --value=$enable_linksharing 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 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 # 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" chmod -R o-rwx "$install_dir"
chown -R $app:www-data "$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 ynh_add_config --template="config.yml" --destination="$install_dir/config.yml"
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"
chmod +x "$backend_path/vikunja" chmod 400 "$install_dir/config.yml"
chown -R $app:www-data "$backend_path/files" chown "$app:$app" "$install_dir/config.yml"
#================================================= #=================================================
# SYSTEM CONFIGURATION # 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" 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 # 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 # 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 # END OF SCRIPT

View file

@ -28,9 +28,6 @@ ynh_remove_systemd_config
ynh_redis_remove_db "$redis_db" ynh_redis_remove_db "$redis_db"
# Remove backend
ynh_secure_remove --file="$backend_path"
# Remove the dedicated NGINX config # Remove the dedicated NGINX config
ynh_remove_nginx_config ynh_remove_nginx_config

View file

@ -14,16 +14,10 @@ source /usr/share/yunohost/helpers
#================================================= #=================================================
ynh_script_progression --message="Restoring $app main directory..." --weight=4 ynh_script_progression --message="Restoring $app main directory..." --weight=4
# Frontend
ynh_restore_file --origin_path="$install_dir" 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 chmod -R o-rwx "$install_dir"
ynh_restore_file --origin_path="$backend_path" chown -R "$app:www-data" "$install_dir"
chmod +x "$backend_path/vikunja"
chown -R $app:www-data "$backend_path/files"
#================================================= #=================================================
# RESTORE THE POSTGRESQL DATABASE # RESTORE THE POSTGRESQL DATABASE

View file

@ -22,60 +22,60 @@ redis_db=$(ynh_redis_get_free_db)
#================================================= #=================================================
ynh_script_progression --message="Ensuring downward compatibility..." --weight=1 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 if [ -z "${set_motd:-}" ]; then
set_motd="" 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 fi
if [ -z "${enable_registration:-}" ]; then if [ -z "${enable_registration:-}" ]; then
enable_registration="true" 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 fi
if [ -z "${enable_linksharing:-}" ]; then if [ -z "${enable_linksharing:-}" ]; then
enable_linksharing="true" 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 fi
if [ -z "${enable_taskattachments:-}" ]; then if [ -z "${enable_taskattachments:-}" ]; then
enable_taskattachments="true" 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 fi
if [ -z "${enable_taskcomments:-}" ]; then if [ -z "${enable_taskcomments:-}" ]; then
enable_taskcomments="true" 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 fi
if [ -z "${enable_emailreminders:-}" ]; then if [ -z "${enable_emailreminders:-}" ]; then
enable_emailreminders="true" 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 fi
if [ -z "${enable_userdeletion:-}" ]; then if [ -z "${enable_userdeletion:-}" ]; then
enable_userdeletion="true" 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 fi
if [ -z "${maxavatarsize:-}" ]; then if [ -z "${maxavatarsize:-}" ]; then
maxavatarsize=1024 maxavatarsize=1024
ynh_app_setting_set --app=$app --key=maxavatarsize --value=$maxavatarsize ynh_app_setting_set --app="$app" --key="maxavatarsize" --value="$maxavatarsize"
fi fi
if [ -z "${maxitemsperpage:-}" ]; then if [ -z "${maxitemsperpage:-}" ]; then
maxitemsperpage=50 maxitemsperpage=50
ynh_app_setting_set --app=$app --key=maxitemsperpage --value=$maxitemsperpage ynh_app_setting_set --app="$app" --key="maxitemsperpage" --value="$maxitemsperpage"
fi fi
if [ -z "${language:-}" ]; then if [ -z "${language:-}" ]; then
language="en" 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 fi
#================================================= #=================================================
@ -92,35 +92,29 @@ ynh_systemd_action --service_name=$app --action=stop --log_path=systemd
#================================================= #=================================================
ynh_script_progression --message="Upgrading source files..." --weight=5 ynh_script_progression --message="Upgrading source files..." --weight=5
# Frontend ynh_setup_source --dest_dir="$install_dir"
ynh_setup_source --dest_dir="$install_dir" --source_id="front" executable="$(find $install_dir -name "vikunja-*" \! -name "*.sha256")"
mv "$executable" "$install_dir/vikunja"
# Backend chmod +x "$install_dir/vikunja"
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"
chmod -R o-rwx "$install_dir" chmod -R o-rwx "$install_dir"
chown -R $app:www-data "$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" chmod 400 "$install_dir/config.yml"
chown $app:$app "$backend_path/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 ynh_add_nginx_config

View file

@ -1,3 +1,5 @@
#:schema https://raw.githubusercontent.com/YunoHost/apps/master/schemas/tests.v1.schema.json
test_format = 1.0 test_format = 1.0
[default] [default]