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.
# 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

View file

@ -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;
}

View file

@ -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

View file

@ -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"

View file

@ -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"

View file

@ -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"
#=================================================

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -22,60 +22,60 @@ redis_db=$(ynh_redis_get_free_db)
#=================================================
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
#=================================================
@ -92,35 +92,29 @@ ynh_systemd_action --service_name=$app --action=stop --log_path=systemd
#=================================================
ynh_script_progression --message="Upgrading source files..." --weight=5
# Frontend
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"
# 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"
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

View file

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