From 9851de8e3421b59578a48758bf4e6e33ea8c5c77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?E=CC=81ric=20Gaspar?= <46165813+ericgaspar@users.noreply.github.com> Date: Sat, 8 Jun 2024 18:13:25 +0200 Subject: [PATCH] build --- conf/systemd.service | 3 ++- manifest.toml | 10 ++++++++++ scripts/install | 12 +++++++++++- 3 files changed, 23 insertions(+), 2 deletions(-) diff --git a/conf/systemd.service b/conf/systemd.service index 57f0c81..2badc5c 100644 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -9,7 +9,8 @@ Group=__APP__ Environment=NODE_ENV=production Environment=DOTENV_CONFIG_PATH=__INSTALL_DIR__/etc/facilmap.env Environment="__YNH_NODE_LOAD_PATH__" -ExecStart=__INSTALL_DIR__/bin/facilmap-server +#ExecStart=__INSTALL_DIR__/bin/facilmap-server +ExecStart=/usr/bin/yarn sserve WorkingDirectory=__INSTALL_DIR__ StandardOutput=syslog StandardError=syslog diff --git a/manifest.toml b/manifest.toml index 70c11f0..5fbe088 100644 --- a/manifest.toml +++ b/manifest.toml @@ -81,6 +81,12 @@ ram.runtime = "50M" [resources] + [resources.sources] + + [resources.sources.main] + url = "https://github.com/FacilMap/facilmap/archive/refs/tags/v4.1.1.tar.gz" + sha256 = "72cf9f7fbc6e9d5c73f7c1af02be63d2c5a99d13cf89c96af834db6004c89cf6" + [resources.ports] [resources.system_user] @@ -93,5 +99,9 @@ ram.runtime = "50M" [resources.apt] packages = "mariadb-server" + extras.yarn.repo = "deb https://dl.yarnpkg.com/debian/ stable main" + extras.yarn.key = "https://dl.yarnpkg.com/debian/pubkey.gpg" + extras.yarn.packages = "yarn" + [resources.database] type = "mysql" diff --git a/scripts/install b/scripts/install index 5a6e023..cb86d2c 100755 --- a/scripts/install +++ b/scripts/install @@ -16,6 +16,15 @@ ynh_script_progression --message="Installing NodeJS..." --weight=6 ynh_install_nodejs --nodejs_version=$nodejs_version +#================================================= +# DOWNLOAD, CHECK AND UNPACK SOURCE +#================================================= +ynh_script_progression --message="Setting up source files..." --weight=1 + +ynh_setup_source --dest_dir="$install_dir" + +chown -R "$app:www-data" "$install_dir" + #================================================= # CREATE A MYSQL DATABASE #================================================= @@ -31,7 +40,8 @@ ynh_mysql_execute_as_root --database="$db_name" --sql="ALTER DATABASE $db_name C ynh_script_progression --message="Building with NodeJS..." --weight=20 pushd "$install_dir" - ynh_exec_as $app "$ynh_node_load_PATH" "$ynh_npm" install --prefix "$install_dir" -g facilmap-server@"$facilmap_version" 2>/dev/null + ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH yarn install + ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH yarn build popd chmod 750 "$install_dir"