diff --git a/issue_template.md b/.github/ISSUE_TEMPLATE.md similarity index 94% rename from issue_template.md rename to .github/ISSUE_TEMPLATE.md index f1d47b2..2729a6b 100644 --- a/issue_template.md +++ b/.github/ISSUE_TEMPLATE.md @@ -8,7 +8,7 @@ about: When creating a bug report, please use the following template to provide 1. *Read this whole template first.* 2. *Determine if you are on the right place:* - *If you were performing an action on the app from the webadmin or the CLI (install, update, backup, restore, change_url...), you are on the right place!* - - *Otherwise, the issue may be due to Metabase itself. Refer to its documentation or repository for help.* + - *Otherwise, the issue may be due to the app itself. Refer to its documentation or repository for help.* - *When in doubt, post here and we will figure it out together.* 3. *Delete the italic comments as you write over them below, and remove this guide.* --- @@ -31,7 +31,7 @@ about: When creating a bug report, please use the following template to provide - *If you performed a command from the CLI, the command itself is enough. For example:* ```sh - sudo yunohost app install metabase + sudo yunohost app install the_app ``` - *If you used the webadmin, please perform the equivalent command from the CLI first.* - *If the error occurs in your browser, explain what you did:* diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 0000000..ef70e18 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,16 @@ +## Problem + +- *Description of why you made this PR* + +## Solution + +- *And how do you fix that problem* + +## PR Status + +- [ ] Code finished and ready to be reviewed/tested +- [ ] The fix/enhancement were manually tested (if applicable) + +## Automatic tests + +Automatic tests can be triggered on https://ci-apps-dev.yunohost.org/ *after creating the PR*, by commenting "!testme", "!gogogadgetoci" or "By the power of systemd, I invoke The Great App CI to test this Pull Request!". (N.B. : for this to work you need to be a member of the Yunohost-Apps organization) diff --git a/README.md b/README.md index d7a7e8c..2cca1ff 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,8 @@ + + # Metabase for YunoHost [![Integration level](https://dash.yunohost.org/integration/metabase.svg)](https://dash.yunohost.org/appci/app/metabase) ![](https://ci-apps.yunohost.org/ci/badges/metabase.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/metabase.maintain.svg) @@ -5,48 +10,29 @@ *[Lire ce readme en français.](./README_fr.md)* -> *This package allows you to install Metabase quickly and simply on a YunoHost server. +> *This package allows you to install Metabase quickly and simply on a YunoHost server. If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/install) to learn how to install it.* ## Overview -Metabase is the easy, open source way for everyone in your company to ask questions and learn from data. -**Shipped version:** 0.40.1 +Web database management tool + +**Shipped version:** 0.40.2~ynh1 + + ## Screenshots -![](https://raw.githubusercontent.com/metabase/metabase/master/docs/metabase-product-screenshot.png) +![](./doc/screenshots/metabase-product-screenshot.png) -## Demo +## Documentation and resources -* [Official demo]() - -## Documentation - - * Official documentation: https://www.metabase.com/docs/latest/ - -#### Multi-user support - -* Are LDAP and HTTP auth supported? **No** -* Can the app be used by multiple users? **Yes** - -#### Supported architectures - -* x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/metabase%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/metabase/) -* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/metabase%20%28Apps%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/metabase/) - -## Limitations - -## Additional information - -## Links - - * Report a bug: https://github.com/YunoHost-Apps/metabase_ynh/issues - * App website: https://metabase.com - * Upstream app repository: https://github.com/metabase/metabase - * YunoHost website: https://yunohost.org/ - ---- +* Official app website: https://www.metabase.com/ +* Official user documentation: https://yunohost.org/apps +* Official admin documentation: https://www.metabase.com/docs/latest/ +* Upstream app code repository: https://github.com/metabase/metabase +* YunoHost documentation for this app: https://yunohost.org/app_metabase +* Report a bug: https://github.com/YunoHost-Apps/metabase_ynh/issues ## Developer info @@ -58,3 +44,5 @@ sudo yunohost app install https://github.com/YunoHost-Apps/metabase_ynh/tree/tes or sudo yunohost app upgrade metabase -u https://github.com/YunoHost-Apps/metabase_ynh/tree/testing --debug ``` + +**More info regarding app packaging:** https://yunohost.org/packaging_apps \ No newline at end of file diff --git a/README_fr.md b/README_fr.md index 77830fc..799db9e 100644 --- a/README_fr.md +++ b/README_fr.md @@ -1,52 +1,34 @@ # Metabase pour YunoHost -[![Integration level](https://dash.yunohost.org/integration/metabase.svg)](https://dash.yunohost.org/appci/app/metabase) ![](https://ci-apps.yunohost.org/ci/badges/metabase.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/metabase.maintain.svg) -[![Install Metabase with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=metabase) +[![Niveau d'intégration](https://dash.yunohost.org/integration/metabase.svg)](https://dash.yunohost.org/appci/app/metabase) ![](https://ci-apps.yunohost.org/ci/badges/metabase.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/metabase.maintain.svg) +[![Installer Metabase avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=metabase) -*[Read this readme in english.](./README.md)* +*[Read this readme in english.](./README.md)* +*[Lire ce readme en français.](./README_fr.md)* -> *Ce package vous permet d'installer Metabase rapidement et simplement sur un serveur YunoHost. -Si vous n'avez pas YunoHost, consultez [le guide](https://yunohost.org/#/install) pour apprendre comment l'installer.* +> *Ce package vous permet d'installer Metabase rapidement et simplement sur un serveur YunoHost. +Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour savoir comment l'installer et en profiter.* ## Vue d'ensemble -Metabase is the easy, open source way for everyone in your company to ask questions and learn from data. -**Version incluse :** 0.40.1 +Outil web de gestion des bases de données + +**Version incluse :** 0.40.2~ynh1 + + ## Captures d'écran -![](https://raw.githubusercontent.com/metabase/metabase/master/docs/metabase-product-screenshot.png) +![](./doc/screenshots/metabase-product-screenshot.png) -## Démo +## Documentations et ressources -* [Démo officielle]() - -## Guide d’installation - -## Documentation - - * Documentation officielle : https://www.metabase.com/docs/latest/ - -#### Support multi-utilisateur - -* L'authentification LDAP et HTTP est-elle prise en charge ? **Non** -* L'application peut-elle être utilisée par plusieurs utilisateurs ? **Oui** - -#### Architectures supportées - -* x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/metabase%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/metabase/) -* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/metabase%20%28Apps%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/metabase/) - -## Limitations - -## Liens - - * Signaler un bug : https://github.com/YunoHost-Apps/metabase_ynh/issues - * Site de l'application : https://metabase.com - * Dépôt de l'application principale : https://github.com/metabase/metabase - * Site web YunoHost : https://yunohost.org - ---- +* Site officiel de l'app : https://www.metabase.com/ +* Documentation officielle utilisateur : https://yunohost.org/apps +* Documentation officielle de l'admin : https://www.metabase.com/docs/latest/ +* Dépôt de code officiel de l'app : https://github.com/metabase/metabase +* Documentation YunoHost pour cette app : https://yunohost.org/app_metabase +* Signaler un bug : https://github.com/YunoHost-Apps/metabase_ynh/issues ## Informations pour les développeurs @@ -58,3 +40,5 @@ sudo yunohost app install https://github.com/YunoHost-Apps/metabase_ynh/tree/tes ou sudo yunohost app upgrade metabase -u https://github.com/YunoHost-Apps/metabase_ynh/tree/testing --debug ``` + +**Plus d'infos sur le packaging d'applications :** https://yunohost.org/packaging_apps \ No newline at end of file diff --git a/check_process b/check_process index eb0f54f..8187647 100644 --- a/check_process +++ b/check_process @@ -1,14 +1,8 @@ -# See here for more informations -# https://github.com/YunoHost/package_check#syntax-check_process-file - -# Move this file from check_process.default to check_process when you have filled it. - ;; Test complet ; Manifest - domain="domain.tld" (DOMAIN) - path="/" (PATH) - is_public=1 (PUBLIC|public=1|private=0) - port="9980" (PORT) + domain="domain.tld" + path="/" + is_public=1 ; Checks pkg_linter=1 setup_sub_dir=1 diff --git a/conf/app.src b/conf/app.src index c548c4f..35bf191 100644 --- a/conf/app.src +++ b/conf/app.src @@ -1,5 +1,5 @@ -SOURCE_URL=https://downloads.metabase.com/v0.40.1/metabase.jar -SOURCE_SUM=972babb2ce60740729ba56323188bdf998e417dc1d9bac5642d7a429e4a793b1 +SOURCE_URL=https://downloads.metabase.com/v0.40.2/metabase.jar +SOURCE_SUM=4d5cd90c7c12b459510dc7955c2d5a8db5845c0ed3bb8dcdc6f548182374e8e9 SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=jar SOURCE_IN_SUBDIR=false diff --git a/conf/nginx.conf b/conf/nginx.conf index 85dcbba..36dc5fd 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -18,5 +18,4 @@ location / { proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection $http_connection; - } diff --git a/doc/DISCLAIMER.md b/doc/DISCLAIMER.md new file mode 100644 index 0000000..e69de29 diff --git a/doc/screenshots/metabase-product-screenshot.png b/doc/screenshots/metabase-product-screenshot.png new file mode 100644 index 0000000..d2d8f50 Binary files /dev/null and b/doc/screenshots/metabase-product-screenshot.png differ diff --git a/manifest.json b/manifest.json index 143491a..86873ee 100644 --- a/manifest.json +++ b/manifest.json @@ -6,8 +6,15 @@ "en": "Web database management tool", "fr": "Outil web de gestion des bases de données" }, - "version": "0.40.1~ynh1", + "version": "0.40.2~ynh1", "url": "https://www.metabase.com/", + "upstream": { + "license": "AGPL-3.0-only", + "website": "https://www.metabase.com/", + "admindoc": "https://www.metabase.com/docs/latest/", + "userdoc": "https://yunohost.org/apps", + "code": "https://github.com/metabase/metabase" + }, "license": "AGPL-3.0-only", "maintainer": { "name": "Colin Maudry", @@ -15,7 +22,7 @@ "url": "" }, "requirements": { - "yunohost": ">= 4.0.0" + "yunohost": ">= 4.2.0" }, "multi_instance": false, "services": [ @@ -26,19 +33,11 @@ "install": [{ "name": "domain", "type": "domain", - "ask": { - "en": "Choose a domain name for Metabase", - "fr": "Choisissez un nom de domaine pour Metabase" - }, "example": "metabase.example.com" }, { "name": "is_public", "type": "boolean", - "ask": { - "en": "Is it a public site?", - "fr": "Est-ce un site public ?" - }, "help": { "en": "If enabled, Metabase will be accessible by people who do not have an account. This can be changed later via the webadmin.", "fr": "Si cette case est cochée, Metabase sera accessible aux personnes n’ayant pas de compte. Vous pourrez changer ceci plus tard via la webadmin." diff --git a/pull_request_template.md b/pull_request_template.md deleted file mode 100644 index 6c28fc5..0000000 --- a/pull_request_template.md +++ /dev/null @@ -1,16 +0,0 @@ -## Problem -- *Description of why you made this PR* - -## Solution -- *And how do you fix that problem* - -## PR Status -- [ ] Code finished. -- [ ] Tested with Package_check. -- [ ] Fix or enhancement tested. -- [ ] Upgrade from last version tested. -- [ ] Can be reviewed and tested. - -## Package_check results ---- -* An automatic package_check will be launch at https://ci-apps-dev.yunohost.org/, when you add a specific comment to your Pull Request: "!testme", "!gogogadgetoci" or "By the power of systemd, I invoke The Great App CI to test this Pull Request!"* diff --git a/scripts/backup b/scripts/backup index 735c496..e492fa1 100755 --- a/scripts/backup +++ b/scripts/backup @@ -37,6 +37,8 @@ ynh_print_info --message="Declaring files to be backed up..." ynh_backup --src_path="$final_path" + ynh_backup --src_path="/etc/default/$app" + #================================================= # BACKUP THE NGINX CONFIGURATION #================================================= @@ -49,6 +51,12 @@ ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf" ynh_backup --src_path="/etc/systemd/system/$app.service" +#================================================= +# BACKUP LOGROTATE +#================================================= + +ynh_backup --src_path="/etc/logrotate.d/$app" + #================================================= # BACKUP THE POSTQRESQL DATABASE #================================================= @@ -60,4 +68,4 @@ ynh_psql_dump_db --database="$db_name" > db.sql # END OF SCRIPT #================================================= -ynh_print_info --message="Backup script completed for Metabase. (YunoHost will then actually copy those files to the archive)." +ynh_print_info --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)." diff --git a/scripts/change_url b/scripts/change_url index 126010e..8b85a08 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -24,20 +24,15 @@ app=$YNH_APP_INSTANCE_NAME #================================================= # LOAD SETTINGS #================================================= -ynh_script_progression --message="Loading installation settings..." --time --weight=1 +ynh_script_progression --message="Loading installation settings..." --weight=1 # Needed for helper "ynh_add_nginx_config" final_path=$(ynh_app_setting_get --app=$app --key=final_path) -# Add settings here as needed by your application -#db_name=$(ynh_app_setting_get --app=$app --key=db_name) -#db_user=$db_name -#db_pwd=$(ynh_app_setting_get --app=$app --key=db_pwd) - #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP #================================================= -ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..." --time --weight=1 +ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..." --weight=1 # Backup the current version of the app ynh_backup_before_upgrade @@ -72,14 +67,14 @@ fi #================================================= # STOP SYSTEMD SERVICE #================================================= -ynh_script_progression --message="Stopping a systemd service..." --time --weight=1 +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" #================================================= # MODIFY URL IN NGINX CONF #================================================= -ynh_script_progression --message="Updating NGINX web server configuration..." --time --weight=1 +ynh_script_progression --message="Updating NGINX web server configuration..." --weight=1 nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf @@ -105,25 +100,19 @@ then ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf" fi -#================================================= -# SPECIFIC MODIFICATIONS -#================================================= -# ... -#================================================= - #================================================= # GENERIC FINALISATION #================================================= # START SYSTEMD SERVICE #================================================= -ynh_script_progression --message="Starting a systemd service..." --time --weight=1 +ynh_script_progression --message="Starting a systemd service..." --weight=1 ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log" #================================================= # RELOAD NGINX #================================================= -ynh_script_progression --message="Reloading NGINX web server..." --time --weight=1 +ynh_script_progression --message="Reloading NGINX web server..." --weight=1 ynh_systemd_action --service_name=nginx --action=reload @@ -131,4 +120,4 @@ ynh_systemd_action --service_name=nginx --action=reload # END OF SCRIPT #================================================= -ynh_script_progression --message="Change of URL completed for $app" --time --last +ynh_script_progression --message="Change of URL completed for $app" --last diff --git a/scripts/install b/scripts/install index 7eefd0e..12d6afd 100755 --- a/scripts/install +++ b/scripts/install @@ -35,7 +35,7 @@ app=$YNH_APP_INSTANCE_NAME #================================================= ynh_script_progression --message="Validating installation parameters..." --weight=1 -final_path=/opt/$app +final_path=/opt/yunohost/$app test ! -e "$final_path" || ynh_die --message="This path already contains a folder" # Register (book) web path @@ -47,7 +47,6 @@ ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url ynh_app_setting_set --app=$app --key=domain --value=$domain ynh_app_setting_set --app=$app --key=path --value=$path_url -ynh_app_setting_set --app=$app --key=is_public --value=$is_public #================================================= # FIND AND OPEN A PORT @@ -76,6 +75,14 @@ ynh_app_setting_set --app=$app --key=db_name --value=$db_name ynh_psql_test_if_first_run ynh_psql_setup_db --db_user=$db_name --db_name=$db_name +#================================================= +# CREATE DEDICATED USER +#================================================= +ynh_script_progression --message="Configuring system user..." --weight=2 + +# Create a system user +ynh_system_user_create --username=$app + #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= @@ -85,6 +92,11 @@ ynh_app_setting_set --app=$app --key=final_path --value=$final_path # Download, check integrity, uncompress and patch the source from app.src ynh_setup_source --dest_dir="$final_path" +chmod 750 "$final_path" +chmod -R o-rwx "$final_path" +chown -R $app:www-data "$final_path" +chmod +x $final_path/metabase.jar + #================================================= # NGINX CONFIGURATION #================================================= @@ -93,14 +105,6 @@ ynh_script_progression --message="Configuring NGNX web server..." --weight=3 # Create a dedicated NGINX config ynh_add_nginx_config -#================================================= -# CREATE DEDICATED USER -#================================================= -ynh_script_progression --message="Configuring system user..." --weight=2 - -# Create a system user -ynh_system_user_create --username=$app - #================================================= # SETUP SYSTEMD #================================================= @@ -111,13 +115,13 @@ ynh_add_systemd_config #================================================= # SETUP CONFIG #================================================= +ynh_script_progression --message="Adding a configuration file..." --weight=1 touch /etc/default/$app -cp ../conf/metabase /etc/default/$app +ynh_add_config --template="../conf/metabase" --destination="/etc/default/$app" -ynh_replace_string --match_string="__PORT__" --replace_string="$port" --target_file="/etc/default/$app" -ynh_replace_string --match_string="__DB_NAME__" --replace_string="$db_name" --target_file="/etc/default/$app" -ynh_replace_string --match_string="__DB_PWD__" --replace_string="$db_pwd" --target_file="/etc/default/$app" +chmod 640 "/etc/default/$app" +chown $app "/etc/default/$app" #================================================= # GENERIC FINALIZATION @@ -125,12 +129,13 @@ ynh_replace_string --match_string="__DB_PWD__" --replace_string="$db_pwd" --targ # SECURE FILES AND DIRECTORIES #================================================= -chmod +x $final_path/metabase.jar +# Create log directory +mkdir -p /var/log/$app +touch /var/log/$app/$app.log +chown -R $app /var/log/$app -chown -R $app: $final_path -touch /var/log/$app.log -chown $app: /var/log/$app.log -chmod 640 /etc/default/$app +# Setup logrotate +ynh_use_logrotate --specific_user=$app/$app #================================================= # INTEGRATE SERVICE IN YUNOHOST @@ -145,7 +150,7 @@ yunohost service add $app --description="Web database management tool" --log="/v ynh_script_progression --message="Starting a systemd service..." --weight=2 # Start a systemd service -ynh_systemd_action --service_name=$app --action=start --log_path=systemd #--line_match="" +ynh_systemd_action --service_name=$app --action=start --log_path=systemd --line_match="Please use the following URL to setup your Metabase installation:" #================================================= # SETUP SSOWAT @@ -169,4 +174,4 @@ ynh_systemd_action --service_name=nginx --action=reload # END OF SCRIPT #================================================= -ynh_script_progression --message="Installation of Metabase completed" --last +ynh_script_progression --message="Installation of $app completed" --last diff --git a/scripts/remove b/scripts/remove index f457311..8d06a0b 100755 --- a/scripts/remove +++ b/scripts/remove @@ -67,6 +67,14 @@ ynh_script_progression --message="Removing Metabase main directory..." --weight= # Remove the app directory securely ynh_secure_remove --file="$final_path" +#================================================= +# REMOVE APP MAIN DIR +#================================================= +ynh_script_progression --message="Removing the app configuration file..." --weight=1 + +# Remove the app directory securely +ynh_secure_remove --file="/etc/default/$app" + #================================================= # REMOVE NGINX CONFIGURATION #================================================= @@ -75,6 +83,16 @@ ynh_script_progression --message="Removing NGINX web server configuration..." -- # Remove the dedicated NGINX config ynh_remove_nginx_config +#================================================= +# REMOVE LOGROTATE CONFIGURATION +#================================================= +ynh_script_progression --message="Removing logrotate configuration..." + +ynh_secure_remove --file="/var/log/$app" + +# Remove the app-specific logrotate config +ynh_remove_logrotate + #================================================= # GENERIC FINALIZATION #================================================= @@ -89,4 +107,4 @@ ynh_system_user_delete --username=$app # END OF SCRIPT #================================================= -ynh_script_progression --message="Removal of Metabase completed" --last +ynh_script_progression --message="Removal of $app completed" --last diff --git a/scripts/restore b/scripts/restore index abf39f5..f622c9e 100755 --- a/scripts/restore +++ b/scripts/restore @@ -48,28 +48,43 @@ test ! -d "$final_path" \ #================================================= # RESTORE THE NGINX CONFIGURATION #================================================= +ynh_script_progression --message="Restoring the NGINX configuration..." --weight=1 ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" -#================================================= -# RESTORE THE APP MAIN DIR -#================================================= -ynh_script_progression --message="Restoring Metabase main directory..." --weight=2 - -ynh_restore_file --origin_path="$final_path" - #================================================= # RECREATE THE DEDICATED USER #================================================= ynh_script_progression --message="Recreating the dedicated system user..." --weight=3 # Create the dedicated user (if not existing) -ynh_system_user_create --username=$app +ynh_system_user_create --username=$app --home_dir="$final_path" + +#================================================= +# RESTORE THE APP MAIN DIR +#================================================= +ynh_script_progression --message="Restoring the app main directory..." --weight=2 + +ynh_restore_file --origin_path="$final_path" + +chmod 750 "$final_path" +chmod -R o-rwx "$final_path" +chown -R $app:www-data "$final_path" +chmod +x $final_path/metabase.jar + +#================================================= +# SETUP CONFIG +#================================================= +ynh_script_progression --message="Restoring a configuration file..." --weight=1 + +ynh_restore_file --origin_path="/etc/default/$app" +chmod 640 "/etc/default/$app" +chown $app "/etc/default/$app" #================================================= # INSTALL DEPENDENCIES #================================================= -ynh_print_info "Installing dependencies..." +ynh_script_progression --message="Installing dependencies..." ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies @@ -82,6 +97,17 @@ ynh_psql_test_if_first_run ynh_psql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd ynh_psql_execute_file_as_root --file="./db.sql" --database=$db_name +#================================================= +# HANDLE LOG FILES AND LOGROTATE +#================================================= + +mkdir -p /var/log/$app +touch /var/log/$app/$app.log +chown $app -R /var/log/$app + +# Restore logrotate configuration +ynh_restore_file --origin_path="/etc/logrotate.d/$app" + #================================================= # SPECIFIC RESTORATION #================================================= @@ -104,7 +130,7 @@ yunohost service add $app --description="Web database management tool" --log="/v #================================================= ynh_script_progression --message="Starting a systemd service..." --weight=2 -ynh_systemd_action --service_name=$app --action=start --log_path="systemd" --line_match="" +ynh_systemd_action --service_name=$app --action=start --log_path="systemd" --line_match="Please use the following URL to setup your Metabase installation:" #================================================= # GENERIC FINALIZATION @@ -119,4 +145,4 @@ ynh_systemd_action --service_name=nginx --action=reload # END OF SCRIPT #================================================= -ynh_script_progression --message="Restoration completed for Metabase" --last +ynh_script_progression --message="Restoration completed for $app" --last diff --git a/scripts/upgrade b/scripts/upgrade index 6143a9d..04c8047 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -20,7 +20,6 @@ app=$YNH_APP_INSTANCE_NAME domain=$(ynh_app_setting_get --app=$app --key=domain) path_url=$(ynh_app_setting_get --app=$app --key=path) final_path=$(ynh_app_setting_get --app=$app --key=final_path) -is_public=$(ynh_app_setting_get --app=$app --key=is_public) port=$(ynh_app_setting_get --app=$app --key=port) db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd) db_name=$(ynh_app_setting_get --app=$app --key=db_name) @@ -90,6 +89,11 @@ then ynh_setup_source --dest_dir="$final_path" fi +chmod 750 "$final_path" +chmod -R o-rwx "$final_path" +chown -R $app:www-data "$final_path" +chmod +x $final_path/metabase.jar + #================================================= # NGINX CONFIGURATION #================================================= @@ -113,16 +117,28 @@ ynh_script_progression --message="Configuring a systemd service..." --weight=3 ynh_add_systemd_config #================================================= -# GENERIC FINALIZATION +# SETUP CONFIG #================================================= -# SECURE FILES AND DIRECTORIES +ynh_script_progression --message="Adding a configuration file..." --weight=1 + +touch /etc/default/$app +ynh_add_config --template="../conf/metabase" --destination="/etc/default/$app" + +chmod 640 "/etc/default/$app" +chown $app "/etc/default/$app" + #================================================= +# HANDLE LOG FILES AND LOGROTATE +#================================================= +ynh_script_progression --message="Configuring log rotation..." --weight=3 -chmod +x $final_path/metabase.jar +# Create log directory +mkdir -p /var/log/$app +touch /var/log/$app/$app.log +chown -R $app /var/log/$app -chown -R $app: $final_path -chown $app: /var/log/$app.log -chmod 640 /etc/default/$app +# Setup logrotate +ynh_use_logrotate --specific_user=$app/$app #================================================= # INTEGRATE SERVICE IN YUNOHOST @@ -137,7 +153,7 @@ yunohost service add $app --description="Web database management tool" --log="/v ynh_script_progression --message="Starting a systemd service..." --weight=5 # Start a systemd service -ynh_systemd_action --service_name=$app --action=start --log_path="systemd" --line_match="" +ynh_systemd_action --service_name=$app --action=start --log_path="systemd" --line_match="Please use the following URL to setup your Metabase installation:" #================================================= # RELOAD NGINX @@ -150,4 +166,4 @@ ynh_systemd_action --service_name=nginx --action=reload # END OF SCRIPT #================================================= -ynh_script_progression --message="Upgrade of Metabase completed" --last +ynh_script_progression --message="Upgrade of $app completed" --last