mirror of
https://github.com/YunoHost-Apps/ghost_ynh.git
synced 2024-09-03 19:16:02 +02:00
commit
e6a5eef554
14 changed files with 47 additions and 198 deletions
60
.github/workflows/updater.sh
vendored
60
.github/workflows/updater.sh
vendored
|
@ -1,60 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
#=================================================
|
||||
# PACKAGE UPDATING HELPER
|
||||
#=================================================
|
||||
|
||||
# This script is meant to be run by GitHub Actions
|
||||
# The YunoHost-Apps organisation offers a template Action to run this script periodically
|
||||
# Since each app is different, maintainers can adapt its contents so as to perform
|
||||
# automatic actions when a new upstream release is detected.
|
||||
|
||||
#=================================================
|
||||
# FETCHING LATEST RELEASE AND ITS ASSETS
|
||||
#=================================================
|
||||
|
||||
# Fetching information
|
||||
# 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=$(tomlq -t -s --indent 4 -r '.version|split("~")[0]' manifest.toml)
|
||||
|
||||
# CORE
|
||||
repo=$(tomlq -r '.upstream.code|split("https://github.com/")[1]' manifest.toml)
|
||||
version=$(curl --silent "https://api.github.com/repos/$repo/releases" | jq -r '.[] | select( .prerelease != true ) | .tag_name' | sort -V | tail -1)
|
||||
|
||||
# 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.
|
||||
# You may need more tweaks here if the upstream repository has different naming conventions.
|
||||
if [[ ${version:0:1} == "v" || ${version:0:1} == "V" ]]; then
|
||||
version=${version:1}
|
||||
fi
|
||||
|
||||
# Setting up the environment variables
|
||||
echo "Current version: $current_version"
|
||||
echo "Latest release from upstream: $version"
|
||||
echo "VERSION=$version" >> $GITHUB_ENV
|
||||
# For the time being, let's assume the script will fail
|
||||
echo "PROCEED=false" >> $GITHUB_ENV
|
||||
|
||||
# Proceed only if the retrieved version is greater than the current one
|
||||
if ! dpkg --compare-versions "$current_version" "lt" "$version" ; then
|
||||
echo "::warning ::No new version available"
|
||||
exit 0
|
||||
# Proceed only if a PR for this new version does not already exist
|
||||
elif git ls-remote -q --exit-code --heads https://github.com/$GITHUB_REPOSITORY.git ci-auto-update-v$version ; then
|
||||
echo "::warning ::A branch already exists for this update"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
#=================================================
|
||||
|
||||
# Replace new version in manifest
|
||||
echo "$(tomlq -t -r ".version = \"${version}~ynh1\"" manifest.toml)" > manifest.toml
|
||||
|
||||
# No need to update the README, yunohost-bot takes care of it
|
||||
|
||||
# The Action will proceed only if the PROCEED environment variable is set to true
|
||||
echo "PROCEED=true" >> $GITHUB_ENV
|
||||
exit 0
|
49
.github/workflows/updater.yml
vendored
49
.github/workflows/updater.yml
vendored
|
@ -1,49 +0,0 @@
|
|||
# This workflow allows GitHub Actions to automagically update your app whenever a new upstream release is detected.
|
||||
# You need to enable Actions in your repository settings, and fetch this Action from the YunoHost-Apps organization.
|
||||
# This file should be enough by itself, but feel free to tune it to your needs.
|
||||
# It calls updater.sh, which is where you should put the app-specific update steps.
|
||||
name: Check for new upstream releases
|
||||
on:
|
||||
# Allow to manually trigger the workflow
|
||||
workflow_dispatch:
|
||||
# Run it every day at 6:00 UTC
|
||||
schedule:
|
||||
- cron: '0 6 */7 * *'
|
||||
jobs:
|
||||
updater:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Fetch the source code
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
- name: Run the updater script
|
||||
id: run_updater
|
||||
run: |
|
||||
# Setting up Git user
|
||||
git config --global user.name 'yunohost-bot'
|
||||
git config --global user.email 'yunohost-bot@users.noreply.github.com'
|
||||
# Run the updater script
|
||||
/bin/bash .github/workflows/updater.sh
|
||||
- name: Commit changes
|
||||
id: commit
|
||||
if: ${{ env.PROCEED == 'true' }}
|
||||
run: |
|
||||
git commit -am "Upgrade to v$VERSION"
|
||||
- name: Create Pull Request
|
||||
id: cpr
|
||||
if: ${{ env.PROCEED == 'true' }}
|
||||
uses: peter-evans/create-pull-request@v4
|
||||
with:
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
commit-message: Update to version ${{ env.VERSION }}
|
||||
committer: 'yunohost-bot <yunohost-bot@users.noreply.github.com>'
|
||||
author: 'yunohost-bot <yunohost-bot@users.noreply.github.com>'
|
||||
signoff: false
|
||||
branch: ci-auto-update-v${{ env.VERSION }}
|
||||
base: testing
|
||||
delete-branch: true
|
||||
title: 'Upgrade to version ${{ env.VERSION }}'
|
||||
body: |
|
||||
Upgrade to v${{ env.VERSION }}
|
||||
draft: false
|
|
@ -21,7 +21,7 @@ Ghost is a powerful app for new-media creators to publish, share, and grow a bus
|
|||
It comes with modern tools to build a website, publish content, send newsletters & offer paid subscriptions to members.
|
||||
|
||||
|
||||
**Shipped version:** 5.44.0~ynh1
|
||||
**Shipped version:** 5.59.1~ynh1
|
||||
|
||||
## Screenshots
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ Ghost is a powerful app for new-media creators to publish, share, and grow a bus
|
|||
It comes with modern tools to build a website, publish content, send newsletters & offer paid subscriptions to members.
|
||||
|
||||
|
||||
**Version incluse :** 5.44.0~ynh1
|
||||
**Version incluse :** 5.59.1~ynh1
|
||||
|
||||
## Captures d’écran
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ location __PATH__/ {
|
|||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto $scheme;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header Host $http_host;
|
||||
proxy_set_header Host $host;
|
||||
proxy_pass http://127.0.0.1:__PORT__;
|
||||
client_max_body_size 100M;
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ Type=simple
|
|||
User=__APP__
|
||||
Group=__APP__
|
||||
WorkingDirectory=__INSTALL_DIR__/ghost
|
||||
Environment="__YNH_NODE_LOAD_PATH__"
|
||||
Environment="__YNH_NODE_LOAD_PATH__:__INSTALL_DIR__/node_modules/ghost-cli/bin"
|
||||
Environment="NODE_ENV=production"
|
||||
ExecStart=__YNH_NODE__ __INSTALL_DIR__/node_modules/ghost-cli/bin/ghost run
|
||||
Restart=always
|
||||
|
|
3
doc/ADMIN.md
Normal file
3
doc/ADMIN.md
Normal file
|
@ -0,0 +1,3 @@
|
|||
If you want to use Ghost's CLI, run `sudo yunohost app shell __APP__` in a terminal to load the proper environment.
|
||||
|
||||
Emails such as newsletters will be sent out from `noreply@__DOMAIN__`. Do not change this setting in Ghost's administration interface, it will not work.
|
|
@ -1,6 +1,7 @@
|
|||
Starting v5.44.0~ynh1, the package relies on Ghost CLI to manage the installation of the app.
|
||||
|
||||
The migration has been tested, though please report any issue you might encounter.
|
||||
You might need to manually move your `content` directory to its proper location in `__INSTALL_DIR__/ghost/content`.
|
||||
Remember that a backup is performed before any app upgrade by your YunoHost server.
|
||||
|
||||
Enjoy!
|
||||
|
|
|
@ -5,8 +5,7 @@ name = "Ghost"
|
|||
description.en = "Publishing, memberships, subscriptions and newsletters platform"
|
||||
description.fr = "Plateforme d'édition, d'adhésions, d'abonnements et de newsletters"
|
||||
|
||||
version = "5.44.0~ynh1"
|
||||
|
||||
version = "5.59.1~ynh1"
|
||||
maintainers = ["Julien Malik"]
|
||||
|
||||
[upstream]
|
||||
|
@ -15,9 +14,10 @@ website = "https://ghost.org/"
|
|||
admindoc = "https://ghost.org/help/"
|
||||
code = "https://github.com/TryGhost/Ghost"
|
||||
cpe = "cpe:2.3:a:ghost:ghost"
|
||||
fund = "https://opencollective.com/ghost"
|
||||
|
||||
[integration]
|
||||
yunohost = ">= 11.1.0"
|
||||
yunohost = ">= 11.2"
|
||||
architectures = "all"
|
||||
multi_instance = true
|
||||
ldap = false
|
||||
|
@ -41,7 +41,16 @@ ram.runtime = "1G"
|
|||
default = "visitors"
|
||||
|
||||
[resources]
|
||||
[resources.sources.main]
|
||||
# Unused source, only to trigger the autoupdater
|
||||
prefetch = false
|
||||
url = "https://github.com/TryGhost/Ghost/archive/refs/tags/v5.59.1.tar.gz"
|
||||
sha256 = "0718612fbee2108b77f8f64be01fd7b65c2ca0aa9e3f96bfc092b424b4b253a6"
|
||||
autoupdate.strategy = "latest_github_release"
|
||||
|
||||
[resources.system_user]
|
||||
allow_email = true
|
||||
mail_user = "noreply"
|
||||
|
||||
[resources.install_dir]
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ fi
|
|||
#=================================================
|
||||
ynh_script_progression --message="Stopping a systemd service..." --time --weight=1
|
||||
|
||||
ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app/$app.log"
|
||||
ynh_systemd_action --service_name=$app --action=stop --log_path="systemd" --line_match="Ghost has shut down" --timeout=60
|
||||
|
||||
#=================================================
|
||||
# MODIFY URL IN NGINX CONF
|
||||
|
@ -46,7 +46,7 @@ echo "$(jq -r --arg YNH_APP_NEW_DOMAIN $YNH_APP_NEW_DOMAIN --arg YNH_APP_NEW_PAT
|
|||
#=================================================
|
||||
ynh_script_progression --message="Starting a systemd service..." --time --weight=1
|
||||
|
||||
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log"
|
||||
ynh_systemd_action --service_name=$app --action=start --log_path="systemd" --line_match="Ghost booted" --timeout=60
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
|
|
|
@ -47,38 +47,24 @@ popd
|
|||
# Make sure the configuration is correct
|
||||
pushd $install_dir/ghost
|
||||
ynh_exec_as $app $ynh_node_load_PATH $install_dir/node_modules/ghost-cli/bin/ghost config \
|
||||
--port $port --process local
|
||||
--port $port --process local \
|
||||
--mail SMTP --mailuser noreply@$domain --mailpass $mail_pwd --mailhost 127.0.0.1 --mailport 25
|
||||
popd
|
||||
|
||||
#=================================================
|
||||
# NGINX CONFIGURATION
|
||||
# SYSTEM CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring NGINX web server..."
|
||||
ynh_script_progression --message="Adding system configurations related to $app..." --weight=1
|
||||
|
||||
# Create a dedicated nginx config
|
||||
ynh_add_nginx_config
|
||||
|
||||
#=================================================
|
||||
# SETUP SYSTEMD
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring a systemd service..."
|
||||
|
||||
# Create a dedicated systemd config
|
||||
ynh_add_systemd_config
|
||||
|
||||
#=================================================
|
||||
# SETUP LOGROTATE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring log rotation..."
|
||||
|
||||
# Use logrotate to manage application logfile(s)
|
||||
ynh_use_logrotate --logfile="$install_dir/ghost/content/logs"
|
||||
|
||||
#=================================================
|
||||
# INTEGRATE SERVICE IN YUNOHOST
|
||||
#=================================================
|
||||
ynh_script_progression --message="Integrating service in YunoHost..."
|
||||
|
||||
yunohost service add $app --description="$app daemon for Ghost" --log="$install_dir/ghost/contents/logs"
|
||||
|
||||
#=================================================
|
||||
|
@ -87,7 +73,7 @@ yunohost service add $app --description="$app daemon for Ghost" --log="$install_
|
|||
ynh_script_progression --message="Starting a systemd service..."
|
||||
|
||||
# Start a systemd service
|
||||
ynh_systemd_action --service_name=$app --action="start" --line_match="Ghost booted" --timeout=60
|
||||
ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="Ghost booted" --timeout=60
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
|
|
|
@ -23,21 +23,6 @@ chmod 750 "$install_dir"
|
|||
chmod -R o-rwx "$install_dir"
|
||||
chown -R $app:www-data "$install_dir"
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE NGINX CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring the NGINX configuration..."
|
||||
|
||||
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||
|
||||
#=================================================
|
||||
# REINSTALL DEPENDENCIES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Reinstalling NodeJS..."
|
||||
|
||||
# Install Nodejs
|
||||
ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$NODEJS_VERSION
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE MYSQL DATABASE
|
||||
#=================================================
|
||||
|
@ -46,40 +31,32 @@ ynh_script_progression --message="Restoring the MySQL database..." --weight=1
|
|||
ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql
|
||||
|
||||
#=================================================
|
||||
# RESTORE SYSTEMD
|
||||
# RESTORE SYSTEM CONFIGURATIONS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring the systemd configuration..."
|
||||
# RESTORE THE PHP-FPM CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring system configurations related to $app..." --weight=1
|
||||
|
||||
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||
|
||||
# Install Nodejs
|
||||
ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$NODEJS_VERSION
|
||||
|
||||
ynh_restore_file --origin_path="/etc/systemd/system/$app.service"
|
||||
systemctl enable $app.service --quiet
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE LOGROTATE CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring the logrotate configuration..."
|
||||
|
||||
ynh_restore_file --origin_path="/etc/logrotate.d/$app"
|
||||
|
||||
#=================================================
|
||||
# INTEGRATE SERVICE IN YUNOHOST
|
||||
#=================================================
|
||||
ynh_script_progression --message="Integrating service in YunoHost..."
|
||||
|
||||
yunohost service add $app --description="$app daemon for Ghost" --log="$install_dir/ghost/contents/logs"
|
||||
|
||||
#=================================================
|
||||
# START SYSTEMD SERVICE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Starting a systemd service..."
|
||||
|
||||
ynh_systemd_action --service_name=$app --action=start --line_match="Ghost booted" --timeout=60
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
#=================================================
|
||||
# RELOAD NGINX
|
||||
# RELOAD NGINX AND PHP-FPM OR THE APP SERVICE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Reloading NGINX web server..."
|
||||
ynh_script_progression --message="Reloading NGINX web server and $app's service..." --weight=1
|
||||
|
||||
ynh_systemd_action --service_name=$app --action=start --log_path="systemd" --line_match="Ghost booted" --timeout=60
|
||||
|
||||
ynh_systemd_action --service_name=nginx --action=reload
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ fi
|
|||
#=================================================
|
||||
ynh_script_progression --message="Stopping a systemd service..."
|
||||
|
||||
ynh_systemd_action --service_name=$app --action=stop
|
||||
ynh_systemd_action --service_name=$app --action=stop --log_path="systemd" --line_match="Ghost has shut down" --timeout=60
|
||||
|
||||
#=================================================
|
||||
# UPGRADE DEPENDENCIES
|
||||
|
@ -111,45 +111,27 @@ fi
|
|||
# Make sure the configuration is correct
|
||||
pushd $install_dir/ghost
|
||||
ynh_exec_as $app $ynh_node_load_PATH $install_dir/node_modules/ghost-cli/bin/ghost config \
|
||||
--port $port --process local
|
||||
--port $port --process local \
|
||||
--mail SMTP --mailuser noreply@$domain --mailpass $mail_pwd --mailhost 127.0.0.1 --mailport 25
|
||||
popd
|
||||
|
||||
# Cleanup cache
|
||||
ynh_secure_remove --file="$install_dir/.cache/yarn"
|
||||
|
||||
#=================================================
|
||||
# NGINX CONFIGURATION
|
||||
# REAPPLY SYSTEM CONFIGURATIONS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Upgrading NGINX web server configuration..."
|
||||
ynh_script_progression --message="Upgrading system configurations related to $app..." --weight=1
|
||||
|
||||
# Create a dedicated nginx config
|
||||
ynh_add_nginx_config
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC UPGRADE
|
||||
#=================================================
|
||||
# SETUP SYSTEMD
|
||||
#=================================================
|
||||
ynh_script_progression --message="Upgrading systemd configuration..."
|
||||
|
||||
# Create a dedicated systemd config
|
||||
ynh_add_systemd_config
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
#=================================================
|
||||
# SETUP LOGROTATE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Upgrading logrotate configuration..."
|
||||
|
||||
# Use logrotate to manage app-specific logfile(s)
|
||||
ynh_use_logrotate --logfile="$install_dir/ghost/content/logs" --non-append
|
||||
|
||||
#=================================================
|
||||
# INTEGRATE SERVICE IN YUNOHOST
|
||||
#=================================================
|
||||
ynh_script_progression --message="Integrating service in YunoHost..."
|
||||
|
||||
yunohost service add $app --description="$app daemon for Ghost" --log="$install_dir/ghost/contents/logs"
|
||||
|
||||
#=================================================
|
||||
|
@ -157,7 +139,7 @@ yunohost service add $app --description="$app daemon for Ghost" --log="$install_
|
|||
#=================================================
|
||||
ynh_script_progression --message="Starting a systemd service..."
|
||||
|
||||
ynh_systemd_action --service_name=$app --action=start --line_match="Ghost booted" --timeout=60
|
||||
ynh_systemd_action --service_name=$app --action=start --log_path="systemd" --line_match="Ghost booted" --timeout=60
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
|
|
|
@ -4,4 +4,4 @@ test_format = 1.0
|
|||
|
||||
exclude = ["install.nourl"]
|
||||
|
||||
test_upgrade_from.7a150ab29ee969f72dd7846539ae12ac1975165b.name = "Upgrade from 4.9.4"
|
||||
# test_upgrade_from.01d5ebd928c1e43d73c0220098fc767afafdcb80.name = "Upgrade from 5.44.0"
|
||||
|
|
Loading…
Add table
Reference in a new issue