From e3e68e2e1755e587bda707f0d751b29257cbc904 Mon Sep 17 00:00:00 2001 From: Boudewijn Date: Tue, 25 Feb 2025 14:30:31 +0100 Subject: [PATCH] Commit first changes to example package for My Idlers --- conf/nginx.conf | 19 +++++------ conf/systemd.service | 2 +- manifest.toml | 79 ++++++++++---------------------------------- scripts/install | 24 +++++++------- 4 files changed, 40 insertions(+), 84 deletions(-) diff --git a/conf/nginx.conf b/conf/nginx.conf index b36dab4..0d0d3fb 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -1,18 +1,18 @@ #sub_path_only rewrite ^__PATH__$ __PATH__/ permanent; -location __PATH__/ { +location ^~ __PATH__/ { # Path to source - alias __INSTALL_DIR__/; + alias __INSTALL_DIR__/public/; -### Example PHP configuration (remove it if not used) index index.php; - # Common parameter to increase upload size limit in conjunction with dedicated PHP-FPM file - # client_max_body_size 50M; - - try_files $uri $uri/ index.php; - location ~ [^/]\.php(/|$) { - fastcgi_split_path_info ^(.+?\.php)(/.*)$; + try_files $uri $uri/ __PATH__/__PATH__/index.php?$query_string; + + location ~ \.php$ { + if (!-e $request_filename) { + rewrite ^__PATH__/?(.*)$ __PATH__/index.php?/$1 last; + break; + } fastcgi_pass unix:/var/run/php/php__PHP_VERSION__-fpm-__APP__.sock; fastcgi_index index.php; @@ -21,5 +21,4 @@ location __PATH__/ { fastcgi_param PATH_INFO $fastcgi_path_info; fastcgi_param SCRIPT_FILENAME $request_filename; } -### End of PHP configuration part } diff --git a/conf/systemd.service b/conf/systemd.service index 97d2900..ed7ad22 100644 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -1,5 +1,5 @@ [Unit] -Description=Small description of the service +Description=Run my idlers via laravel/artisan After=network.target [Service] diff --git a/manifest.toml b/manifest.toml index 3b37b83..28c1102 100644 --- a/manifest.toml +++ b/manifest.toml @@ -2,39 +2,25 @@ packaging_format = 2 -id = "example" -name = "Example app" -description.en = "Explain in *a few (10~15) words* the purpose of the app or what it actually does (it is meant to give a rough idea to users browsing a catalog of 100+ apps)" -description.fr = "Expliquez en *quelques* (10~15) mots l'utilité de l'app ou ce qu'elle fait (l'objectif est de donner une idée grossière pour des utilisateurs qui naviguent dans un catalogue de 100+ apps)" +id = "my_idlers" +name = "My Idlers" +description.en = "A self-hosted web app for displaying, organizing and storing information about your servers (VPS/Dedi), shared & reseller hosting, seedboxes, domains, DNS and misc services." +description.fr = "Une application Web auto-hébergée pour afficher, organiser et stocker des informations sur vos serveurs (VPS/Dedi), votre hébergement partagé et revendeur, vos seedboxes, vos domaines, vos DNS et divers services." -version = "1.0~ynh1" +version = "3.0~ynh1" -maintainers = ["johndoe"] +maintainers = ["wbk"] [upstream] -# NB: Only the "license" key is mandatory. Remove entries for which there's no relevant data -license = "free" # you can see the available licenses identifiers list here: https://spdx.org/licenses/ -website = "https://example.com" -demo = "https://demo.example.com" -admindoc = "https://yunohost.org/packaging_apps" -userdoc = "https://yunohost.org/apps" -code = "https://some.forge.com/example/example" -# FIXME: optional but recommended if relevant, this is meant to contain the Common Platform Enumeration, which is -# sort of a standard id for applications defined by the NIST. In particular, YunoHost may use this is in the future -# to easily track CVE (=security reports) related to apps. The CPE may be obtained by searching here: -# https://nvd.nist.gov/products/cpe/search. -# For example, for Nextcloud, the CPE is 'cpe:2.3:a:nextcloud:nextcloud' (no need to include the version number) -cpe = "???" +license = "MIT" +demo = "https://demo.myidlers.com/login" +userdoc = "https://lowendspirit.com/discussion/2449/my-idlers-self-hosted-web-app-for-your-servers-shared-hosting-and-domains-information/" +code = "https://github.com/cp6/my-idlers#install" -# FIXME: optional but recommended (or remove if irrelevant / not applicable). -# This is meant to be an URL where people can financially support this app, especially when its development is based -# on volunteers and/or financed by its community. YunoHost may later advertise it in the webadmin. -fund = "???" [integration] yunohost = ">= 12.0.9" helpers_version = "2.1" -# FIXME: can be replaced by a list of supported archs using the dpkg --print-architecture nomenclature (amd64/i386/armhf/arm64), for example: ["amd64", "i386"] architectures = "all" multi_instance = true @@ -49,40 +35,26 @@ ldap = "?" sso = "?" # FIXME: replace with an **estimate** minimum disk and RAM requirements. e.g. 20M, 400M, 1G... -disk = "50M" -ram.build = "50M" -ram.runtime = "50M" +disk = "100M" +ram.build = "150M" +ram.runtime = "100M" [install] [install.domain] - # this is a generic question - ask strings are automatically handled by YunoHost's core type = "domain" [install.path] - # this is a generic question - ask strings are automatically handled by YunoHost's core type = "path" - default = "/example" + default = "/idlers" [install.init_main_permission] - # this is a generic question - ask strings are automatically handled by YunoHost's core - # This won't be saved as setting and will instead be used to initialize the SSOwat permission type = "group" default = "visitors" - [install.language] - ask.en = "Choose the application language" - ask.fr = "Choisissez la langue de l'application" - type = "select" - choices = ["fr", "en"] - default = "fr" - [install.admin] - # this is a generic question - ask strings are automatically handled by YunoHost's core type = "user" [install.password] - # this is a generic question - ask strings are automatically handled by YunoHost's core - # Note that user-provided passwords questions are not automatically saved as setting help.en = "Use the help field to add an information for the admin about this question." help.fr = "Utilisez le champ aide pour ajouter une information à l'intention de l'administrateur à propos de cette question." type = "password" @@ -97,26 +69,13 @@ ram.runtime = "50M" # This will pre-fetch the asset which can then be deployed during the install/upgrade scripts with : # ynh_setup_source --dest_dir="$install_dir" # You can also define other assets than "main" and add --source_id="foobar" in the previous command - url = "https://github.com/foo/bar/archive/refs/tags/v1.2.3.tar.gz" - sha256 = "0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef" - - # These infos are used by https://github.com/YunoHost/apps/blob/master/tools/autoupdate_app_sources/autoupdate_app_sources.py - # to auto-update the previous asset urls and sha256sum + manifest version - # assuming the upstream's code repo is on github and relies on tags or releases - # See the 'sources' resource documentation for more details - - # autoupdate.strategy = "latest_github_tag" + url = "https://github.com/cp6/my-idlers/archive/refs/tags/3.0.zip" + sha256 = "f92a6dc9c98ec1e3837939db571833d28e72b992f5a9611925e9d242fcb40f72" [resources.system_user] - # This will provision/deprovision a unix system user [resources.install_dir] - # This will create/remove the install dir as /var/www/$app - # and store the corresponding setting $install_dir - - [resources.data_dir] - # This will create/remove the data dir as /home/yunohost.app/$app - # and store the corresponding setting $data_dir + group = "www-data:r-x" [resources.permissions] # This will configure SSOwat permission for $domain/$path/ @@ -127,9 +86,7 @@ ram.runtime = "50M" # This will pick a random port for reverse-proxying and store it as the $port setting [resources.apt] - # This will automatically install/uninstall the following apt packages - # and implicitly define the $phpversion setting as 8.0 (if phpX.Y-foobar dependencies are listed) - packages = "mariadb-server, deb1, deb2, php8.3-foo, php8.3-bar" + packages = "php8.3, php8.3-cli, php8.3-mbstring, php8.3-xml, php8.3-mysql, php8.3-intl, php8.3-pdo, php8.3-intl, composer" [resources.database] # This will automatically provision/deprovison a MySQL DB and store the corresponding credentials in settings $db_user, $db_name, $db_pwd diff --git a/scripts/install b/scripts/install index fa67130..53080d7 100755 --- a/scripts/install +++ b/scripts/install @@ -32,11 +32,11 @@ source /usr/share/yunohost/helpers # If you need to, you can define custom settings # (or remove this section entirely if not relevant for you) -foo="bar" -ynh_app_setting_set --key=foo --value=$foo +#foo="bar" +#ynh_app_setting_set --key=foo --value=$foo -ynh_app_setting_set --key=php_upload_max_filesize --value=50M -ynh_app_setting_set --key=php_post_max_size --value=50M +#ynh_app_setting_set --key=php_upload_max_filesize --value=50M +#ynh_app_setting_set --key=php_post_max_size --value=50M #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE @@ -72,13 +72,13 @@ ynh_script_progression "Adding $app's configuration files..." ### ### Check the documentation of `ynh_config_add` for more info. -ynh_config_add --template="some_config_file" --destination="$install_dir/some_config_file" +#ynh_config_add --template="some_config_file" --destination="$install_dir/some_config_file" # FIXME: this should be handled by the core in the future ### You may need to use chmod 600 instead of 400, ### for example if the app is expected to be able to modify its own config -chmod 400 "$install_dir/some_config_file" -chown "$app:$app" "$install_dir/some_config_file" +chmod 600 "$install_dir/some_config_file" +#chown "$app:$app" "$install_dir/some_config_file" ### For more complex cases where you want to replace stuff using regexes, ### you shoud rely on ynh_replace (which is basically a wrapper for sed) @@ -104,7 +104,7 @@ ynh_script_progression "Adding system configurations related to $app..." ### - And the section "PHP-FPM CONFIGURATION" in the upgrade script # Create a PHP-FPM config (with conf/extra_php-fpm.conf being appended to it) -ynh_config_add_phpfpm +#ynh_config_add_phpfpm # Create a dedicated NGINX config using the conf/nginx.conf template ynh_config_add_nginx @@ -147,7 +147,7 @@ ynh_config_add_systemd ### to proceed if you later realize that you need to enable some flags that ### weren't enabled on old installs (be careful it'll override the existing ### service though so you should re-provide all relevant flags when doing so) -yunohost service add "$app" --description="A short description of the app" --log="/var/log/$app/$app.log" +yunohost service add "$app" --description="Web app for displaying, organizing and storing information about servers (VPS), shared hosting, reseller hosting, domains and more." --log="/var/log/$app/$app.log" ### `ynh_config_add_logrotate` is used to configure a logrotate configuration for the logs of this app. ### Use this helper only if there is effectively a log file for this app. @@ -158,10 +158,10 @@ yunohost service add "$app" --description="A short description of the app" --log ### - And the section "SETUP LOGROTATE" in the upgrade script # Use logrotate to manage application logfile(s) -ynh_config_add_logrotate +#ynh_config_add_logrotate # Create a dedicated Fail2Ban config -ynh_config_add_fail2ban --logpath="/var/log/nginx/${domain}-error.log" --failregex="Regex to match into the log for a failed login" +#ynh_config_add_fail2ban --logpath="/var/log/nginx/${domain}-error.log" --failregex="Regex to match into the log for a failed login" #================================================= # SETUP APPLICATION WITH CURL @@ -174,7 +174,7 @@ ynh_config_add_fail2ban --logpath="/var/log/nginx/${domain}-error.log" --failreg # Installation with curl ynh_script_progression "Finalizing installation..." -ynh_local_curl "/INSTALL_PATH" "key1=value1" "key2=value2" "key3=value3" +#ynh_local_curl "/INSTALL_PATH" "key1=value1" "key2=value2" "key3=value3" #================================================= # START SYSTEMD SERVICE