diff --git a/README.md b/README.md index 14850a8..5436898 100644 --- a/README.md +++ b/README.md @@ -1,15 +1,16 @@ # Ghost for YunoHost -[![Integration level](https://dash.yunohost.org/integration/ghost.svg)](https://dash.yunohost.org/appci/app/ghost) ![](https://ci-apps.yunohost.org/ci/badges/ghost.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/ghost.maintain.svg) +[![Integration level](https://dash.yunohost.org/integration/ghost.svg)](https://dash.yunohost.org/appci/app/ghost) ![](https://ci-apps.yunohost.org/ci/badges/ghost.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/ghost.maintain.svg) + [![Install Ghost with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=ghost) -> *This package allows you to install Ghost quickly and simply on a YunoHost server. +> *This package allows you to install Ghost quickly and simply on a YunoHost server. If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/install) to learn how to install it.* ## Overview Ghost is a fully open source, adaptable platform for building and running a modern online publication. -**Shipped version:** 3.40.5 +**Shipped version:** 3.41.8 ## Screenshots @@ -17,17 +18,17 @@ Ghost is a fully open source, adaptable platform for building and running a mode ## Installation -### Guidelines +### Guidelines 1. No LDAP support. 1. You need more then **1GB** of ram. If you don't have it, please create a **swap memory**. - + $ dd if=/dev/zero of=/swapfile bs=1024 count=1048576 $ mkswap /swapfile $ swapon /swapfile $ echo "/swapfile swap swap defaults 0 0" >> /etc/fstab 1. This app is multi-instance (you can have more then one Ghost blogging websites on a single YunoHost server) - + ### Installing the Ghost app 1. **App can be installed by YunoHost admin interface or by the following command:** diff --git a/conf/admin.src b/conf/admin.src new file mode 100644 index 0000000..447e425 --- /dev/null +++ b/conf/admin.src @@ -0,0 +1,6 @@ +SOURCE_URL=https://github.com/TryGhost/Admin/archive/3.41.8.zip +SOURCE_SUM=252080e8b4fdc558300b2d33701735a3e2a6d7d82ef66a5eeb9b651a488c67e0 +SOURCE_SUM_PRG=sha256sum +SOURCE_FORMAT=zip +SOURCE_IN_SUBDIR=false +SOURCE_FILENAME= diff --git a/conf/app.src b/conf/app.src index 17078a1..f72e94d 100644 --- a/conf/app.src +++ b/conf/app.src @@ -1,5 +1,5 @@ -SOURCE_URL=https://github.com/TryGhost/Ghost/releases/download/3.40.5/Ghost-3.40.5.zip -SOURCE_SUM=fef81257937b9125dac1618d4a8433a651aa6d32dcfc69da78a4610d7fcbc8ad +SOURCE_URL=https://github.com/TryGhost/Ghost/releases/download/3.41.8/Ghost-3.41.8.zip +SOURCE_SUM=e650e3d55155c5974a8c3e58bf996c523be51b3a38f9728517b14d9114e0106a SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=zip SOURCE_IN_SUBDIR=false diff --git a/conf/config.production.json b/conf/config.production.json index 57ed83c..d87e81d 100644 --- a/conf/config.production.json +++ b/conf/config.production.json @@ -26,4 +26,4 @@ }, "transports": ["file", "stdout"] } -} +} \ No newline at end of file diff --git a/manifest.json b/manifest.json index d0db237..c66dbd1 100644 --- a/manifest.json +++ b/manifest.json @@ -6,7 +6,7 @@ "en": "Just a blogging platform", "fr": "Plateforme de blogging" }, - "version": "3.40.5~ynh1", + "version": "3.41.8~ynh1", "url": "https://ghost.org/", "license": "MIT", "maintainer": { diff --git a/scripts/_common.sh b/scripts/_common.sh index 3376c2d..ee955e6 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -20,3 +20,56 @@ NODEJS_VERSION=14 #================================================= # FUTURE OFFICIAL HELPERS #================================================= + +# Send an email to inform the administrator +# +# usage: ynh_send_readme_to_admin app_message [recipients] +# | arg: app_message - The message to send to the administrator. +# | arg: recipients - The recipients of this email. Use spaces to separate multiples recipients. - default: root +# example: "root admin@domain" +# If you give the name of a YunoHost user, ynh_send_readme_to_admin will find its email adress for you +# example: "root admin@domain user1 user2" +ynh_send_readme_to_admin() { + local app_message="${1:-...No specific information...}" + local recipients="${2:-root}" + + # Retrieve the email of users + find_mails () { + local list_mails="$1" + local mail + local recipients=" " + # Read each mail in argument + for mail in $list_mails + do + # Keep root or a real email address as it is + if [ "$mail" = "root" ] || echo "$mail" | grep --quiet "@" + then + recipients="$recipients $mail" + else + # But replace an user name without a domain after by its email + if mail=$(ynh_user_get_info "$mail" "mail" 2> /dev/null) + then + recipients="$recipients $mail" + fi + fi + done + echo "$recipients" + } + recipients=$(find_mails "$recipients") + + local mail_subject="☁️🆈🅽🅷☁️: \`$app\` has important message for you" + + local mail_message="This is an automated message from your beloved YunoHost server. Specific information for $app. +$app_message" + + # Define binary to use for mail command + if [ -e /usr/bin/bsd-mailx ] + then + local mail_bin=/usr/bin/bsd-mailx + else + local mail_bin=/usr/bin/mail.mailutils + fi + + # Send the email to the recipients + echo "$mail_message" | $mail_bin -a "Content-Type: text/plain; charset=UTF-8" -s "$mail_subject" "$recipients" +} \ No newline at end of file diff --git a/scripts/install b/scripts/install index 76d1adb..771c72a 100644 --- a/scripts/install +++ b/scripts/install @@ -34,7 +34,7 @@ app=$YNH_APP_INSTANCE_NAME #================================================= # CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS #================================================= -ynh_script_progression --message="Validating installation parameters..." +ynh_script_progression --message="Validating installation parameters..." --weight=1 final_path=/var/www/$app test ! -e "$final_path" || ynh_die --message="This path already contains a folder" @@ -45,7 +45,7 @@ ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url #================================================= # STORE SETTINGS FROM MANIFEST #================================================= -ynh_script_progression --message="Storing installation settings..." +ynh_script_progression --message="Storing installation settings..." --weight=1 ynh_app_setting_set --app=$app --key=domain --value=$domain ynh_app_setting_set --app=$app --key=path --value=$path_url @@ -56,7 +56,7 @@ ynh_app_setting_set --app=$app --key=is_public --value=$is_public #================================================= # FIND AND OPEN A PORT #================================================= -ynh_script_progression --message="Finding an available port..." +ynh_script_progression --message="Finding an available port..." --weight=1 # Find an available port port=$(ynh_find_port --port=4010) @@ -65,12 +65,12 @@ ynh_app_setting_set --app=$app --key=port --value=$port #================================================= # INSTALL DEPENDENCIES #================================================= -ynh_script_progression --message="Installing dependencies..." +ynh_script_progression --message="Installing dependencies..." --weight=1 ynh_install_app_dependencies $pkg_dependencies # Install Nodejs -ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$NODEJS_VERSION +ynh_install_nodejs --nodejs_version=$NODEJS_VERSION # Install Yarn ynh_install_extra_app_dependencies --repo="deb https://dl.yarnpkg.com/debian/ stable main" --package="yarn" --key="https://dl.yarnpkg.com/debian/pubkey.gpg" @@ -94,6 +94,9 @@ ynh_script_progression --message="Setting up source files..." 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/client/Admin" --source_id="admin" #================================================= # NGINX CONFIGURATION @@ -128,10 +131,10 @@ ynh_script_progression --message="Building $app... (this will take some time and pushd "$final_path" || ynh_die ynh_use_nodejs - yarn install + yarn install --non-interactive --silent yarn global add knex-migrator NODE_ENV=production knex-migrator init - yarn global add grunt + yarn global add grunt-cli ember-cli NODE_ENV=production grunt symlink NODE_ENV=production grunt init --force @@ -180,6 +183,8 @@ then ynh_permission_update --permission="main" --add="visitors" fi +ynh_permission_create --permission="admin" --url="/ghost" --allowed="visitors" --auth_header="false" --protected="true" + #================================================= # RELOAD NGINX #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 8630339..91eed7e 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -87,9 +87,9 @@ then # Create a temporary directory tmpdir="$(mktemp -d)" - - # Copy the admin saved settings from tmp directory to final path - cp -ar "$final_path/config.production.json" "$tmpdir/config.production.json" + + # Copy the admin saved settings from tmp directory to final path + cp -ar "$final_path/config.production.json" "$tmpdir/config.production.json" # Backup the content folder to the temp dir cp -ar "$final_path/content" "$tmpdir/content" @@ -99,9 +99,13 @@ then # Download, check integrity, uncompress and patch the source from app.src ynh_setup_source --dest_dir=$final_path - - # Copy the admin saved settings from tmp directory to final path - cp -ar "$tmpdir/config.production.json" "$final_path/config.production.json" + + # 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" + + # Copy the admin saved settings from tmp directory to final path + cp -ar "$tmpdir/config.production.json" "$final_path/config.production.json" # Copy content folder back to the final_path cp -ar "$tmpdir/content" "${final_path}" @@ -156,13 +160,13 @@ then ynh_script_progression --message="Building $app... (this will take some time and resources!)" pushd "$final_path" || ynh_die - yarn install + yarn install yarn global add knex-migrator NODE_ENV=production knex-migrator init yarn global add grunt NODE_ENV=production grunt symlink NODE_ENV=production grunt init --force - + popd || ynh_die fi