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

Finalize and fix packaging v2

This commit is contained in:
Salamandar 2024-01-27 12:41:53 +01:00
parent c1f09c29c6
commit edd77196c2
8 changed files with 65 additions and 67 deletions

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 = "emoncms" id = "emoncms"
@ -41,15 +43,18 @@ ram.runtime = "50M"
[resources] [resources]
[resources.sources] [resources.sources]
[resources.sources.main]
url = "https://github.com/emoncms/emoncms/archive/refs/tags/11.4.2.tar.gz"
sha256 = "a8ee0c1d37ca5d9a192dffcd11ca6e77c505b4a4100bd71b1ea00755d0dc3ecb"
autoupdate.strategy = "latest_github_tag"
autoupdate.asset = "tarball"
[resources.sources.main] [resources.sources.graph]
url = "https://github.com/emoncms/emoncms/archive/refs/tags/11.4.2.tar.gz" url = "https://github.com/emoncms/graph/archive/refs/tags/2.2.3.tar.gz"
sha256 = "a8ee0c1d37ca5d9a192dffcd11ca6e77c505b4a4100bd71b1ea00755d0dc3ecb" sha256 = "a110e881638a07e82b23a5d8df860b49af1e067eb98f4e93a8bad8aebc4ec882"
in_subdir = false
[resources.sources.graph] autoupdate.strategy = "latest_github_tag"
url = "https://github.com/emoncms/graph/archive/refs/tags/2.2.3.tar.gz" autoupdate.asset = "tarball"
sha256 = "a110e881638a07e82b23a5d8df860b49af1e067eb98f4e93a8bad8aebc4ec882"
in_subdir = false
[resources.system_user] [resources.system_user]
allow_email = true allow_email = true
@ -62,7 +67,12 @@ ram.runtime = "50M"
main.url = "/" main.url = "/"
[resources.apt] [resources.apt]
main.url = "mariadb-server, php8.0-fpm, php8.0-redis, php8.0-mysql" packages = [
"mariadb-server",
"php8.0-fpm",
"php8.0-redis",
"php8.0-mysql",
]
[resources.database] [resources.database]
type = "mysql" type = "mysql"

View file

@ -9,6 +9,10 @@
source _common.sh source _common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
#=================================================
# INITIALIZE AND STORE SETTINGS
#=================================================
email=$(ynh_user_get_info --username=$admin --key=mail) email=$(ynh_user_get_info --username=$admin --key=mail)
#================================================= #=================================================
@ -21,16 +25,7 @@ ynh_setup_source --dest_dir="$install_dir"
ynh_setup_source --dest_dir="$install_dir/Modules" --source_id="graph" ynh_setup_source --dest_dir="$install_dir/Modules" --source_id="graph"
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"
#=================================================
# PHP-FPM CONFIGURATION
#=================================================
ynh_script_progression --message="Configuring PHP-FPM..." --weight=2
ynh_add_fpm_config
ynh_add_nginx_config
#================================================= #=================================================
# ADD A CONFIGURATION # ADD A CONFIGURATION
@ -40,7 +35,16 @@ ynh_script_progression --message="Adding a configuration file..." --weight=1
ynh_add_config --template="example.settings.ini" --destination="$install_dir/settings.ini" ynh_add_config --template="example.settings.ini" --destination="$install_dir/settings.ini"
chmod 400 "$install_dir/settings.ini" chmod 400 "$install_dir/settings.ini"
chown $app:$app "$install_dir/settings.ini" chown "$app:$app" "$install_dir/settings.ini"
#=================================================
# SYSTEM CONFIGURATION
#=================================================
ynh_script_progression --message="Adding system configurations related to $app..." --weight=1
ynh_add_fpm_config
ynh_add_nginx_config
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT

View file

@ -10,9 +10,9 @@ source _common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
#================================================= #=================================================
# REMOVE NGINX CONFIGURATION # REMOVE SYSTEM CONFIGURATIONS
#================================================= #=================================================
ynh_script_progression --message="Removing NGINX web server configuration..." --weight=1 ynh_script_progression --message="Removing system configurations related to $app..." --weight=1
ynh_remove_nginx_config ynh_remove_nginx_config

View file

@ -18,7 +18,16 @@ ynh_script_progression --message="Restoring the app main directory..." --weight=
ynh_restore_file --origin_path="$install_dir" ynh_restore_file --origin_path="$install_dir"
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"
#=================================================
# RESTORE THE DATA DIRECTORY
#=================================================
ynh_script_progression --message="Restoring the data directory..." --weight=1
ynh_restore_file --origin_path="$data_dir" --not_mandatory
chown -R "$app:www-data" "$data_dir"
#================================================= #=================================================
# RESTORE THE MYSQL DATABASE # RESTORE THE MYSQL DATABASE
@ -28,13 +37,9 @@ ynh_script_progression --message="Restoring the MySQL database..." --weight=1
ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql
#================================================= #=================================================
# RESTORE THE DATA DIRECTORY # RESTORE SYSTEM CONFIGURATIONS
#================================================= #=================================================
ynh_script_progression --message="Restoring the data directory..." --weight=1 ynh_script_progression --message="Restoring system configurations related to $app..." --weight=1
ynh_restore_file --origin_path="$data_dir" --not_mandatory
chown -R $app:www-data "$data_dir"
ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf" ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
@ -47,7 +52,7 @@ ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#================================================= #=================================================
ynh_script_progression --message="Reloading NGINX web server and PHP-FPM..." --weight=1 ynh_script_progression --message="Reloading NGINX web server and PHP-FPM..." --weight=1
ynh_systemd_action --service_name=php$phpversion-fpm --action=reload ynh_systemd_action --service_name="php$phpversion-fpm" --action=reload
ynh_systemd_action --service_name=nginx --action=reload ynh_systemd_action --service_name=nginx --action=reload
#================================================= #=================================================

View file

@ -9,43 +9,15 @@
source _common.sh source _common.sh
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
#=================================================
# CHECK VERSION
#=================================================
upgrade_type=$(ynh_check_app_version_changed)
#=================================================
# STANDARD UPGRADE STEPS
#=================================================
# STOP SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Stopping a systemd service..." --weight=1
ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app/$app.log"
#================================================= #=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE # DOWNLOAD, CHECK AND UNPACK SOURCE
#================================================= #=================================================
ynh_script_progression --message="Upgrading source files..." --weight=1
if [ "$upgrade_type" == "UPGRADE_APP" ] ynh_setup_source --dest_dir="$install_dir" --full_replace=1 --keep="settings.ini"
then
ynh_script_progression --message="Upgrading source files..." --weight=1
ynh_setup_source --dest_dir="$install_dir" --keep="settings.ini"
fi
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"
#=================================================
# PHP-FPM CONFIGURATION
#=================================================
ynh_script_progression --message="Upgrading PHP-FPM configuration..." --weight=1
ynh_add_fpm_config
ynh_add_nginx_config
#================================================= #=================================================
# UPDATE A CONFIG FILE # UPDATE A CONFIG FILE
@ -55,7 +27,16 @@ ynh_script_progression --message="Updating a configuration file..." --weight=1
ynh_add_config --template="example.settings.ini" --destination="$install_dir/settings.ini" ynh_add_config --template="example.settings.ini" --destination="$install_dir/settings.ini"
chmod 400 "$install_dir/settings.ini" chmod 400 "$install_dir/settings.ini"
chown $app:$app "$install_dir/settings.ini" chown "$app:$app" "$install_dir/settings.ini"
#=================================================
# REAPPLY SYSTEM CONFIGURATIONS
#=================================================
ynh_script_progression --message="Upgrading system configurations related to $app..." --weight=1
ynh_add_fpm_config
ynh_add_nginx_config
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT

View file

@ -1,2 +0,0 @@
*~
*.sw[op]

View file

@ -1,2 +0,0 @@
*~
*.sw[op]

View file

@ -1,7 +1,9 @@
#:schema https://raw.githubusercontent.com/YunoHost/apps/master/schemas/tests.v1.schema.json
test_format = 1.0 test_format = 1.0
[default] [default]
# ------------ # ------------
# Tests to run # Tests to run
# ------------ # ------------