From ec94cd403dd23e79c8ea249a1038a8d43afaef0b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Pi=C3=A9dallu?= Date: Fri, 12 Jul 2024 12:53:33 +0200 Subject: [PATCH] Revamp package install --- conf/extra_php-fpm.conf | 4 ---- conf/nginx.conf | 19 ++----------------- manifest.toml | 13 ++++++------- scripts/_common.sh | 2 ++ scripts/install | 32 ++++++++++++++++++++++++++------ 5 files changed, 36 insertions(+), 34 deletions(-) delete mode 100644 conf/extra_php-fpm.conf diff --git a/conf/extra_php-fpm.conf b/conf/extra_php-fpm.conf deleted file mode 100644 index 700c37c..0000000 --- a/conf/extra_php-fpm.conf +++ /dev/null @@ -1,4 +0,0 @@ -; Additional php.ini defines, specific to this pool of workers. - -php_admin_value[upload_max_filesize] = 50M -php_admin_value[post_max_size] = 50M diff --git a/conf/nginx.conf b/conf/nginx.conf index 74155b1..b746c20 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -2,24 +2,9 @@ location __PATH__/ { # Path to source - alias __INSTALL_DIR__/; + alias __INSTALL_DIR__/www/; - index index.php index.html; - - # Common parameter to increase upload size limit in conjunction with dedicated php-fpm file - client_max_body_size 10G; - - try_files $uri $uri/ index.php; - location ~ [^/]\.php(/|$) { - fastcgi_split_path_info ^(.+?\.php)(/.*)$; - fastcgi_pass unix:/var/run/php/php__PHPVERSION__-fpm-__NAME__.sock; - - fastcgi_index index.php; - include fastcgi_params; - fastcgi_param REMOTE_USER $remote_user; - fastcgi_param PATH_INFO $fastcgi_path_info; - fastcgi_param SCRIPT_FILENAME $request_filename; - } + index index.html; # Include SSOWAT user panel. include conf.d/yunohost_panel.conf.inc; diff --git a/manifest.toml b/manifest.toml index 4fc05c5..7ddd6c6 100644 --- a/manifest.toml +++ b/manifest.toml @@ -1,3 +1,5 @@ +#:schema https://raw.githubusercontent.com/YunoHost/apps/master/schemas/manifest.v2.schema.json + packaging_format = 2 id = "framagames" @@ -38,11 +40,11 @@ ram.runtime = "50M" [resources] - [resources.sources.main] + [resources.sources.main] + url = "https://framagit.org/framasoft/framagames/-/archive/5510754d92e9649aa1808ffb1d3255d5da1ebf47/framagames-5510754d92e9649aa1808ffb1d3255d5da1ebf47.tar.bz2" + sha256 = "3a58583fd0e7a7b81d4b2db0ff04a588eb0a04c574f0f36d681a2969e6648e9d" - url = "https://framagit.org/framasoft/framagames/-/archive/5510754d92e9649aa1808ffb1d3255d5da1ebf47/framagames-5510754d92e9649aa1808ffb1d3255d5da1ebf47.tar.bz2" - sha256 = "3a58583fd0e7a7b81d4b2db0ff04a588eb0a04c574f0f36d681a2969e6648e9d" - autoupdate.strategy = "latest_gitlab_commit" + autoupdate.strategy = "latest_gitlab_commit" [resources.system_user] @@ -50,6 +52,3 @@ ram.runtime = "50M" [resources.permissions] main.url = "/" - - [resources.apt] - packages = "php8.2-fpm" diff --git a/scripts/_common.sh b/scripts/_common.sh index 944a65e..ac79128 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -4,6 +4,8 @@ # COMMON VARIABLES #================================================= +nodejs_version=12 + #================================================= # PERSONAL HELPERS #================================================= diff --git a/scripts/install b/scripts/install index 424ae04..aa81991 100644 --- a/scripts/install +++ b/scripts/install @@ -7,25 +7,45 @@ source _common.sh source /usr/share/yunohost/helpers +#================================================= +# INSTALL NODEJS +#================================================= +ynh_script_progression --message="Installing NodeJS..." --weight=1 + +ynh_exec_warn_less ynh_install_nodejs --nodejs_version="$nodejs_version" + #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= ynh_script_progression --message="Setting up source files..." # Download, check integrity, uncompress and patch the source from app.src -ynh_setup_source --dest_dir="$install_dir" +ynh_setup_source --dest_dir="$install_dir/sources" chmod -R o-rwx "$install_dir" -chown -R $app:www-data "$install_dir" +chown -R "$app:www-data" "$install_dir" #================================================= -# PHP-FPM CONFIGURATION +# BUILD APP +#================================================= +ynh_script_progression --message="Building $app..." + +pushd "$install_dir/sources" + ynh_use_nodejs + ynh_exec_warn_less ynh_exec_as "$app" env "$ynh_node_load_PATH" "$ynh_npm" run commons + ynh_exec_warn_less ynh_exec_as "$app" env "$ynh_node_load_PATH" "$ynh_npm" run prod +popd + +mv -f "$install_dir/sources/dist" "$install_dir/www" +mv -f "$install_dir/sources/games/"* "$install_dir/www" +cp "$install_dir/www/fr/index.html" "$install_dir/www/index.html" +# cd public && for f in $(find -type l);do cp --remove-destination $(readlink -f $f) $f;done; + +#================================================= +# SYSTEM CONFIGURATION #================================================= ynh_script_progression --message="Adding system configurations related to $app..." --weight=1 -# Create a dedicated PHP-FPM config -ynh_add_fpm_config - # Create a dedicated NGINX config ynh_add_nginx_config