From 023adff1be90c79404185d0d91e3eb6eb62e10aa Mon Sep 17 00:00:00 2001 From: Thomas <51749973+Thovi98@users.noreply.github.com> Date: Thu, 7 Dec 2023 15:48:05 +0100 Subject: [PATCH 01/30] Update manifest.toml --- manifest.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.toml b/manifest.toml index 4531941..18d0b4f 100644 --- a/manifest.toml +++ b/manifest.toml @@ -7,7 +7,7 @@ name = "Terraforming Mars " description.en = "Open-source online implementation of the great board game Terraforming mars." description.fr = "Implementation en ligne à code source ouvert de l’excellent jeu de plateau Terraforming Mars" -version = "20231115~ynh1" +version = "20231205~ynh1" maintainers = ["Thovi98"] From 1fad66386843dba045f664400a50fa6fa419fe75 Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Thu, 7 Dec 2023 14:48:08 +0000 Subject: [PATCH 02/30] Auto-update README --- README.md | 2 +- README_fr.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 2495b7d..f571191 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in This is an open-source online implementation of the great board game Terraforming mars. It is not affiliated with FryxGames, Asmodee Digital or Steam in any way. -**Shipped version:** 20231115~ynh1 +**Shipped version:** 20231205~ynh1 **Demo:** https://terraforming-mars.herokuapp.com/ diff --git a/README_fr.md b/README_fr.md index 765d2be..dd459f4 100644 --- a/README_fr.md +++ b/README_fr.md @@ -18,7 +18,7 @@ Si vous n’avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) po Cette application est une implémentation en ligne et open source de l’excellent jeu de plateau Terraforming mars. Elle n’est affiliée à FryxGames, Asmodee Digital ou Steam en aucun cas. -**Version incluse :** 20231115~ynh1 +**Version incluse :** 20231205~ynh1 **Démo :** https://terraforming-mars.herokuapp.com/ From 2bd31239dce5b5f27ca2cd7de78b68fb97531926 Mon Sep 17 00:00:00 2001 From: Thomas <51749973+Thovi98@users.noreply.github.com> Date: Thu, 7 Dec 2023 15:48:44 +0100 Subject: [PATCH 03/30] Update version --- scripts/_common.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/_common.sh b/scripts/_common.sh index e6f43c4..cb02d34 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -8,7 +8,7 @@ nodejs_version=16 # Terraforming-mars commit -TM_version="38c69c7" +TM_version="78e5e5d" #================================================= # PERSONAL HELPERS From 0a5c147d7e17f03ce1f9a3509f6a8762c614d3d6 Mon Sep 17 00:00:00 2001 From: Thomas <51749973+Thovi98@users.noreply.github.com> Date: Tue, 12 Dec 2023 14:16:48 +0100 Subject: [PATCH 04/30] init ynh_setup_source --- manifest.toml | 7 +++++++ scripts/install | 18 ++++++++++++------ 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/manifest.toml b/manifest.toml index 18d0b4f..181e616 100644 --- a/manifest.toml +++ b/manifest.toml @@ -41,6 +41,13 @@ ram.runtime = "50M" default = "visitors" [resources] + + [resources.sources] + + [resources.sources.main] + url = "https://codeload.github.com/terraforming-mars/terraforming-mars/tar.gz/78e5e5d0433e4d1632639ea7da1a1993672bd82a" + sha256 = "b41cfe80334495a4653bc3933298597c232474c309c5993e388068e33d7f13ce" + autoupdate.strategy = "latest_github_tag" [resources.system_user] diff --git a/scripts/install b/scripts/install index e168d09..128606d 100755 --- a/scripts/install +++ b/scripts/install @@ -19,6 +19,18 @@ ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version # Upgrade NPM ynh_npm install --global npm@6.14.18 +#================================================= +# DOWNLOAD, CHECK AND UNPACK SOURCE +#================================================= +ynh_script_progression --message="Setting up source files..." --weight=1 + +# Download, check integrity, uncompress and patch the source from app.src +ynh_setup_source --dest_dir="$install_dir" + +chmod 750 "$install_dir" +chmod -R o-rwx "$install_dir" +chown -R $app:www-data "$install_dir" + #================================================= # NGINX CONFIGURATION #================================================= @@ -34,12 +46,6 @@ ynh_add_nginx_config # BUILD APP #================================================= -cd $install_dir -ynh_exec_warn_less git clone https://github.com/terraforming-mars/terraforming-mars.git - -cd $install_dir/terraforming-mars -ynh_exec_warn_less git checkout $TM_version - pushd $install_dir/terraforming-mars ynh_use_nodejs From 78ec1cb31268610d86a07ff773b23622241f2a09 Mon Sep 17 00:00:00 2001 From: Thomas <51749973+Thovi98@users.noreply.github.com> Date: Tue, 12 Dec 2023 14:38:03 +0100 Subject: [PATCH 06/30] Fix SHA sum --- manifest.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.toml b/manifest.toml index 181e616..532e64e 100644 --- a/manifest.toml +++ b/manifest.toml @@ -46,7 +46,7 @@ ram.runtime = "50M" [resources.sources.main] url = "https://codeload.github.com/terraforming-mars/terraforming-mars/tar.gz/78e5e5d0433e4d1632639ea7da1a1993672bd82a" - sha256 = "b41cfe80334495a4653bc3933298597c232474c309c5993e388068e33d7f13ce" + sha256 = "ad4e3107b42d61aac93546887f01714f6ef2d0ed84fb6f7c6f8178bf60264e1f" autoupdate.strategy = "latest_github_tag" [resources.system_user] From 83e1c0b6abc76ea7de3e3d9ba78430e4343907b4 Mon Sep 17 00:00:00 2001 From: Thomas <51749973+Thovi98@users.noreply.github.com> Date: Tue, 12 Dec 2023 14:43:37 +0100 Subject: [PATCH 07/30] fix pushd dir --- scripts/install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install b/scripts/install index 128606d..4cb95f0 100755 --- a/scripts/install +++ b/scripts/install @@ -46,7 +46,7 @@ ynh_add_nginx_config # BUILD APP #================================================= -pushd $install_dir/terraforming-mars +pushd $install_dir ynh_use_nodejs ynh_script_progression --message="npm install... This can be very long, be patient !" --weight=18 From 35e8a429fac242abbd8c10922bf03d28905fe979 Mon Sep 17 00:00:00 2001 From: Thomas <51749973+Thovi98@users.noreply.github.com> Date: Tue, 12 Dec 2023 14:52:11 +0100 Subject: [PATCH 08/30] pin nodejs --- scripts/_common.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/_common.sh b/scripts/_common.sh index cb02d34..c40e687 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -5,7 +5,7 @@ #================================================= # nodejs version -nodejs_version=16 +nodejs_version=16.13.2 # Terraforming-mars commit TM_version="78e5e5d" From f05046f21972aab08345d7b928f403f2860309d3 Mon Sep 17 00:00:00 2001 From: Thomas <51749973+Thovi98@users.noreply.github.com> Date: Tue, 12 Dec 2023 14:57:00 +0100 Subject: [PATCH 09/30] fix npm command --- scripts/install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install b/scripts/install index 4cb95f0..fd0b731 100755 --- a/scripts/install +++ b/scripts/install @@ -50,7 +50,7 @@ pushd $install_dir ynh_use_nodejs ynh_script_progression --message="npm install... This can be very long, be patient !" --weight=18 - ynh_exec_warn_less env $ynh_node_load_PATH $ynh_npm install --network-timeout=100000 + ynh_exec_warn_less env $ynh_node_load_PATH $ynh_npm ci --quiet --network-timeout=100000 ynh_script_progression --message="npm run build... This can be very long, be patient !" --weight=25 ynh_exec_warn_less env $ynh_node_load_PATH $ynh_npm run build From c832b7eec059334211202ee9895c6d3206ad29a2 Mon Sep 17 00:00:00 2001 From: Thomas <51749973+Thovi98@users.noreply.github.com> Date: Tue, 12 Dec 2023 15:05:37 +0100 Subject: [PATCH 10/30] Update npm command --- scripts/install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install b/scripts/install index fd0b731..27683eb 100755 --- a/scripts/install +++ b/scripts/install @@ -50,7 +50,7 @@ pushd $install_dir ynh_use_nodejs ynh_script_progression --message="npm install... This can be very long, be patient !" --weight=18 - ynh_exec_warn_less env $ynh_node_load_PATH $ynh_npm ci --quiet --network-timeout=100000 + ynh_exec_warn_less env $ynh_node_load_PATH $ynh_npm ci --quiet --production --prefer-offline --network-timeout=100000 ynh_script_progression --message="npm run build... This can be very long, be patient !" --weight=25 ynh_exec_warn_less env $ynh_node_load_PATH $ynh_npm run build From 4a0ebcbd4124fbae30528aaa197f3e4ee3706ae6 Mon Sep 17 00:00:00 2001 From: Thomas <51749973+Thovi98@users.noreply.github.com> Date: Tue, 12 Dec 2023 15:17:46 +0100 Subject: [PATCH 11/30] Update npm --- scripts/install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install b/scripts/install index 27683eb..8ca80a6 100755 --- a/scripts/install +++ b/scripts/install @@ -17,7 +17,7 @@ ynh_script_progression --message="Installing dependencies..." --weight=5 ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version # Upgrade NPM -ynh_npm install --global npm@6.14.18 +ynh_npm install --global npm@8.1.2 #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE From 3d9ceb016c73a002b931a2f666fce5db7ac342f7 Mon Sep 17 00:00:00 2001 From: Thomas <51749973+Thovi98@users.noreply.github.com> Date: Tue, 12 Dec 2023 15:45:22 +0100 Subject: [PATCH 12/30] fix exec as $app --- scripts/install | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/install b/scripts/install index 8ca80a6..67630e2 100755 --- a/scripts/install +++ b/scripts/install @@ -50,10 +50,10 @@ pushd $install_dir ynh_use_nodejs ynh_script_progression --message="npm install... This can be very long, be patient !" --weight=18 - ynh_exec_warn_less env $ynh_node_load_PATH $ynh_npm ci --quiet --production --prefer-offline --network-timeout=100000 + ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH $ynh_npm ci --quiet --production --prefer-offline --network-timeout=100000 ynh_script_progression --message="npm run build... This can be very long, be patient !" --weight=25 - ynh_exec_warn_less env $ynh_node_load_PATH $ynh_npm run build + ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH $ynh_npm run build popd chmod 750 "$install_dir" From 7dfc40bbbf55ef214f62f8c96e8d992594517787 Mon Sep 17 00:00:00 2001 From: Thomas <51749973+Thovi98@users.noreply.github.com> Date: Tue, 12 Dec 2023 15:59:30 +0100 Subject: [PATCH 13/30] git init? --- scripts/install | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/install b/scripts/install index 67630e2..60a16e7 100755 --- a/scripts/install +++ b/scripts/install @@ -52,6 +52,8 @@ pushd $install_dir ynh_script_progression --message="npm install... This can be very long, be patient !" --weight=18 ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH $ynh_npm ci --quiet --production --prefer-offline --network-timeout=100000 + git init + ynh_script_progression --message="npm run build... This can be very long, be patient !" --weight=25 ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH $ynh_npm run build popd From 730cab2f8e8f9932285413b0b7e765ce6ccf1b09 Mon Sep 17 00:00:00 2001 From: Thomas <51749973+Thovi98@users.noreply.github.com> Date: Tue, 12 Dec 2023 16:14:54 +0100 Subject: [PATCH 14/30] Update install --- scripts/install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install b/scripts/install index 60a16e7..920c2ed 100755 --- a/scripts/install +++ b/scripts/install @@ -52,7 +52,7 @@ pushd $install_dir ynh_script_progression --message="npm install... This can be very long, be patient !" --weight=18 ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH $ynh_npm ci --quiet --production --prefer-offline --network-timeout=100000 - git init + ynh_exec_as $app git init ynh_script_progression --message="npm run build... This can be very long, be patient !" --weight=25 ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH $ynh_npm run build From 229d9329cb9cb28db1e3c731c445fa9d93b5ac1c Mon Sep 17 00:00:00 2001 From: Thomas <51749973+Thovi98@users.noreply.github.com> Date: Tue, 12 Dec 2023 16:30:39 +0100 Subject: [PATCH 15/30] Update install --- scripts/install | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/install b/scripts/install index 920c2ed..31a8ae6 100755 --- a/scripts/install +++ b/scripts/install @@ -53,6 +53,7 @@ pushd $install_dir ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH $ynh_npm ci --quiet --production --prefer-offline --network-timeout=100000 ynh_exec_as $app git init + ynh_exec_as $app git add . ynh_script_progression --message="npm run build... This can be very long, be patient !" --weight=25 ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH $ynh_npm run build From 04951267e2f63dc5bd3710fdc7e1368830bbca36 Mon Sep 17 00:00:00 2001 From: Thomas <51749973+Thovi98@users.noreply.github.com> Date: Tue, 12 Dec 2023 16:47:14 +0100 Subject: [PATCH 16/30] Update install --- scripts/install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install b/scripts/install index 31a8ae6..b7a6a4c 100755 --- a/scripts/install +++ b/scripts/install @@ -53,7 +53,7 @@ pushd $install_dir ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH $ynh_npm ci --quiet --production --prefer-offline --network-timeout=100000 ynh_exec_as $app git init - ynh_exec_as $app git add . + ynh_exec_as $app git commit --allow-empty -m "first commit" ynh_script_progression --message="npm run build... This can be very long, be patient !" --weight=25 ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH $ynh_npm run build From 2a0ac94989122758829a73b1594f18ef1c32613a Mon Sep 17 00:00:00 2001 From: Thomas <51749973+Thovi98@users.noreply.github.com> Date: Tue, 12 Dec 2023 17:04:26 +0100 Subject: [PATCH 17/30] Update install --- scripts/install | 3 --- 1 file changed, 3 deletions(-) diff --git a/scripts/install b/scripts/install index b7a6a4c..67630e2 100755 --- a/scripts/install +++ b/scripts/install @@ -52,9 +52,6 @@ pushd $install_dir ynh_script_progression --message="npm install... This can be very long, be patient !" --weight=18 ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH $ynh_npm ci --quiet --production --prefer-offline --network-timeout=100000 - ynh_exec_as $app git init - ynh_exec_as $app git commit --allow-empty -m "first commit" - ynh_script_progression --message="npm run build... This can be very long, be patient !" --weight=25 ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH $ynh_npm run build popd From a79f782f9df8dc0795ffe0362fb9de9e3149f830 Mon Sep 17 00:00:00 2001 From: Thomas <51749973+Thovi98@users.noreply.github.com> Date: Tue, 12 Dec 2023 18:04:59 +0100 Subject: [PATCH 18/30] in_subdir = true --- manifest.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/manifest.toml b/manifest.toml index 532e64e..316a36f 100644 --- a/manifest.toml +++ b/manifest.toml @@ -47,6 +47,7 @@ ram.runtime = "50M" [resources.sources.main] url = "https://codeload.github.com/terraforming-mars/terraforming-mars/tar.gz/78e5e5d0433e4d1632639ea7da1a1993672bd82a" sha256 = "ad4e3107b42d61aac93546887f01714f6ef2d0ed84fb6f7c6f8178bf60264e1f" + in_subdir = true autoupdate.strategy = "latest_github_tag" [resources.system_user] From 2a0184e9c31502e873387efd714c3db2df3b4f3c Mon Sep 17 00:00:00 2001 From: Alexandre Aubin <4533074+alexAubin@users.noreply.github.com> Date: Wed, 13 Dec 2023 15:51:40 +0100 Subject: [PATCH 19/30] Update scripts/install: define SOURCE_VERSION which is used during build when not in a git repo --- scripts/install | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/install b/scripts/install index 67630e2..7a3ee27 100755 --- a/scripts/install +++ b/scripts/install @@ -53,6 +53,7 @@ pushd $install_dir ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH $ynh_npm ci --quiet --production --prefer-offline --network-timeout=100000 ynh_script_progression --message="npm run build... This can be very long, be patient !" --weight=25 + export SOURCE_VERSION="$(cat YNH_APP_BASEDIR/manifest.toml | toml_to_json | jq -r ".resources.sources.main.url" | awk -F/ '{ print $NF }')" ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH $ynh_npm run build popd From 2ef25743483b139927640c86e8fbbbd7edd6f0af Mon Sep 17 00:00:00 2001 From: Thomas <51749973+Thovi98@users.noreply.github.com> Date: Wed, 13 Dec 2023 16:02:36 +0100 Subject: [PATCH 20/30] missing $ --- scripts/install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install b/scripts/install index 7a3ee27..7d51a88 100755 --- a/scripts/install +++ b/scripts/install @@ -53,7 +53,7 @@ pushd $install_dir ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH $ynh_npm ci --quiet --production --prefer-offline --network-timeout=100000 ynh_script_progression --message="npm run build... This can be very long, be patient !" --weight=25 - export SOURCE_VERSION="$(cat YNH_APP_BASEDIR/manifest.toml | toml_to_json | jq -r ".resources.sources.main.url" | awk -F/ '{ print $NF }')" + export SOURCE_VERSION="$(cat $YNH_APP_BASEDIR/manifest.toml | toml_to_json | jq -r ".resources.sources.main.url" | awk -F/ '{ print $NF }')" ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH $ynh_npm run build popd From 16925cde7f39721ff350609501e28e2581be0951 Mon Sep 17 00:00:00 2001 From: Thomas <51749973+Thovi98@users.noreply.github.com> Date: Wed, 13 Dec 2023 16:38:48 +0100 Subject: [PATCH 21/30] test adding SOURCE_VERSION to command --- scripts/install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install b/scripts/install index 7d51a88..6fbbcc3 100755 --- a/scripts/install +++ b/scripts/install @@ -54,7 +54,7 @@ pushd $install_dir ynh_script_progression --message="npm run build... This can be very long, be patient !" --weight=25 export SOURCE_VERSION="$(cat $YNH_APP_BASEDIR/manifest.toml | toml_to_json | jq -r ".resources.sources.main.url" | awk -F/ '{ print $NF }')" - ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH $ynh_npm run build + ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH $SOURCE_VERSION $ynh_npm run build popd chmod 750 "$install_dir" From 09ddd088aa2f73f381bb3a447731bce159241bb7 Mon Sep 17 00:00:00 2001 From: Alexandre Aubin <4533074+alexAubin@users.noreply.github.com> Date: Wed, 13 Dec 2023 16:39:53 +0100 Subject: [PATCH 22/30] Update scripts/install: fix env syntax --- scripts/install | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/install b/scripts/install index 6fbbcc3..f441599 100755 --- a/scripts/install +++ b/scripts/install @@ -53,8 +53,8 @@ pushd $install_dir ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH $ynh_npm ci --quiet --production --prefer-offline --network-timeout=100000 ynh_script_progression --message="npm run build... This can be very long, be patient !" --weight=25 - export SOURCE_VERSION="$(cat $YNH_APP_BASEDIR/manifest.toml | toml_to_json | jq -r ".resources.sources.main.url" | awk -F/ '{ print $NF }')" - ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH $SOURCE_VERSION $ynh_npm run build + SOURCE_VERSION="$(cat $YNH_APP_BASEDIR/manifest.toml | toml_to_json | jq -r ".resources.sources.main.url" | awk -F/ '{ print $NF }')" + ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH SOURCE_VERSION="$SOURCE_VERSION" $ynh_npm run build popd chmod 750 "$install_dir" From 66077e6e4d4eb476d8f573615c5688b92ae56454 Mon Sep 17 00:00:00 2001 From: Alexandre Aubin <4533074+alexAubin@users.noreply.github.com> Date: Wed, 13 Dec 2023 16:57:51 +0100 Subject: [PATCH 23/30] Update scripts/install: attempt to fix the issue with html-escaper --- scripts/install | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/install b/scripts/install index f441599..a7cdb79 100755 --- a/scripts/install +++ b/scripts/install @@ -51,6 +51,7 @@ pushd $install_dir ynh_script_progression --message="npm install... This can be very long, be patient !" --weight=18 ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH $ynh_npm ci --quiet --production --prefer-offline --network-timeout=100000 + ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH $ynh_npm install --save-dev @types/html-escaper ynh_script_progression --message="npm run build... This can be very long, be patient !" --weight=25 SOURCE_VERSION="$(cat $YNH_APP_BASEDIR/manifest.toml | toml_to_json | jq -r ".resources.sources.main.url" | awk -F/ '{ print $NF }')" From 5b290d5a3c1b5be66223d8286a5053a9f347e31c Mon Sep 17 00:00:00 2001 From: Thomas <51749973+Thovi98@users.noreply.github.com> Date: Wed, 13 Dec 2023 17:09:55 +0100 Subject: [PATCH 24/30] adapt working directory to the ynh_setup_source --- conf/systemd.service | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/systemd.service b/conf/systemd.service index 674e703..7a2780d 100644 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -7,7 +7,7 @@ After=network-online.target Type=simple User=__APP__ Group=__APP__ -WorkingDirectory=__INSTALL_DIR__/terraforming-mars +WorkingDirectory=__INSTALL_DIR__ EnvironmentFile=__INSTALL_DIR__/.env Environment="__YNH_NODE_LOAD_PATH__" Environment=NODE_ENV=production From 838f6f16f46d64067afe2d0428bfaa5dd62a10bd Mon Sep 17 00:00:00 2001 From: Thomas <51749973+Thovi98@users.noreply.github.com> Date: Wed, 13 Dec 2023 18:57:01 +0100 Subject: [PATCH 25/30] cleanup --- scripts/restore | 9 +++++++++ scripts/upgrade | 31 ++++++++++++++++++------------- 2 files changed, 27 insertions(+), 13 deletions(-) diff --git a/scripts/restore b/scripts/restore index baa934a..9c5f77c 100755 --- a/scripts/restore +++ b/scripts/restore @@ -10,6 +10,15 @@ source ../settings/scripts/_common.sh source /usr/share/yunohost/helpers +#================================================= +# REINSTALL DEPENDENCIES +#================================================= +ynh_script_progression --message="Reinstalling dependencies..." --weight=10 + +ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version + +ynh_npm install --global npm@8.1.2 + #================================================= # RESTORE THE APP MAIN DIR #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index a6b04cd..76a8e5e 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -21,6 +21,18 @@ ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version # Upgrade NPM ynh_npm install --global npm@6.14.18 +#================================================= +# DOWNLOAD, CHECK AND UNPACK SOURCE +#================================================= +ynh_script_progression --message="Setting up source files..." --weight=1 + +# Download, check integrity, uncompress and patch the source from app.src +ynh_setup_source --dest_dir="$install_dir" + +chmod 750 "$install_dir" +chmod -R o-rwx "$install_dir" +chown -R $app:www-data "$install_dir" + #================================================= # STANDARD UPGRADE STEPS #================================================= @@ -31,26 +43,19 @@ 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" #================================================= -# "REBUILD" THE APP (DEPLOY NEW SOURCES, RERUN NPM BUILD...) -#================================================= -# DOWNLOAD, CHECK AND UNPACK SOURCE +# BUILD APP #================================================= -cd $install_dir -ynh_secure_remove terraforming-mars -ynh_exec_warn_less git clone https://github.com/terraforming-mars/terraforming-mars.git - -cd $install_dir/terraforming-mars -ynh_exec_warn_less git checkout $TM_version - -pushd $install_dir/terraforming-mars +pushd $install_dir ynh_use_nodejs ynh_script_progression --message="npm install... This can be very long, be patient !" --weight=18 - ynh_exec_warn_less env $ynh_node_load_PATH $ynh_npm install --network-timeout=100000 + ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH $ynh_npm ci --quiet --production --prefer-offline --network-timeout=100000 + ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH $ynh_npm install --save-dev @types/html-escaper ynh_script_progression --message="npm run build... This can be very long, be patient !" --weight=25 - ynh_exec_warn_less env $ynh_node_load_PATH $ynh_npm run build + SOURCE_VERSION="$(cat $YNH_APP_BASEDIR/manifest.toml | toml_to_json | jq -r ".resources.sources.main.url" | awk -F/ '{ print $NF }')" + ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH SOURCE_VERSION="$SOURCE_VERSION" $ynh_npm run build popd chmod 750 "$install_dir" From 4c9af6ae2a4378aa600360648bffc2700da78dbe Mon Sep 17 00:00:00 2001 From: Thomas <51749973+Thovi98@users.noreply.github.com> Date: Wed, 13 Dec 2023 20:00:47 +0100 Subject: [PATCH 26/30] fix upgrade --- scripts/upgrade | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/upgrade b/scripts/upgrade index 76a8e5e..78534a6 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -27,7 +27,7 @@ ynh_npm install --global npm@6.14.18 ynh_script_progression --message="Setting up source files..." --weight=1 # 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" --full_replace chmod 750 "$install_dir" chmod -R o-rwx "$install_dir" From 16eaa811743c2d9b8d5eb879658a1ecd3a1499f7 Mon Sep 17 00:00:00 2001 From: Thomas <51749973+Thovi98@users.noreply.github.com> Date: Wed, 13 Dec 2023 20:15:03 +0100 Subject: [PATCH 27/30] latest_github_commit instead of tag --- manifest.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.toml b/manifest.toml index 316a36f..75f7363 100644 --- a/manifest.toml +++ b/manifest.toml @@ -48,7 +48,7 @@ ram.runtime = "50M" url = "https://codeload.github.com/terraforming-mars/terraforming-mars/tar.gz/78e5e5d0433e4d1632639ea7da1a1993672bd82a" sha256 = "ad4e3107b42d61aac93546887f01714f6ef2d0ed84fb6f7c6f8178bf60264e1f" in_subdir = true - autoupdate.strategy = "latest_github_tag" + autoupdate.strategy = "latest_github_commit" [resources.system_user] From bc7b0367abe6097c4024cd513bdcf2199d7fb6df Mon Sep 17 00:00:00 2001 From: Thomas <51749973+Thovi98@users.noreply.github.com> Date: Wed, 13 Dec 2023 20:40:02 +0100 Subject: [PATCH 28/30] full_replace=1 --- scripts/upgrade | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/upgrade b/scripts/upgrade index 78534a6..e891cc4 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -27,7 +27,7 @@ ynh_npm install --global npm@6.14.18 ynh_script_progression --message="Setting up source files..." --weight=1 # Download, check integrity, uncompress and patch the source from app.src -ynh_setup_source --dest_dir="$install_dir" --full_replace +ynh_setup_source --dest_dir="$install_dir" --full_replace=1 chmod 750 "$install_dir" chmod -R o-rwx "$install_dir" From ace12128b96315fab95df92257a9488b238bd016 Mon Sep 17 00:00:00 2001 From: Thomas <51749973+Thovi98@users.noreply.github.com> Date: Wed, 13 Dec 2023 21:28:33 +0100 Subject: [PATCH 29/30] change install order --- scripts/install | 28 ++++++++++++++-------------- scripts/upgrade | 14 +++++++++++++- 2 files changed, 27 insertions(+), 15 deletions(-) diff --git a/scripts/install b/scripts/install index a7cdb79..9bf5f96 100755 --- a/scripts/install +++ b/scripts/install @@ -42,6 +42,20 @@ ynh_add_nginx_config #================================================= # SPECIFIC SETUP #================================================= +#================================================= +# ADD A CONFIGURATION +#================================================= +ynh_script_progression --message="Adding a configuration file..." + + +key=$(ynh_string_random --length=45 | base64) +ynh_app_setting_set --app=$app --key=key --value=$key + +ynh_add_config --template="../conf/.env" --destination="$install_dir/.env" + +chmod 600 "$install_dir/.env" +chown $app:$app "$install_dir/.env" + #================================================= # BUILD APP #================================================= @@ -62,20 +76,6 @@ chmod 750 "$install_dir" chmod -R o-rwx "$install_dir" chown -R $app:$app "$install_dir" -#================================================= -# ADD A CONFIGURATION -#================================================= -ynh_script_progression --message="Adding a configuration file..." - - -key=$(ynh_string_random --length=45 | base64) -ynh_app_setting_set --app=$app --key=key --value=$key - -ynh_add_config --template="../conf/.env" --destination="$install_dir/.env" - -chmod 600 "$install_dir/.env" -chown $app:$app "$install_dir/.env" - #================================================= # SETUP SYSTEMD #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index e891cc4..ccb8e94 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -19,7 +19,7 @@ ynh_script_progression --message="Installing dependencies..." --weight=5 ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version # Upgrade NPM -ynh_npm install --global npm@6.14.18 +ynh_npm install --global npm@8.1.2 #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE @@ -42,6 +42,18 @@ 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" +#================================================= +# RECONFIGURE THE APP (UPDATE CONF, APPLY MIGRATIONS...) +#================================================= +# UPDATE A CONFIG FILE +#================================================= +ynh_script_progression --message="Updating a configuration file..." --weight=1 + +ynh_add_config --template="../conf/.env" --destination="$install_dir/.env" + +chmod 400 "$install_dir/.env" +chown $app:$app "$install_dir/.env" + #================================================= # BUILD APP #================================================= From 3e2dd96256081c5415e7a9ee786f2644568a1ffd Mon Sep 17 00:00:00 2001 From: Thomas <51749973+Thovi98@users.noreply.github.com> Date: Wed, 13 Dec 2023 21:29:11 +0100 Subject: [PATCH 30/30] remove legacy code --- scripts/_common.sh | 3 --- 1 file changed, 3 deletions(-) diff --git a/scripts/_common.sh b/scripts/_common.sh index c40e687..5fc0a5a 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -7,9 +7,6 @@ # nodejs version nodejs_version=16.13.2 -# Terraforming-mars commit -TM_version="78e5e5d" - #================================================= # PERSONAL HELPERS #=================================================