From 810a21046ce10133ceef39bcea2bf836d9020924 Mon Sep 17 00:00:00 2001 From: Mayel de Borniol Date: Sun, 14 Apr 2024 22:22:22 +0100 Subject: [PATCH 01/10] update --- conf/.env | 7 +++++++ manifest.toml | 8 +++++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/conf/.env b/conf/.env index 0c1fcbd..0ab817c 100644 --- a/conf/.env +++ b/conf/.env @@ -1,3 +1,4 @@ + MIX_ENV=prod FLAVOUR=classic @@ -82,3 +83,9 @@ GITHUB_TOKEN= TX_TOKEN= ## END OF SECRETS ## + +ENABLE_IMAGE_VIX=1 + +# enable these two if deps fetching is failing +# HEX_HTTP_CONCURRENCY=1 +# HEX_HTTP_TIMEOUT=120 diff --git a/manifest.toml b/manifest.toml index d50c7bf..d647e7b 100644 --- a/manifest.toml +++ b/manifest.toml @@ -50,7 +50,7 @@ ram.runtime = "500M" ask.fr = "Choisissez la langue de l'application" type = "select" choices = ["fr", "en"] - default = "fr" + default = "en" [install.admin] type = "user" @@ -91,8 +91,10 @@ ram.runtime = "500M" [resources.sources] [resources.sources.main] - url = "https://github.com/bonfire-networks/bonfire-app/archive/184bbda72efbdddbdd94afb4b3790591414b5cbe.tar.gz" - sha256 = "60b49d30549b9eb0b7308e82fcd7697d4d12d2722dbd53fdb6fe563f1e399059" + url = "https://github.com/bonfire-networks/bonfire-app/archive/refs/tags/v0.9.10-beta.35.tar.gz" + sha256 = "fe3b91be59e78b305cbbcf651be78701bc10204ebd198565f9526da745ba2cd4" + + autoupdate.strategy = "latest_github_tag" [resources.ports] From e4afca58e4275a44bf86e00a733623c313227c70 Mon Sep 17 00:00:00 2001 From: Mayel de Borniol Date: Sun, 14 Apr 2024 22:39:03 +0100 Subject: [PATCH 02/10] bump --- manifest.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/manifest.toml b/manifest.toml index d647e7b..44987a5 100644 --- a/manifest.toml +++ b/manifest.toml @@ -91,8 +91,8 @@ ram.runtime = "500M" [resources.sources] [resources.sources.main] - url = "https://github.com/bonfire-networks/bonfire-app/archive/refs/tags/v0.9.10-beta.35.tar.gz" - sha256 = "fe3b91be59e78b305cbbcf651be78701bc10204ebd198565f9526da745ba2cd4" + url = "https://github.com/bonfire-networks/bonfire-app/archive/refs/tags/v0.9.10-beta.36.tar.gz" + sha256 = "919e8072bcf80cc17f992d0b95d2bf03507896ba5a4b5104e80632e9024e6a16" autoupdate.strategy = "latest_github_tag" From ff49c2709a16ac4f129943faf4e3a770f4255e3d Mon Sep 17 00:00:00 2001 From: Mayel de Borniol Date: Tue, 16 Apr 2024 15:25:04 +0100 Subject: [PATCH 03/10] clarify progress --- scripts/install | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/scripts/install b/scripts/install index 011626a..37b1244 100644 --- a/scripts/install +++ b/scripts/install @@ -62,23 +62,23 @@ chown $app:$app "$install_dir/.env" source $install_dir/.env export WITH_DOCKER=no # or source .env ? # Using this for now +export TERM=linux # why is that not defined ? +export TERMINFO=/etc/terminfo -ynh_script_progression --message="Configuring Bonfire release..." --weight=1 +ynh_script_progression --message="Preparing Bonfire release..." --weight=1 cd $install_dir #ynh_exec_warn_less ynh_exec_as $app -s $SHELL -lc "mise plugin add erlang https://github.com/asdf-vm/asdf-erlang.git" # add erlang as source #ynh_exec_warn_less ynh_exec_as $app -s $SHELL -lc "mise install" # install Elixir -ynh_exec_warn_less ynh_exec_as $app -s $SHELL -lc "WITH_DOCKER=no $ynh_node_load_PATH mix local.hex --force" # install Hex in non-interractive way -ynh_exec_warn_less ynh_exec_as $app -s $SHELL -lc "WITH_DOCKER=no $ynh_node_load_PATH just config-basic" -#ynh_exec_warn_less ynh_exec_as $app -s $SHELL -lc "WITH_DOCKER=no $ynh_node_load_PATH just mix bonfire.deps .update" +ynh_exec_warn_less ynh_exec_as $app -s $SHELL -lc "$ynh_node_load_PATH mix local.hex --force" # install Hex in non-interractive way +### DONT USE GLOBAL NPM INSTALL +ynh_replace_string --match_string="npm install --global" --replace_string="npm install" --target_file="$install_dir/justfile" #================================================= # Building the release #================================================= -ynh_script_progression --message="Building Bonfire release... (This will take a long time)" --weight=1 -export TERM=linux # why is that not defined ? -export TERMINFO=/etc/terminfo -### DONT USE GLOBAL NPM INSTALL -ynh_replace_string --match_string="npm install --global" --replace_string="npm install" --target_file="$install_dir/justfile" +ynh_script_progression --message="Building Bonfire release... (this will take a long time)" --weight=1 +ynh_exec_warn_less ynh_exec_as $app -s $SHELL -lc "WITH_DOCKER=no $ynh_node_load_PATH just config-basic" +#ynh_exec_warn_less ynh_exec_as $app -s $SHELL -lc "WITH_DOCKER=no $ynh_node_load_PATH just mix bonfire.deps.update" ynh_exec_warn_less ynh_exec_as $app -s $SHELL -lc "WITH_DOCKER=no $ynh_node_load_PATH just rel-build" #================================================= From dc0419d1fac8f48de7639575c1685790f85ce60d Mon Sep 17 00:00:00 2001 From: Mayel de Borniol Date: Tue, 16 Apr 2024 15:35:27 +0100 Subject: [PATCH 04/10] first attempt at using a release instead of source code --- manifest.toml | 33 ++++++++++++++++++++------------- scripts/install | 18 ++++++++++-------- 2 files changed, 30 insertions(+), 21 deletions(-) diff --git a/manifest.toml b/manifest.toml index 44987a5..19184f7 100644 --- a/manifest.toml +++ b/manifest.toml @@ -91,10 +91,17 @@ ram.runtime = "500M" [resources.sources] [resources.sources.main] - url = "https://github.com/bonfire-networks/bonfire-app/archive/refs/tags/v0.9.10-beta.36.tar.gz" - sha256 = "919e8072bcf80cc17f992d0b95d2bf03507896ba5a4b5104e80632e9024e6a16" + # TODO: multiple architectures + url = "https://github.com/bonfire-networks/bonfire-app/releases/download/v0.9.10-beta.61/bonfire-classic-amd64-debian-bullseye.tar.gz" + sha256 = "8bc36f1c10e63659d0a286d82b5fd38233f545e7100fb03e63db4b0de7b6fe8d" - autoupdate.strategy = "latest_github_tag" + autoupdate.strategy = "latest_github_release" + + [resources.sources.deps_install] + url = "https://github.com/bonfire-networks/bonfire-app/raw/v0.9.10-beta.61/deps-debian.sh" + sha256 = "82829587f40183df7c2a4525dda3c1ff349319a10eafd3ea5368b7d643deb468" + format = "script" + rename = "deps-debian.sh" [resources.ports] @@ -108,20 +115,20 @@ ram.runtime = "500M" [resources.apt] - packages = "erlang-dev erlang-parsetools erlang-os-mon erlang-tools erlang-xmerl postgresql npm node-postcss" + # packages = "erlang-dev erlang-parsetools erlang-os-mon erlang-tools erlang-xmerl postgresql npm node-postcss" ##### (this part is optional and corresponds to the legacy ynh_install_extra_app_dependencies helper) ### Yarn dependency (correct version) - 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"] + # 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"] ### Elixir 13 dependency - instead of v15 for now - extras.elixir13.repo = "deb https://packages.erlang-solutions.com/debian bullseye contrib" - extras.elixir13.key = "https://packages.erlang-solutions.com/debian/erlang_solutions.asc" - extras.elixir13.packages = ["elixir"] + # extras.elixir13.repo = "deb https://packages.erlang-solutions.com/debian bullseye contrib" + # extras.elixir13.key = "https://packages.erlang-solutions.com/debian/erlang_solutions.asc" + # extras.elixir13.packages = ["elixir"] ### Elixir 15 dependency # Bulleyes comes with v1.10 instead of v1.15 that is required # ynh_install_extra_app_dependencies --repo="https://packages.erlang-solutions.com/debian bullseye contrib" --package="elixir-lang" --key='https://packages.erlang-solutions.com/debian/erlang_solutions.asc' @@ -140,9 +147,9 @@ ram.runtime = "500M" # TODO : this is unsafe and should be dealt with in a better way. # There is currently no proper way to install it simply on Debian 11 https://github.com/casey/just#packages # only works for x86, we need to switch to the other option with makedeb package ? - extras.just.repo = "deb https://proget.makedeb.org prebuilt-mpr bullseye" - extras.just.key = "https://proget.makedeb.org/debian-feeds/prebuilt-mpr.pub" - extras.just.packages = ["just"] + # extras.just.repo = "deb https://proget.makedeb.org prebuilt-mpr bullseye" + # extras.just.key = "https://proget.makedeb.org/debian-feeds/prebuilt-mpr.pub" + # extras.just.packages = ["just"] [resources.database] diff --git a/scripts/install b/scripts/install index 37b1244..8e6bd05 100644 --- a/scripts/install +++ b/scripts/install @@ -12,10 +12,12 @@ source /usr/share/yunohost/helpers #================================================= # INSTALL DEPENDENCIES #================================================= -ynh_script_progression --message="Installing nodejs..." +ynh_script_progression --message="Installing dependencies..." -ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version -ynh_use_nodejs +ynh_exec_warn_less "./deps-debian.sh" + +# ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version +# ynh_use_nodejs #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE @@ -69,17 +71,17 @@ ynh_script_progression --message="Preparing Bonfire release..." --weight=1 cd $install_dir #ynh_exec_warn_less ynh_exec_as $app -s $SHELL -lc "mise plugin add erlang https://github.com/asdf-vm/asdf-erlang.git" # add erlang as source #ynh_exec_warn_less ynh_exec_as $app -s $SHELL -lc "mise install" # install Elixir -ynh_exec_warn_less ynh_exec_as $app -s $SHELL -lc "$ynh_node_load_PATH mix local.hex --force" # install Hex in non-interractive way +# ynh_exec_warn_less ynh_exec_as $app -s $SHELL -lc "$ynh_node_load_PATH mix local.hex --force" # install Hex in non-interractive way ### DONT USE GLOBAL NPM INSTALL -ynh_replace_string --match_string="npm install --global" --replace_string="npm install" --target_file="$install_dir/justfile" +# ynh_replace_string --match_string="npm install --global" --replace_string="npm install" --target_file="$install_dir/justfile" #================================================= # Building the release #================================================= -ynh_script_progression --message="Building Bonfire release... (this will take a long time)" --weight=1 -ynh_exec_warn_less ynh_exec_as $app -s $SHELL -lc "WITH_DOCKER=no $ynh_node_load_PATH just config-basic" +# ynh_script_progression --message="Building Bonfire release... (this will take a long time)" --weight=1 +# ynh_exec_warn_less ynh_exec_as $app -s $SHELL -lc "WITH_DOCKER=no $ynh_node_load_PATH just config-basic" #ynh_exec_warn_less ynh_exec_as $app -s $SHELL -lc "WITH_DOCKER=no $ynh_node_load_PATH just mix bonfire.deps.update" -ynh_exec_warn_less ynh_exec_as $app -s $SHELL -lc "WITH_DOCKER=no $ynh_node_load_PATH just rel-build" +# ynh_exec_warn_less ynh_exec_as $app -s $SHELL -lc "WITH_DOCKER=no $ynh_node_load_PATH just rel-build" #================================================= # START SYSTEMD SERVICE - Run the release From 822a0f7839507fe5bbbea33e35f3ea9e4f3af17e Mon Sep 17 00:00:00 2001 From: Mayel de Borniol Date: Tue, 16 Apr 2024 17:23:57 +0100 Subject: [PATCH 05/10] install works, still need to debug systemd start --- conf/systemd.service | 4 +--- manifest.toml | 5 +++-- scripts/install | 31 ++++++++++++++++++------------- 3 files changed, 22 insertions(+), 18 deletions(-) diff --git a/conf/systemd.service b/conf/systemd.service index 67de51f..0d9eade 100644 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -7,9 +7,7 @@ Type=simple User=__APP__ Group=__APP__ WorkingDirectory=__INSTALL_DIR__/ -Environment=NODE_ENV=production -Environment="__YNH_NODE_LOAD_PATH__" -ExecStart=just cmd __INSTALL_DIR__/_build/prod/rel/bonfire/bin/bonfire start daemon +ExecStart=just cmd __INSTALL_DIR__/bin/bonfire start daemon StandardOutput=append:/var/log/__APP__/__APP__.log StandardError=inherit diff --git a/manifest.toml b/manifest.toml index 19184f7..ec14a82 100644 --- a/manifest.toml +++ b/manifest.toml @@ -98,10 +98,11 @@ ram.runtime = "500M" autoupdate.strategy = "latest_github_release" [resources.sources.deps_install] - url = "https://github.com/bonfire-networks/bonfire-app/raw/v0.9.10-beta.61/deps-debian.sh" - sha256 = "82829587f40183df7c2a4525dda3c1ff349319a10eafd3ea5368b7d643deb468" + url = "https://github.com/bonfire-networks/bonfire-app/raw/main/deps-debian.sh" + sha256 = "dc6a7fd593d092aec22782da01ac370a4ae318d4e9135cb7b594d2379a35de8f" format = "script" rename = "deps-debian.sh" + extract = false [resources.ports] diff --git a/scripts/install b/scripts/install index 8e6bd05..bae89fb 100644 --- a/scripts/install +++ b/scripts/install @@ -9,26 +9,31 @@ source _common.sh source /usr/share/yunohost/helpers -#================================================= -# INSTALL DEPENDENCIES -#================================================= -ynh_script_progression --message="Installing dependencies..." - -ynh_exec_warn_less "./deps-debian.sh" - -# ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version -# ynh_use_nodejs - #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= ynh_script_progression --message="Setting up source files..." --weight=1 +# Download deps install script +ynh_setup_source --source_id=deps_install --dest_dir="$install_dir" + # Download, check integrity, uncompress and patch the source from app.src ynh_setup_source --dest_dir="$install_dir" chmod -R o-rwx "$install_dir" chown -R $app:www-data "$install_dir" +chmod +x "$install_dir/deps-debian.sh" +ls -la "$install_dir" + +#================================================= +# INSTALL DEPENDENCIES +#================================================= +ynh_script_progression --message="Installing dependencies..." + +ynh_exec_warn_less "HOME=$install_dir $install_dir/deps-debian.sh" + +# ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version +# ynh_use_nodejs #================================================= # NGINX CONFIGURATION @@ -57,7 +62,6 @@ ynh_store_file_checksum --file="$install_dir/.env" chmod 400 "$install_dir/.env" chown $app:$app "$install_dir/.env" - #================================================= # SPECIFIC SETUP #================================================= @@ -66,6 +70,7 @@ source $install_dir/.env export WITH_DOCKER=no # or source .env ? # Using this for now export TERM=linux # why is that not defined ? export TERMINFO=/etc/terminfo +export PATH="$PATH:$install_dir/.local/share/mise/shims" ynh_script_progression --message="Preparing Bonfire release..." --weight=1 cd $install_dir @@ -86,7 +91,7 @@ cd $install_dir #================================================= # START SYSTEMD SERVICE - Run the release #================================================= -release_folder="_build/prod/rel/bonfire" +release_folder="./" ### Not running the migration, they are done on startup anyway #ynh_script_progression --message="Running database migrations..." --weight=1 @@ -116,7 +121,7 @@ ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$ap # CREATE ADMIN USER #================================================= ynh_script_progression --message="Creating admin user account..." --weight=1 -ynh_exec_warn_less ynh_exec_as $app -s $SHELL -lc "WITH_DOCKER=no just cmd /var/www/bonfire/_build/prod/rel/bonfire/bin/bonfire rpc 'Bonfire.Me.make_account_and_user(\"$admin\", \"$(ynh_user_get_info --username=\"$admin\" --key=mail)\", \"$password\")'" +ynh_exec_warn_less ynh_exec_as $app -s $SHELL -lc "WITH_DOCKER=no just cmd $install_dir/bin/bonfire rpc 'Bonfire.Me.make_account_and_user(\"$admin\", \"$(ynh_user_get_info --username=\"$admin\" --key=mail)\", \"$password\")'" #================================================= # END OF SCRIPT From 88c74d6ed32d97f9378cfdb2838d421c6f1e7cac Mon Sep 17 00:00:00 2001 From: Mayel de Borniol <115318+mayel@users.noreply.github.com> Date: Tue, 16 Apr 2024 18:44:40 +0100 Subject: [PATCH 06/10] Update manifest.toml --- manifest.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.toml b/manifest.toml index ec14a82..2449604 100644 --- a/manifest.toml +++ b/manifest.toml @@ -116,7 +116,7 @@ ram.runtime = "500M" [resources.apt] - # packages = "erlang-dev erlang-parsetools erlang-os-mon erlang-tools erlang-xmerl postgresql npm node-postcss" + packages = "postgresql" ##### (this part is optional and corresponds to the legacy ynh_install_extra_app_dependencies helper) From 996d4624837f853823f51f9130a6d59fd102a959 Mon Sep 17 00:00:00 2001 From: Mayel de Borniol <115318+mayel@users.noreply.github.com> Date: Tue, 16 Apr 2024 19:06:31 +0100 Subject: [PATCH 07/10] Update systemd.service --- conf/systemd.service | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/conf/systemd.service b/conf/systemd.service index 0d9eade..9233ced 100644 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -7,7 +7,7 @@ Type=simple User=__APP__ Group=__APP__ WorkingDirectory=__INSTALL_DIR__/ -ExecStart=just cmd __INSTALL_DIR__/bin/bonfire start daemon +ExecStart=__INSTALL_DIR__/bin/bonfire start daemon StandardOutput=append:/var/log/__APP__/__APP__.log StandardError=inherit From 2fe9dcb606626241a5735a1ab054608423311709 Mon Sep 17 00:00:00 2001 From: Mayel de Borniol <115318+mayel@users.noreply.github.com> Date: Tue, 16 Apr 2024 19:07:26 +0100 Subject: [PATCH 08/10] Update install --- scripts/install | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/install b/scripts/install index bae89fb..497ea89 100644 --- a/scripts/install +++ b/scripts/install @@ -121,7 +121,7 @@ ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$ap # CREATE ADMIN USER #================================================= ynh_script_progression --message="Creating admin user account..." --weight=1 -ynh_exec_warn_less ynh_exec_as $app -s $SHELL -lc "WITH_DOCKER=no just cmd $install_dir/bin/bonfire rpc 'Bonfire.Me.make_account_and_user(\"$admin\", \"$(ynh_user_get_info --username=\"$admin\" --key=mail)\", \"$password\")'" +ynh_exec_warn_less ynh_exec_as $app -s $SHELL -lc "$install_dir/bin/bonfire rpc 'Bonfire.Me.make_account_and_user(\"$admin\", \"$(ynh_user_get_info --username=\"$admin\" --key=mail)\", \"$password\")'" #================================================= # END OF SCRIPT From 43c407012380a5ee2fcda8cf0e7296c785c0b3c6 Mon Sep 17 00:00:00 2001 From: Mayel de Borniol Date: Tue, 16 Apr 2024 20:35:05 +0100 Subject: [PATCH 09/10] add env & update deps --- conf/systemd.service | 1 + manifest.toml | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/conf/systemd.service b/conf/systemd.service index 9233ced..db155c0 100644 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -7,6 +7,7 @@ Type=simple User=__APP__ Group=__APP__ WorkingDirectory=__INSTALL_DIR__/ +EnvironmentFile=__INSTALL_DIR__/.env ExecStart=__INSTALL_DIR__/bin/bonfire start daemon StandardOutput=append:/var/log/__APP__/__APP__.log StandardError=inherit diff --git a/manifest.toml b/manifest.toml index 2449604..05d1340 100644 --- a/manifest.toml +++ b/manifest.toml @@ -98,8 +98,8 @@ ram.runtime = "500M" autoupdate.strategy = "latest_github_release" [resources.sources.deps_install] - url = "https://github.com/bonfire-networks/bonfire-app/raw/main/deps-debian.sh" - sha256 = "dc6a7fd593d092aec22782da01ac370a4ae318d4e9135cb7b594d2379a35de8f" + url = "https://github.com/bonfire-networks/bonfire-app/raw/a57ad00dd18bfe558fc398938f19c92b48c60ff6/deps-debian.sh" + sha256 = "56624dc90719e2182f8116e63d9784079ce47e19892410f37ce5aa3de2a22b57" format = "script" rename = "deps-debian.sh" extract = false From e977f7111e584478e1b30b4d44ba6a5c60403180 Mon Sep 17 00:00:00 2001 From: Mayel de Borniol Date: Tue, 16 Apr 2024 21:14:18 +0100 Subject: [PATCH 10/10] comment upgrade build --- scripts/upgrade | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index 66c276c..f537f9c 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -40,9 +40,10 @@ chown -R $app:www-data "$install_dir" ynh_script_progression --message="Building Bonfire release... (This will take a long time)" --weight=1 export TERM=linux # why is that not defined ? export TERMINFO=/etc/terminfo + ### DONT USE GLOBAL NPM INSTALL -ynh_replace_string --match_string="npm install --global" --replace_string="npm install" --target_file="$install_dir/justfile" -ynh_exec_warn_less ynh_exec_as $app -s $SHELL -lc "WITH_DOCKER=no $ynh_node_load_PATH just rel-build" +# ynh_replace_string --match_string="npm install --global" --replace_string="npm install" --target_file="$install_dir/justfile" +# ynh_exec_warn_less ynh_exec_as $app -s $SHELL -lc "WITH_DOCKER=no $ynh_node_load_PATH just rel-build" #================================================= # RECONFIGURE THE APP (UPDATE CONF, APPLY MIGRATIONS...)