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 #24 from YunoHost-Apps/testing

Testing
This commit is contained in:
Éric Gaspar 2022-02-21 14:05:45 +01:00 committed by GitHub
commit 5fc1e58646
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 64 additions and 43 deletions

View file

@ -26,7 +26,7 @@ Vikunja is a self-hosted open-source to-do list application for all platforms.
- CalDAV - CalDAV
- Links - Links
**Shipped version:** 0.18.2~ynh1 **Shipped version:** 0.18.2~ynh2
**Demo:** https://try.vikunja.io/login **Demo:** https://try.vikunja.io/login

View file

@ -22,7 +22,7 @@ Vikunja est une application de liste de tâches Open Source auto-hébergée pour
- CalDAV - CalDAV
- Links - Links
**Version incluse :** 0.18.2~ynh1 **Version incluse :** 0.18.2~ynh2
**Démo :** https://try.vikunja.io/login **Démo :** https://try.vikunja.io/login

7
conf/amd64.src Normal file
View file

@ -0,0 +1,7 @@
SOURCE_URL=https://dl.vikunja.io/api/0.18.1/vikunja-v0.18.1-linux-amd64-full
SOURCE_SUM=fd259ae3c717bea715e96d0806ac08f2bd462068277ab2b62ebee36fe946f0e2
SOURCE_SUM_PRG=sha256sum
SOURCE_IN_SUBDIR=false
SOURCE_FORMAT=zip
SOURCE_FILENAME=vikunja
SOURCE_EXTRACT=true

View file

@ -1,7 +0,0 @@
SOURCE_URL=https://dl.vikunja.io/api/0.18.1/vikunja-unstable-amd64.deb
SOURCE_SUM=3bf5d1109727b37b461840e0bc8b60dc86dc569655551e6485c8dbe7b6de5ddb
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=deb
SOURCE_IN_SUBDIR=true
SOURCE_FILENAME=vikunja-unstable-amd64.deb
SOURCE_EXTRACT=false

7
conf/arm64.src Normal file
View file

@ -0,0 +1,7 @@
SOURCE_URL=https://dl.vikunja.io/api/0.18.1/vikunja-v0.18.1-linux-arm64-full
SOURCE_SUM=c54c6d70b348c1697ff8519d522f2b1e3c58ffb4401ac1f4c2e729913b392a27
SOURCE_SUM_PRG=sha256sum
SOURCE_IN_SUBDIR=false
SOURCE_FORMAT=zip
SOURCE_FILENAME=vikunja
SOURCE_EXTRACT=true

7
conf/armhf.src Normal file
View file

@ -0,0 +1,7 @@
SOURCE_URL=https://dl.vikunja.io/api/0.18.1/vikunja-v0.18.1-linux-arm-7-full
SOURCE_SUM=79548e506538319f8aab07a5630c3c2032906b34386a83c26d1a6cfc9993b39c
SOURCE_SUM_PRG=sha256sum
SOURCE_IN_SUBDIR=false
SOURCE_FORMAT=zip
SOURCE_FILENAME=vikunja
SOURCE_EXTRACT=true

View file

@ -44,7 +44,7 @@ database:
# Database type to use. Supported types are mysql, postgres and sqlite. # Database type to use. Supported types are mysql, postgres and sqlite.
type: "postgres" type: "postgres"
# Database user which is used to connect to the database. # Database user which is used to connect to the database.
user: "__DB_NAME__" user: "__DB_USER__"
# Database password # Database password
password: "__DB_PWD__" password: "__DB_PWD__"
# Database host # Database host

View file

@ -6,7 +6,7 @@
"en": "Self-hosted To-Do list application", "en": "Self-hosted To-Do list application",
"fr": "Application de liste de tâches auto-hébergée" "fr": "Application de liste de tâches auto-hébergée"
}, },
"version": "0.18.2~ynh1", "version": "0.18.2~ynh2",
"url": "https://vikunja.io/", "url": "https://vikunja.io/",
"upstream": { "upstream": {
"license": "GPL-3.0", "license": "GPL-3.0",

View file

@ -36,8 +36,13 @@ 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="$final_path" ynh_backup --src_path="$final_path"
# Config
ynh_backup --src_path="/etc/vikunja/config.yml" ynh_backup --src_path="/etc/vikunja/config.yml"
# Backend
ynh_backup --src_path="/opt/vikunja" ynh_backup --src_path="/opt/vikunja"
#================================================= #=================================================

View file

@ -25,6 +25,7 @@ path_url="/"
is_public=$YNH_APP_ARG_IS_PUBLIC is_public=$YNH_APP_ARG_IS_PUBLIC
timezone="$(cat /etc/timezone)" timezone="$(cat /etc/timezone)"
secret=$(ynh_string_random --length=32) secret=$(ynh_string_random --length=32)
architecture=$YNH_ARCH
app=$YNH_APP_INSTANCE_NAME app=$YNH_APP_INSTANCE_NAME
@ -39,8 +40,6 @@ ynh_script_progression --message="Validating installation parameters..." --weigh
final_path=/var/www/$app final_path=/var/www/$app
test ! -e "$final_path" || ynh_die --message="This path already contains a folder" test ! -e "$final_path" || ynh_die --message="This path already contains a folder"
mkdir -p "/etc/vikunja"
# Register (book) web path # Register (book) web path
ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url
@ -86,14 +85,15 @@ ynh_system_user_create --username=$app --home_dir=$final_path
ynh_script_progression --message="Creating a PostgreSQL database..." --weight=2 ynh_script_progression --message="Creating a PostgreSQL database..." --weight=2
db_name=$(ynh_sanitize_dbid --db_name=$app) db_name=$(ynh_sanitize_dbid --db_name=$app)
db_user=$db_name
ynh_app_setting_set --app=$app --key=db_name --value=$db_name ynh_app_setting_set --app=$app --key=db_name --value=$db_name
ynh_psql_test_if_first_run ynh_psql_test_if_first_run
ynh_psql_setup_db --db_user=$db_name --db_name=$db_name ynh_psql_setup_db --db_user=$db_user --db_name=$db_name
#================================================= #=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE # INSTALL FRONTEND
#================================================= #=================================================
ynh_script_progression --message="Setting up source files..." --weight=1 ynh_script_progression --message="Setting up frontend..." --weight=1
ynh_app_setting_set --app=$app --key=final_path --value=$final_path ynh_app_setting_set --app=$app --key=final_path --value=$final_path
# Download, check integrity, uncompress and patch the source from app.src # Download, check integrity, uncompress and patch the source from app.src
@ -106,13 +106,15 @@ chown -R $app:www-data "$final_path"
#================================================= #=================================================
# INSTALL BACKEND # INSTALL BACKEND
#================================================= #=================================================
ynh_script_progression --message="Installing backend..." --weight=15 ynh_script_progression --message="Setting up backend..." --weight=1
tempdir="$(mktemp -d)"
ynh_setup_source --dest_dir=$tempdir --source_id=api
ynh_exec_warn_less dpkg -i $tempdir/vikunja-unstable-amd64.deb
# Download, check integrity, uncompress and patch the source from app.src
mkdir -p "/opt/vikunja"
mkdir -p "/opt/vikunja/files" mkdir -p "/opt/vikunja/files"
tempdir="$(mktemp -d)"
ynh_setup_source --dest_dir=$tempdir --source_id="$architecture"
back="$(find $tempdir -name "vikunja-*" \! -name "*.sha256")"
cp "$back" "/opt/vikunja/vikunja"
chmod +x "/opt/vikunja/vikunja" chmod +x "/opt/vikunja/vikunja"
chown -R $app:www-data "/opt/vikunja/files" chown -R $app:www-data "/opt/vikunja/files"
@ -130,8 +132,10 @@ ynh_add_nginx_config
#================================================= #=================================================
ynh_script_progression --message="Adding a configuration file..." --weight=1 ynh_script_progression --message="Adding a configuration file..." --weight=1
mkdir -p "/etc/vikunja"
redis_db=$(ynh_redis_get_free_db) redis_db=$(ynh_redis_get_free_db)
ynh_add_config --template="../conf/config.yml" --destination="/etc/vikunja/config.yml" ynh_add_config --template="../conf/config.yml" --destination="/etc/vikunja/config.yml"
chmod 400 "/etc/vikunja/config.yml" chmod 400 "/etc/vikunja/config.yml"
chown $app:$app "/etc/vikunja/config.yml" chown $app:$app "/etc/vikunja/config.yml"
@ -155,7 +159,7 @@ yunohost service add $app --description="Self-hosted To-Do list application" --l
ynh_script_progression --message="Starting a systemd service..." --weight=2 ynh_script_progression --message="Starting a 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"
#================================================= #=================================================
# SETUP SSOWAT # SETUP SSOWAT

View file

@ -58,7 +58,6 @@ ynh_script_progression --message="Removing dependencies..." --weight=1
# Remove metapackage and its dependencies # Remove metapackage and its dependencies
ynh_remove_app_dependencies ynh_remove_app_dependencies
dpkg --purge vikunja
#================================================= #=================================================
# REMOVE THE REDIS DATABASE # REMOVE THE REDIS DATABASE
@ -74,7 +73,6 @@ ynh_script_progression --message="Removing $app main directory..." --weight=6
# Remove the app directory securely # Remove the app directory securely
ynh_secure_remove --file="$final_path" ynh_secure_remove --file="$final_path"
#ynh_secure_remove --file="/etc/vikunja"
#================================================= #=================================================
# REMOVE NGINX CONFIGURATION # REMOVE NGINX CONFIGURATION
@ -94,6 +92,14 @@ ynh_script_progression --message="Removing the dedicated system user..." --weigh
# Delete a system user # Delete a system user
ynh_system_user_delete --username=$app ynh_system_user_delete --username=$app
#=================================================
# REMOVE BACKEND
#=================================================
ynh_script_progression --message="Removing backend..." --weight=1
# Delete /opt/vikunja
ynh_secure_remove --file="/opt/vikunja"
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT
#================================================= #=================================================

View file

@ -59,14 +59,16 @@ ynh_system_user_create --username=$app --home_dir="$final_path"
#================================================= #=================================================
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="$final_path" ynh_restore_file --origin_path="$final_path"
chmod 750 "$final_path" chmod 750 "$final_path"
chmod -R o-rwx "$final_path" chmod -R o-rwx "$final_path"
chown -R $app:www-data "$final_path" chown -R $app:www-data "$final_path"
# Config
ynh_restore_file --origin_path="/etc/vikunja/config.yml" ynh_restore_file --origin_path="/etc/vikunja/config.yml"
# Backend
ynh_restore_file --origin_path="/opt/vikunja" ynh_restore_file --origin_path="/opt/vikunja"
chmod +x "/opt/vikunja/vikunja" chmod +x "/opt/vikunja/vikunja"
chown -R $app:www-data "/opt/vikunja/files" chown -R $app:www-data "/opt/vikunja/files"

View file

@ -25,6 +25,7 @@ db_user=$db_name
db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd) db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd)
timezone="$(cat /etc/timezone)" timezone="$(cat /etc/timezone)"
secret=$(ynh_string_random --length=32) secret=$(ynh_string_random --length=32)
architecture=$YNH_ARCH
set_motd=$(ynh_app_setting_get --app=$app --key=set_motd) set_motd=$(ynh_app_setting_get --app=$app --key=set_motd)
enable_registration=$(ynh_app_setting_get --app=$app --key=enable_registration) enable_registration=$(ynh_app_setting_get --app=$app --key=enable_registration)
@ -99,19 +100,18 @@ ynh_system_user_create --username=$app --home_dir="$final_path"
if [ "$upgrade_type" == "UPGRADE_APP" ] if [ "$upgrade_type" == "UPGRADE_APP" ]
then then
ynh_script_progression --message="Installing backend..." --weight=5
tempdir="$(mktemp -d)"
ynh_setup_source --dest_dir=$tempdir --source_id=api
ynh_exec_warn_less N | dpkg -i $tempdir/vikunja-unstable-amd64.deb
ynh_script_progression --message="Upgrading source files..." --weight=5 ynh_script_progression --message="Upgrading source files..." --weight=5
# Download, check integrity, uncompress and patch the source from app.src # Download, check integrity, uncompress and patch the source from app.src
# Frontend
ynh_setup_source --dest_dir="$final_path" --source_id="front" --keep="/etc/vikunja/config.yml" ynh_setup_source --dest_dir="$final_path" --source_id="front" --keep="/etc/vikunja/config.yml"
# Backend
mkdir -p "/opt/vikunja/files" mkdir -p "/opt/vikunja/files"
tempdir="$(mktemp -d)"
ynh_setup_source --dest_dir=$tempdir --source_id="$architecture"
back="$(find $tempdir -name "vikunja-*" \! -name "*.sha256")"
cp "$back" "/opt/vikunja/vikunja"
fi fi
chmod 750 "$final_path" chmod 750 "$final_path"
@ -120,16 +120,6 @@ chown -R $app:www-data "$final_path"
chmod +x "/opt/vikunja/vikunja" chmod +x "/opt/vikunja/vikunja"
chown -R $app:www-data "/opt/vikunja/files" chown -R $app:www-data "/opt/vikunja/files"
#=================================================
# ADD A CONFIGURATION
#=================================================
#ynh_script_progression --message="Adding a configuration file..." --weight=1
# redis_db=$(ynh_redis_get_free_db)
# ynh_add_config --template="../conf/config.yml" --destination="/etc/vikunja/config.yml"
#chmod 600 "/etc/vikunja/config.yml"
#================================================= #=================================================
# NGINX CONFIGURATION # NGINX CONFIGURATION
#================================================= #=================================================