From 886768dd426355e8328c9019567b2d46ebfe120b Mon Sep 17 00:00:00 2001 From: tituspijean Date: Thu, 9 Jun 2022 21:52:21 +0200 Subject: [PATCH 01/16] Fix auto-updater --- .github/workflows/updater.sh | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/.github/workflows/updater.sh b/.github/workflows/updater.sh index fad26c3..9f1ee63 100644 --- a/.github/workflows/updater.sh +++ b/.github/workflows/updater.sh @@ -18,7 +18,7 @@ current_version=$(cat manifest.json | jq -j '.version|split("~")[0]') repo=$(cat manifest.json | jq -j '.upstream.code|split("https://github.com/")[1]') # Some jq magic is needed, because the latest upstream release is not always the latest version (e.g. security patches for older versions) version=$(curl --silent "https://api.github.com/repos/$repo/releases" | jq -r '.[] | select( .prerelease != true ) | .tag_name' | sort -V | tail -1) -assets=($(curl --silent "https://api.github.com/repos/$repo/releases" | jq -r '[ .[] | select(.tag_name=="'$version'").assets[].browser_download_url ] | join(" ") | @sh' | tr -d "'")) +assets=($(curl --silent "https://api.github.com/repos/$repo/releases" | jq -r '[ .[] | select(.tag_name=="'$version'").zipball_url ] | join(" ") | @sh' | tr -d "'")) admin_repo="TryGhost/Admin" assets+=("https://github.com/TryGhost/Admin/archive/refs/tags/${version}.zip") @@ -67,7 +67,7 @@ echo "Handling asset at $asset_url" # Here we base the source file name upon a unique keyword in the assets url (admin vs. update) # Leave $src empty to ignore the asset case $asset_url in - *"Ghost-"*".zip") + *"/Ghost/"*) src="app" ;; *"/Admin/"*) @@ -92,19 +92,12 @@ checksum=$(sha256sum "$tempdir/$filename" | head -c 64) # Delete temporary directory rm -rf $tempdir -# Get extension -if [[ $filename == *.tar.gz ]]; then - extension=tar.gz -else - extension=${filename##*.} -fi - # Rewrite source file cat < conf/$src.src SOURCE_URL=$asset_url SOURCE_SUM=$checksum SOURCE_SUM_PRG=sha256sum -SOURCE_FORMAT=$extension +SOURCE_FORMAT=zip SOURCE_IN_SUBDIR=false EOT echo "... conf/$src.src updated" @@ -117,8 +110,8 @@ fi done -if [ $count == 0 ]; then - echo "::warning ::None of the assets were processed." +if [ $count -lt 2 ]; then + echo "::warning ::Some assets were not processed." exit 0 fi From b7bf95006e289e4280fdc8747f1690452407ce62 Mon Sep 17 00:00:00 2001 From: tituspijean Date: Thu, 9 Jun 2022 21:52:58 +0200 Subject: [PATCH 02/16] Update app.src for v5.2.2 --- conf/app.src | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/conf/app.src b/conf/app.src index 9164fd2..dd1c80e 100644 --- a/conf/app.src +++ b/conf/app.src @@ -1,5 +1,5 @@ -SOURCE_URL=https://github.com/TryGhost/Ghost/releases/download/v4.40.0/Ghost-4.40.0.zip -SOURCE_SUM=c0ad20deb45984e70211f50e31271c9a204cc7eba3f9488a115d3f6bcc0fe3d7 +SOURCE_URL=https://api.github.com/repos/TryGhost/Ghost/zipball/v5.2.2 +SOURCE_SUM=0a4841756dde09dfd43e79180d6f59e159ae4c681ef7a89d8f5769b8ce944aa3 SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=zip SOURCE_IN_SUBDIR=false From 9cef9cfc2250307a55feee14120b51105657e9cb Mon Sep 17 00:00:00 2001 From: tituspijean Date: Thu, 7 Jul 2022 22:45:43 +0200 Subject: [PATCH 03/16] Fix all the things --- .github/workflows/updater.sh | 22 +++++++++++++++++----- conf/admin.src | 6 +++--- conf/app.src | 6 +++--- conf/casper.src | 5 +++++ manifest.json | 2 +- scripts/install | 5 +++++ scripts/upgrade | 5 +++++ 7 files changed, 39 insertions(+), 12 deletions(-) create mode 100644 conf/casper.src diff --git a/.github/workflows/updater.sh b/.github/workflows/updater.sh index 9f1ee63..a5b6d11 100644 --- a/.github/workflows/updater.sh +++ b/.github/workflows/updater.sh @@ -14,14 +14,24 @@ #================================================= # Fetching information -current_version=$(cat manifest.json | jq -j '.version|split("~")[0]') -repo=$(cat manifest.json | jq -j '.upstream.code|split("https://github.com/")[1]') # Some jq magic is needed, because the latest upstream release is not always the latest version (e.g. security patches for older versions) + +current_version=$(cat manifest.json | jq -j '.version|split("~")[0]') + +# CORE +# repo=$(cat manifest.json | jq -j '.upstream.code|split("https://github.com/")[1]') +repo="TryGhost/Ghost" version=$(curl --silent "https://api.github.com/repos/$repo/releases" | jq -r '.[] | select( .prerelease != true ) | .tag_name' | sort -V | tail -1) assets=($(curl --silent "https://api.github.com/repos/$repo/releases" | jq -r '[ .[] | select(.tag_name=="'$version'").zipball_url ] | join(" ") | @sh' | tr -d "'")) +# ADMIN admin_repo="TryGhost/Admin" -assets+=("https://github.com/TryGhost/Admin/archive/refs/tags/${version}.zip") +assets+=("https://github.com/$admin_repo/archive/refs/tags/${version}.zip") + +# THEME +theme_repo="TryGhost/Casper" +theme_version=$(curl --silent "https://api.github.com/repos/$theme_repo/releases" | jq -r '.[] | select( .prerelease != true ) | .tag_name' | sort -V | tail -1) +assets+=("https://github.com/$theme_repo/archive/refs/tags/${version}.zip") # Later down the script, we assume the version has only digits and dots # Sometimes the release name starts with a "v", so let's filter it out. @@ -73,6 +83,9 @@ case $asset_url in *"/Admin/"*) src="admin" ;; + *"/Casper/"*) + src="casper" + ;; *) src="" ;; @@ -98,7 +111,7 @@ SOURCE_URL=$asset_url SOURCE_SUM=$checksum SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=zip -SOURCE_IN_SUBDIR=false +SOURCE_IN_SUBDIR=true EOT echo "... conf/$src.src updated" @@ -134,4 +147,3 @@ echo "$(jq -s --indent 4 ".[] | .version = \"$version~ynh1\"" manifest.json)" > # The Action will proceed only if the PROCEED environment variable is set to true echo "PROCEED=true" >> $GITHUB_ENV exit 0 - diff --git a/conf/admin.src b/conf/admin.src index e34aa75..bd1b4db 100644 --- a/conf/admin.src +++ b/conf/admin.src @@ -1,5 +1,5 @@ -SOURCE_URL=https://github.com/TryGhost/Admin/archive/refs/tags/v5.2.2.zip -SOURCE_SUM=20f1aea329107ad1ef9c128b6727a73316a2ff3dfdf5f143735506d6a988d249 +SOURCE_URL=https://github.com/TryGhost/Admin/archive/refs/tags/v5.2.4.zip +SOURCE_SUM=b23d9d053fc30897f1851170a675c4d01fc615f409262f94d1bc85cfd5932605 SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=zip -SOURCE_IN_SUBDIR=false +SOURCE_IN_SUBDIR=true diff --git a/conf/app.src b/conf/app.src index dd1c80e..2b99bd0 100644 --- a/conf/app.src +++ b/conf/app.src @@ -1,5 +1,5 @@ -SOURCE_URL=https://api.github.com/repos/TryGhost/Ghost/zipball/v5.2.2 -SOURCE_SUM=0a4841756dde09dfd43e79180d6f59e159ae4c681ef7a89d8f5769b8ce944aa3 +SOURCE_URL=https://api.github.com/repos/TryGhost/Ghost/zipball/v5.2.4 +SOURCE_SUM=04ba64fd6f7ecb0ba0970eb63189b5b5780095260bce5d4edd2b50e25d0a316b SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=zip -SOURCE_IN_SUBDIR=false +SOURCE_IN_SUBDIR=true diff --git a/conf/casper.src b/conf/casper.src new file mode 100644 index 0000000..2be34af --- /dev/null +++ b/conf/casper.src @@ -0,0 +1,5 @@ +SOURCE_URL=https://github.com/TryGhost/Casper/archive/refs/tags/v5.2.4.zip +SOURCE_SUM=d5558cd419c8d46bdc958064cb97f963d1ea793866414c025906ec15033512ed +SOURCE_SUM_PRG=sha256sum +SOURCE_FORMAT=zip +SOURCE_IN_SUBDIR=true diff --git a/manifest.json b/manifest.json index ec6a20e..3b22f98 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Publishing, memberships, subscriptions and newsletters platform", "fr": "Plateforme d'édition, d'adhésions, d'abonnements et de newsletters" }, - "version": "5.2.2~ynh1", + "version": "5.2.4~ynh1", "url": "https://ghost.org/", "upstream": { "license": "MIT", diff --git a/scripts/install b/scripts/install index 0f7fd56..f628627 100644 --- a/scripts/install +++ b/scripts/install @@ -103,6 +103,10 @@ ynh_setup_source --dest_dir="$final_path" mkdir -p $final_path/core/client/Admin ynh_setup_source --dest_dir="$final_path/core/client/Admin" --source_id="admin" +# Download, check integrity, uncompress and patch the source from casper.src +mkdir -p $final_path/content/themes/casper +ynh_setup_source --dest_dir="$final_path/content/themes/casper" --source_id="casper" + chmod 750 "$final_path" chmod -R o-rwx "$final_path" chown -R $app:www-data "$final_path" @@ -134,6 +138,7 @@ ynh_script_progression --message="Building Ghost... (this will take some time an pushd "$final_path" ynh_use_nodejs ynh_exec_warn_less ynh_exec_as $app $ynh_node_load_PATH yarn install --non-interactive + ynh_exec_warn_less ynh_exec_as $app $ynh_node_load_PATH yarn add knex-migrator ynh_exec_warn_less ynh_exec_as $app $ynh_node_load_PATH $final_path/node_modules/.bin/knex-migrator init ynh_exec_warn_less ynh_exec_as $app $ynh_node_load_PATH $final_path/node_modules/.bin/grunt symlink ynh_exec_warn_less ynh_exec_as $app $ynh_node_load_PATH $final_path/node_modules/.bin/grunt init --force diff --git a/scripts/upgrade b/scripts/upgrade index 304bc31..e7f8598 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -107,6 +107,10 @@ then mkdir -p $final_path/core/client/Admin ynh_setup_source --dest_dir="$final_path/core/client/Admin" --source_id="admin" + # Download, check integrity, uncompress and patch the source from casper.src + mkdir -p $final_path/content/themes/casper + ynh_setup_source --dest_dir="$final_path/content/themes/casper" --source_id="casper" + # Copy the admin saved settings from tmp directory to final path cp -ar "$tmpdir/config.production.json" "$final_path/config.production.json" @@ -163,6 +167,7 @@ then pushd "$final_path" ynh_exec_warn_less ynh_exec_as $app $ynh_node_load_PATH yarn install --non-interactive + ynh_exec_warn_less ynh_exec_as $app $ynh_node_load_PATH yarn add knex-migrator ynh_exec_warn_less ynh_exec_as $app $ynh_node_load_PATH $final_path/node_modules/.bin/knex-migrator init ynh_exec_warn_less ynh_exec_as $app $ynh_node_load_PATH $final_path/node_modules/.bin/grunt symlink ynh_exec_warn_less ynh_exec_as $app $ynh_node_load_PATH $final_path/node_modules/.bin/grunt init --force From b74d6e3ad9ec4a74c91cd402cb7312dbd6a42cf2 Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Thu, 7 Jul 2022 20:46:09 +0000 Subject: [PATCH 04/16] 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 37cb059..1ff54ed 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in Publishing, memberships, subscriptions and newsletters platform -**Shipped version:** 5.2.2~ynh1 +**Shipped version:** 5.2.4~ynh1 ## Screenshots diff --git a/README_fr.md b/README_fr.md index 0ce2198..e6d5a6f 100644 --- a/README_fr.md +++ b/README_fr.md @@ -17,7 +17,7 @@ Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour Plateforme d'édition, d'adhésions, d'abonnements et de newsletters -**Version incluse :** 5.2.2~ynh1 +**Version incluse :** 5.2.4~ynh1 ## Captures d'écran From a76ecacb2d7e3992be4532b2cfcd24fd901728ce Mon Sep 17 00:00:00 2001 From: tituspijean Date: Thu, 7 Jul 2022 23:00:00 +0200 Subject: [PATCH 05/16] Fix Casper source and updater --- .github/workflows/updater.sh | 2 +- conf/casper.src | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/updater.sh b/.github/workflows/updater.sh index a5b6d11..8e449f7 100644 --- a/.github/workflows/updater.sh +++ b/.github/workflows/updater.sh @@ -31,7 +31,7 @@ assets+=("https://github.com/$admin_repo/archive/refs/tags/${version}.zip") # THEME theme_repo="TryGhost/Casper" theme_version=$(curl --silent "https://api.github.com/repos/$theme_repo/releases" | jq -r '.[] | select( .prerelease != true ) | .tag_name' | sort -V | tail -1) -assets+=("https://github.com/$theme_repo/archive/refs/tags/${version}.zip") +assets+=("https://github.com/$theme_repo/archive/refs/tags/${theme_version}.zip") # Later down the script, we assume the version has only digits and dots # Sometimes the release name starts with a "v", so let's filter it out. diff --git a/conf/casper.src b/conf/casper.src index 2be34af..7ca2b10 100644 --- a/conf/casper.src +++ b/conf/casper.src @@ -1,5 +1,5 @@ -SOURCE_URL=https://github.com/TryGhost/Casper/archive/refs/tags/v5.2.4.zip -SOURCE_SUM=d5558cd419c8d46bdc958064cb97f963d1ea793866414c025906ec15033512ed +SOURCE_URL=https://github.com/TryGhost/Casper/archive/refs/tags/v5.1.5.zip +SOURCE_SUM=ad883bf9e3ded051b21e4f2473cbcf32bdacdd8258f29bc45c4fdc0e3fc3e57f SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=zip SOURCE_IN_SUBDIR=true From 7d34728349085ce3228ef2cf916b5e62e4de701f Mon Sep 17 00:00:00 2001 From: tituspijean Date: Fri, 8 Jul 2022 19:21:29 +0200 Subject: [PATCH 06/16] Fix Admin destination directory --- scripts/install | 2 +- scripts/upgrade | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/install b/scripts/install index f628627..945ee8b 100644 --- a/scripts/install +++ b/scripts/install @@ -101,7 +101,7 @@ ynh_setup_source --dest_dir="$final_path" # Download, check integrity, uncompress and patch the source from admin.src mkdir -p $final_path/core/client/Admin -ynh_setup_source --dest_dir="$final_path/core/client/Admin" --source_id="admin" +ynh_setup_source --dest_dir="$final_path/core/admin" --source_id="admin" # Download, check integrity, uncompress and patch the source from casper.src mkdir -p $final_path/content/themes/casper diff --git a/scripts/upgrade b/scripts/upgrade index e7f8598..395cb71 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -105,7 +105,7 @@ then # Download, check integrity, uncompress and patch the source from admin.src mkdir -p $final_path/core/client/Admin - ynh_setup_source --dest_dir="$final_path/core/client/Admin" --source_id="admin" + ynh_setup_source --dest_dir="$final_path/core/admin" --source_id="admin" # Download, check integrity, uncompress and patch the source from casper.src mkdir -p $final_path/content/themes/casper From 05857a6ca9a3e78849aa8773b226a1d25a38db99 Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Fri, 15 Jul 2022 06:20:15 +0000 Subject: [PATCH 07/16] Upgrade to v5.3.1 --- conf/admin.src | 4 ++-- manifest.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/conf/admin.src b/conf/admin.src index bd1b4db..9439c4f 100644 --- a/conf/admin.src +++ b/conf/admin.src @@ -1,5 +1,5 @@ -SOURCE_URL=https://github.com/TryGhost/Admin/archive/refs/tags/v5.2.4.zip -SOURCE_SUM=b23d9d053fc30897f1851170a675c4d01fc615f409262f94d1bc85cfd5932605 +SOURCE_URL=https://github.com/TryGhost/Admin/archive/refs/tags/v5.3.1.zip +SOURCE_SUM=e877de2f2d1c262e4fc284bf419fe75a72ad0640412a8eb0dcbc7b5721abef88 SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=zip SOURCE_IN_SUBDIR=true diff --git a/manifest.json b/manifest.json index 3b22f98..07b4148 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Publishing, memberships, subscriptions and newsletters platform", "fr": "Plateforme d'édition, d'adhésions, d'abonnements et de newsletters" }, - "version": "5.2.4~ynh1", + "version": "5.3.1~ynh1", "url": "https://ghost.org/", "upstream": { "license": "MIT", From 3766a150befe9b76dab60c7323dd531fdf115b0f Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Fri, 15 Jul 2022 06:20:20 +0000 Subject: [PATCH 08/16] 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 1ff54ed..f7b56cd 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in Publishing, memberships, subscriptions and newsletters platform -**Shipped version:** 5.2.4~ynh1 +**Shipped version:** 5.3.1~ynh1 ## Screenshots diff --git a/README_fr.md b/README_fr.md index e6d5a6f..8196878 100644 --- a/README_fr.md +++ b/README_fr.md @@ -17,7 +17,7 @@ Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour Plateforme d'édition, d'adhésions, d'abonnements et de newsletters -**Version incluse :** 5.2.4~ynh1 +**Version incluse :** 5.3.1~ynh1 ## Captures d'écran From b08858b934b21e46d82490610b222840de890a87 Mon Sep 17 00:00:00 2001 From: Yunohost-Bot <> Date: Sun, 7 Aug 2022 20:12:22 +0200 Subject: [PATCH 09/16] =?UTF-8?q?[autopatch]=20Add=20Common=20Platform?= =?UTF-8?q?=C2=A0Enumeration=20id=20to=20`manifest.json`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- manifest.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/manifest.json b/manifest.json index ec6a20e..e218c8f 100644 --- a/manifest.json +++ b/manifest.json @@ -12,7 +12,8 @@ "license": "MIT", "website": "https://ghost.org/", "admindoc": "https://ghost.org/help/", - "code": "https://github.com/TryGhost/Ghost" + "code": "https://github.com/TryGhost/Ghost", + "cpe": "cpe:2.3:a:ghost:ghost" }, "license": "MIT", "maintainer": { @@ -50,4 +51,4 @@ } ] } -} +} \ No newline at end of file From 61616f907d21af2e54326c18971e94913e866a1d Mon Sep 17 00:00:00 2001 From: Badri Date: Thu, 11 Aug 2022 10:03:06 +0530 Subject: [PATCH 10/16] Update to v5.8.3 and use new install format Ghost has significantly changed their file structure, which means the scripts had to be changed around quite a bit as well. We are also using the readymade `yarn setup` tool to set up the Ghost installation instead of manually running each command. Significant changes are: - Config and content now lives under ./ghost/core instead of being directly in the project root. While updating, for backward compatibility, we're checking for the existence of the old folder as well - The admin interface is bundled along with the main Ghost package, so there is no need to download it separately (Casper is still being downloaded separately though) - We are using `yarn start` instead of knex, grunt, etc. (`yarn start` automatically calls those commands for us behind the scenes) - Similarly, we are now running `yarn start` to execute the Ghost process in the systemd config, instead of manually running `index.js` as we were doing earlier. Fresh installs work well on this commit, though upgrades are yet to be tested! --- conf/app.src | 4 ++-- conf/casper.src | 4 ++-- conf/systemd.service | 3 ++- scripts/change_url | 6 +++--- scripts/install | 21 +++++++-------------- scripts/upgrade | 40 ++++++++++++++++++++++++---------------- 6 files changed, 40 insertions(+), 38 deletions(-) diff --git a/conf/app.src b/conf/app.src index 2b99bd0..3553922 100644 --- a/conf/app.src +++ b/conf/app.src @@ -1,5 +1,5 @@ -SOURCE_URL=https://api.github.com/repos/TryGhost/Ghost/zipball/v5.2.4 -SOURCE_SUM=04ba64fd6f7ecb0ba0970eb63189b5b5780095260bce5d4edd2b50e25d0a316b +SOURCE_URL=https://api.github.com/repos/TryGhost/Ghost/zipball/v5.8.3 +SOURCE_SUM=557c39864483fff00beeb60e27d84915e184845c69db3be83dcd7a65f327d497 SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=zip SOURCE_IN_SUBDIR=true diff --git a/conf/casper.src b/conf/casper.src index 7ca2b10..d635bb2 100644 --- a/conf/casper.src +++ b/conf/casper.src @@ -1,5 +1,5 @@ -SOURCE_URL=https://github.com/TryGhost/Casper/archive/refs/tags/v5.1.5.zip -SOURCE_SUM=ad883bf9e3ded051b21e4f2473cbcf32bdacdd8258f29bc45c4fdc0e3fc3e57f +SOURCE_URL=https://github.com/TryGhost/Casper/archive/refs/tags/v5.2.3.zip +SOURCE_SUM=49d57ce078a2775f39d019ed74fa4ae9476e95fa35b02593c726c0ea25fe49df SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=zip SOURCE_IN_SUBDIR=true diff --git a/conf/systemd.service b/conf/systemd.service index 38c6c70..a0e74da 100644 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -9,7 +9,8 @@ Group=__APP__ WorkingDirectory=__FINALPATH__ Environment="__YNH_NODE_LOAD_PATH__" Environment="NODE_ENV=production" -ExecStart=__YNH_NODE__ index.js run +#ExecStart=__YNH_NODE__ core/index.js run +ExecStart=yarn start Restart=always # Sandboxing options to harden security diff --git a/scripts/change_url b/scripts/change_url index 6173e14..d7bfda0 100644 --- a/scripts/change_url +++ b/scripts/change_url @@ -124,9 +124,9 @@ fi #================================================= ynh_script_progression --message="Modifying a config file..." -ynh_add_config --template="../conf/config.production.json" --destination="$final_path/config.production.json" -chmod 400 "$final_path/config.production.json" -chown $app:$app "$final_path/config.production.json" +ynh_add_config --template="../conf/config.production.json" --destination="$final_path/ghost/core/config.production.json" +chmod 400 "$final_path/ghost/core/config.production.json" +chown $app:$app "$final_path/ghost/core/config.production.json" #================================================= # GENERIC FINALISATION diff --git a/scripts/install b/scripts/install index 945ee8b..d3eebf2 100644 --- a/scripts/install +++ b/scripts/install @@ -99,13 +99,9 @@ ynh_app_setting_set --app=$app --key=final_path --value=$final_path # Download, check integrity, uncompress and patch the source from app.src ynh_setup_source --dest_dir="$final_path" -# Download, check integrity, uncompress and patch the source from admin.src -mkdir -p $final_path/core/client/Admin -ynh_setup_source --dest_dir="$final_path/core/admin" --source_id="admin" - # Download, check integrity, uncompress and patch the source from casper.src -mkdir -p $final_path/content/themes/casper -ynh_setup_source --dest_dir="$final_path/content/themes/casper" --source_id="casper" +mkdir -p $final_path/ghost/core/content/themes/casper +ynh_setup_source --dest_dir="$final_path/ghost/core/content/themes/casper" --source_id="casper" chmod 750 "$final_path" chmod -R o-rwx "$final_path" @@ -126,9 +122,9 @@ ynh_add_nginx_config #================================================= ynh_script_progression --message="Modifying a config file..." -ynh_add_config --template="../conf/config.production.json" --destination="$final_path/config.production.json" -chmod 400 "$final_path/config.production.json" -chown $app:$app "$final_path/config.production.json" +ynh_add_config --template="../conf/config.production.json" --destination="$final_path/ghost/core/config.production.json" +chmod 400 "$final_path/ghost/core/config.production.json" +chown $app:$app "$final_path/ghost/core/config.production.json" #============================================== # BUILD GHOST @@ -137,11 +133,8 @@ ynh_script_progression --message="Building Ghost... (this will take some time an pushd "$final_path" ynh_use_nodejs - ynh_exec_warn_less ynh_exec_as $app $ynh_node_load_PATH yarn install --non-interactive - ynh_exec_warn_less ynh_exec_as $app $ynh_node_load_PATH yarn add knex-migrator - ynh_exec_warn_less ynh_exec_as $app $ynh_node_load_PATH $final_path/node_modules/.bin/knex-migrator init - ynh_exec_warn_less ynh_exec_as $app $ynh_node_load_PATH $final_path/node_modules/.bin/grunt symlink - ynh_exec_warn_less ynh_exec_as $app $ynh_node_load_PATH $final_path/node_modules/.bin/grunt init --force + ynh_exec_warn_less ynh_exec_as $app $ynh_node_load_PATH yarn add knex-migrator ember-cli --dev --ignore-workspace-root-check --non-interactive + ynh_exec_warn_less ynh_exec_as $app $ynh_node_load_PATH yarn setup # catch-all command provided by Ghost that handles all the setup popd #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 395cb71..d0cde84 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -92,10 +92,24 @@ then tmpdir="$(mktemp -d)" # Copy the admin saved settings from final path to tmp directory - cp -ar "$final_path/config.production.json" "$tmpdir/config.production.json" + if [ -d "$final_path/config.production.json" ] + then + # Old versions of Ghost store it here + cp -ar "$final_path/config.production.json" "$tmpdir/config.production.json" + else + # New versions of Ghost store it here + cp -ar "$final_path/ghost/core/config.production.json" "$tmpdir/config.production.json" + fi # Backup the content folder to the temp dir - cp -ar "$final_path/content" "$tmpdir/content" + if [ -d "$final_path/config.production.json" ] + then + # Old versions of Ghost store it here + cp -ar "$final_path/content" "$tmpdir/content" + else + # New versions of Ghost store it here + cp -ar "$final_path/ghost/core/content" "$tmpdir/content" + fi # Remove the app directory securely ynh_secure_remove --file=$final_path @@ -103,19 +117,15 @@ then # Download, check integrity, uncompress and patch the source from app.src ynh_setup_source --dest_dir=$final_path - # Download, check integrity, uncompress and patch the source from admin.src - mkdir -p $final_path/core/client/Admin - ynh_setup_source --dest_dir="$final_path/core/admin" --source_id="admin" - # Download, check integrity, uncompress and patch the source from casper.src mkdir -p $final_path/content/themes/casper - ynh_setup_source --dest_dir="$final_path/content/themes/casper" --source_id="casper" + ynh_setup_source --dest_dir="$final_path/ghost/core/content/themes/casper" --source_id="casper" # Copy the admin saved settings from tmp directory to final path - cp -ar "$tmpdir/config.production.json" "$final_path/config.production.json" + cp -ar "$tmpdir/config.production.json" "$final_path/ghost/core/config.production.json" # Copy content folder back to the final_path - cp -ar "$tmpdir/content" "${final_path}" + cp -ar "$tmpdir/content" "${final_path}/ghost/core" # Remove the tmp directory securely ynh_secure_remove --file="$tmpdir" @@ -153,9 +163,9 @@ ynh_install_extra_app_dependencies --repo="deb https://dl.yarnpkg.com/debian/ st #================================================= ynh_script_progression --message="Modifying a config file..." -ynh_add_config --template="../conf/config.production.json" --destination="$final_path/config.production.json" -chmod 400 "$final_path/config.production.json" -chown $app:$app "$final_path/config.production.json" +ynh_add_config --template="../conf/config.production.json" --destination="$final_path/ghost/core/config.production.json" +chmod 400 "$final_path/ghost/core/config.production.json" +chown $app:$app "$final_path/ghost/core/config.production.json" #============================================== # BUILD GHOST @@ -167,10 +177,8 @@ then pushd "$final_path" ynh_exec_warn_less ynh_exec_as $app $ynh_node_load_PATH yarn install --non-interactive - ynh_exec_warn_less ynh_exec_as $app $ynh_node_load_PATH yarn add knex-migrator - ynh_exec_warn_less ynh_exec_as $app $ynh_node_load_PATH $final_path/node_modules/.bin/knex-migrator init - ynh_exec_warn_less ynh_exec_as $app $ynh_node_load_PATH $final_path/node_modules/.bin/grunt symlink - ynh_exec_warn_less ynh_exec_as $app $ynh_node_load_PATH $final_path/node_modules/.bin/grunt init --force + ynh_exec_warn_less ynh_exec_as $app $ynh_node_load_PATH yarn add knex-migrator ember-cli --dev --ignore-workspace-root-check --non-interactive + ynh_exec_warn_less ynh_exec_as $app $ynh_node_load_PATH yarn setup popd fi From 07f830d03bb30340b092eecbd96847d45e5db47c Mon Sep 17 00:00:00 2001 From: Badri Date: Fri, 12 Aug 2022 14:11:15 +0530 Subject: [PATCH 11/16] Fix update script: file check Instead of checking for the existence of a file, we were checking if config.production.json was a directory! Obviously, this would end up failing (unless you've done something very strange with your Ghost setup). --- scripts/upgrade | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/upgrade b/scripts/upgrade index d0cde84..d3ce02f 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -92,7 +92,7 @@ then tmpdir="$(mktemp -d)" # Copy the admin saved settings from final path to tmp directory - if [ -d "$final_path/config.production.json" ] + if [ -f "$final_path/config.production.json" ] then # Old versions of Ghost store it here cp -ar "$final_path/config.production.json" "$tmpdir/config.production.json" @@ -102,7 +102,7 @@ then fi # Backup the content folder to the temp dir - if [ -d "$final_path/config.production.json" ] + if [ -f "$final_path/config.production.json" ] then # Old versions of Ghost store it here cp -ar "$final_path/content" "$tmpdir/content" From 05605efdad177709c544d4dac00993a65c60b4cd Mon Sep 17 00:00:00 2001 From: Badri Date: Fri, 12 Aug 2022 14:12:05 +0530 Subject: [PATCH 12/16] Update version in manifest.json I already fixed everything else, but forgot to bump the version number here :P Not bumping the README because apparently there's a YunoHost bot that updates it automatically? --- manifest.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/manifest.json b/manifest.json index 07b4148..f5ab178 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Publishing, memberships, subscriptions and newsletters platform", "fr": "Plateforme d'édition, d'adhésions, d'abonnements et de newsletters" }, - "version": "5.3.1~ynh1", + "version": "5.8.3~ynh1", "url": "https://ghost.org/", "upstream": { "license": "MIT", From dec480e706a729c916959cbc394e431c67afd7e2 Mon Sep 17 00:00:00 2001 From: Badri Date: Fri, 12 Aug 2022 14:23:45 +0530 Subject: [PATCH 13/16] Remove conf/admin.src because admin is pre-bundled now We used to download the admin source files separately from Ghost's Admin repo, but now they're done some restructuring so it's all bundled along with the main Ghost monorepo. We'd already stopped using this file for the last few commits, but now we're removing it completely. --- conf/admin.src | 5 ----- 1 file changed, 5 deletions(-) delete mode 100644 conf/admin.src diff --git a/conf/admin.src b/conf/admin.src deleted file mode 100644 index 9439c4f..0000000 --- a/conf/admin.src +++ /dev/null @@ -1,5 +0,0 @@ -SOURCE_URL=https://github.com/TryGhost/Admin/archive/refs/tags/v5.3.1.zip -SOURCE_SUM=e877de2f2d1c262e4fc284bf419fe75a72ad0640412a8eb0dcbc7b5721abef88 -SOURCE_SUM_PRG=sha256sum -SOURCE_FORMAT=zip -SOURCE_IN_SUBDIR=true From d9efcf79427310af94338211d01b7d602f8741d9 Mon Sep 17 00:00:00 2001 From: Badri Date: Sat, 13 Aug 2022 11:18:25 +0530 Subject: [PATCH 14/16] Increase yarn network timeout to 10 minutes We often run into the error, `An unexpected error occurred: "https://registry.yarnpkg.com/date-fns/-/date-fns-2.29.1.tgz: ESOCKETTIMEDOUT".` This seems to be a common problem with the date-fns package, as well as other large packages installed with older versions of Yarn. See for example the following GitHub issues: https://github.com/date-fns/date-fns/issues/1004 https://github.com/yarnpkg/yarn/issues/8242 The problem seems to be related to slow hard-disk access on the client server/VPS - so it's actually the storage connection and not the Internet connection, that's timing out. A common workaround for this is to increase the network timeout for Yarn long enough for the build will complete, which is what we're doing in this case since it's likely to affect a lot of the slower setups (including, as it seems, the YunoHost CI!). For everyone else, the worst case is that they'll have to wait 10 minutes before they realise there's actually something wrong with the network. --- scripts/install | 2 ++ scripts/upgrade | 2 ++ 2 files changed, 4 insertions(+) diff --git a/scripts/install b/scripts/install index d3eebf2..c021ea3 100644 --- a/scripts/install +++ b/scripts/install @@ -133,6 +133,8 @@ ynh_script_progression --message="Building Ghost... (this will take some time an pushd "$final_path" ynh_use_nodejs + # Longer network timeouts for slow systems; see https://github.com/yarnpkg/yarn/issues/8242 + ynh_exec_warn_less ynh_exec_as $app $ynh_node_load_PATH yarn config set network-timeout 600000 ynh_exec_warn_less ynh_exec_as $app $ynh_node_load_PATH yarn add knex-migrator ember-cli --dev --ignore-workspace-root-check --non-interactive ynh_exec_warn_less ynh_exec_as $app $ynh_node_load_PATH yarn setup # catch-all command provided by Ghost that handles all the setup popd diff --git a/scripts/upgrade b/scripts/upgrade index d3ce02f..f47d571 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -176,6 +176,8 @@ then ynh_script_progression --message="Building Ghost... (this will take some time and resources!)" pushd "$final_path" + # Longer network timeouts for slow systems; see https://github.com/yarnpkg/yarn/issues/8242 + ynh_exec_warn_less ynh_exec_as $app $ynh_node_load_PATH yarn config set network-timeout 600000 ynh_exec_warn_less ynh_exec_as $app $ynh_node_load_PATH yarn install --non-interactive ynh_exec_warn_less ynh_exec_as $app $ynh_node_load_PATH yarn add knex-migrator ember-cli --dev --ignore-workspace-root-check --non-interactive ynh_exec_warn_less ynh_exec_as $app $ynh_node_load_PATH yarn setup From 02aa33e51ad98509bd5ae0bf21a588158c15b6db Mon Sep 17 00:00:00 2001 From: tituspijean Date: Sun, 14 Aug 2022 17:17:17 +0200 Subject: [PATCH 15/16] Specify homedir and yarnrc file for yarn commands --- scripts/install | 10 +++++++--- scripts/upgrade | 12 ++++++++---- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/scripts/install b/scripts/install index c021ea3..388008d 100644 --- a/scripts/install +++ b/scripts/install @@ -126,6 +126,10 @@ ynh_add_config --template="../conf/config.production.json" --destination="$final chmod 400 "$final_path/ghost/core/config.production.json" chown $app:$app "$final_path/ghost/core/config.production.json" +touch "$final_path/.yarnrc.yml" +chmod 400 "$final_path/.yarnrc.yml" +chown $app:$app "$final_path/.yarnrc.yml" + #============================================== # BUILD GHOST #============================================== @@ -134,9 +138,9 @@ ynh_script_progression --message="Building Ghost... (this will take some time an pushd "$final_path" ynh_use_nodejs # Longer network timeouts for slow systems; see https://github.com/yarnpkg/yarn/issues/8242 - ynh_exec_warn_less ynh_exec_as $app $ynh_node_load_PATH yarn config set network-timeout 600000 - ynh_exec_warn_less ynh_exec_as $app $ynh_node_load_PATH yarn add knex-migrator ember-cli --dev --ignore-workspace-root-check --non-interactive - ynh_exec_warn_less ynh_exec_as $app $ynh_node_load_PATH yarn setup # catch-all command provided by Ghost that handles all the setup + ynh_exec_warn_less ynh_exec_as $app $ynh_node_load_PATH HOME="$final_path" yarn config set network-timeout 600000 + ynh_exec_warn_less ynh_exec_as $app $ynh_node_load_PATH HOME="$final_path" yarn add knex-migrator ember-cli --dev --ignore-workspace-root-check --non-interactive + ynh_exec_warn_less ynh_exec_as $app $ynh_node_load_PATH HOME="$final_path" yarn setup # catch-all command provided by Ghost that handles all the setup popd #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index f47d571..d3a2b7c 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -167,6 +167,10 @@ ynh_add_config --template="../conf/config.production.json" --destination="$final chmod 400 "$final_path/ghost/core/config.production.json" chown $app:$app "$final_path/ghost/core/config.production.json" +touch "$final_path/.yarnrc.yml" +chmod 400 "$final_path/.yarnrc.yml" +chown $app:$app "$final_path/.yarnrc.yml" + #============================================== # BUILD GHOST #============================================== @@ -177,10 +181,10 @@ then pushd "$final_path" # Longer network timeouts for slow systems; see https://github.com/yarnpkg/yarn/issues/8242 - ynh_exec_warn_less ynh_exec_as $app $ynh_node_load_PATH yarn config set network-timeout 600000 - ynh_exec_warn_less ynh_exec_as $app $ynh_node_load_PATH yarn install --non-interactive - ynh_exec_warn_less ynh_exec_as $app $ynh_node_load_PATH yarn add knex-migrator ember-cli --dev --ignore-workspace-root-check --non-interactive - ynh_exec_warn_less ynh_exec_as $app $ynh_node_load_PATH yarn setup + ynh_exec_warn_less ynh_exec_as $app $ynh_node_load_PATH HOME="$final_path" yarn config set network-timeout 600000 + ynh_exec_warn_less ynh_exec_as $app $ynh_node_load_PATH HOME="$final_path" yarn install --non-interactive + ynh_exec_warn_less ynh_exec_as $app $ynh_node_load_PATH HOME="$final_path" yarn add knex-migrator ember-cli --dev --ignore-workspace-root-check --non-interactive + ynh_exec_warn_less ynh_exec_as $app $ynh_node_load_PATH HOME="$final_path" yarn setup popd fi From a0f051a20255364d17093cf2ddae9c3cf3653b80 Mon Sep 17 00:00:00 2001 From: yunohost-bot Date: Sun, 14 Aug 2022 15:17:27 +0000 Subject: [PATCH 16/16] Auto-update README --- README.md | 3 ++- README_fr.md | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index f7b56cd..829c056 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,8 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in Publishing, memberships, subscriptions and newsletters platform -**Shipped version:** 5.3.1~ynh1 +**Shipped version:** 5.8.3~ynh1 + ## Screenshots diff --git a/README_fr.md b/README_fr.md index 8196878..66d2e59 100644 --- a/README_fr.md +++ b/README_fr.md @@ -17,7 +17,8 @@ Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour Plateforme d'édition, d'adhésions, d'abonnements et de newsletters -**Version incluse :** 5.3.1~ynh1 +**Version incluse :** 5.8.3~ynh1 + ## Captures d'écran