mirror of
https://github.com/YunoHost-Apps/decidim_ynh.git
synced 2024-09-03 18:26:00 +02:00
Upgrade to 0.26.2
This commit is contained in:
parent
e8f8bddb55
commit
871f351d6f
10 changed files with 154 additions and 122 deletions
40
.github/workflows/updater.sh
vendored
40
.github/workflows/updater.sh
vendored
|
@ -9,9 +9,6 @@
|
|||
# Since each app is different, maintainers can adapt its contents so as to perform
|
||||
# automatic actions when a new upstream release is detected.
|
||||
|
||||
# Remove this exit command when you are ready to run this Action
|
||||
exit 1
|
||||
|
||||
#=================================================
|
||||
# FETCHING LATEST RELEASE AND ITS ASSETS
|
||||
#=================================================
|
||||
|
@ -21,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="https://github.com/decidim/decidim/archive/refs/tags/$version.tar.gz"
|
||||
|
||||
# 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.
|
||||
|
@ -48,38 +45,16 @@ elif git ls-remote -q --exit-code --heads https://github.com/$GITHUB_REPOSITORY.
|
|||
exit 0
|
||||
fi
|
||||
|
||||
# Each release can hold multiple assets (e.g. binaries for different architectures, source code, etc.)
|
||||
echo "${#assets[@]} available asset(s)"
|
||||
|
||||
#=================================================
|
||||
# UPDATE SOURCE FILES
|
||||
#=================================================
|
||||
|
||||
# Here we use the $assets variable to get the resources published in the upstream release.
|
||||
# Here is an example for Grav, it has to be adapted in accordance with how the upstream releases look like.
|
||||
|
||||
# Let's loop over the array of assets URLs
|
||||
for asset_url in ${assets[@]}; do
|
||||
# Let's download source tarball
|
||||
asset_url=$assets
|
||||
|
||||
echo "Handling asset at $asset_url"
|
||||
|
||||
# Assign the asset to a source file in conf/ directory
|
||||
# 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
|
||||
*"admin"*)
|
||||
src="app"
|
||||
;;
|
||||
*"update"*)
|
||||
src="app-upgrade"
|
||||
;;
|
||||
*)
|
||||
src=""
|
||||
;;
|
||||
esac
|
||||
|
||||
# If $src is not empty, let's process the asset
|
||||
if [ ! -z "$src" ]; then
|
||||
src="app"
|
||||
|
||||
# Create the temporary directory
|
||||
tempdir="$(mktemp -d)"
|
||||
|
@ -107,15 +82,10 @@ SOURCE_SUM_PRG=sha256sum
|
|||
SOURCE_FORMAT=$extension
|
||||
SOURCE_IN_SUBDIR=true
|
||||
SOURCE_FILENAME=
|
||||
SOURCE_EXTRACT=true
|
||||
EOT
|
||||
echo "... conf/$src.src updated"
|
||||
|
||||
else
|
||||
echo "... asset ignored"
|
||||
fi
|
||||
|
||||
done
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC UPDATE STEPS
|
||||
#=================================================
|
||||
|
|
49
.github/workflows/updater.yml
vendored
Normal file
49
.github/workflows/updater.yml
vendored
Normal file
|
@ -0,0 +1,49 @@
|
|||
# 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 * * *'
|
||||
jobs:
|
||||
updater:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Fetch the source code
|
||||
uses: actions/checkout@v2
|
||||
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@v3
|
||||
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
|
||||
base: testing
|
||||
branch: ci-auto-update-v${{ env.VERSION }}
|
||||
delete-branch: true
|
||||
title: 'Upgrade to version ${{ env.VERSION }}'
|
||||
body: |
|
||||
Upgrade to v${{ env.VERSION }}
|
||||
draft: false
|
|
@ -1,5 +1,5 @@
|
|||
SOURCE_URL=https://github.com/decidim/decidim/archive/refs/tags/v0.26.1.tar.gz
|
||||
SOURCE_SUM=2a646685aa29a96b903bc82a21abe95745ff79d86f650aa5a28e2458de25b8d2
|
||||
SOURCE_URL=https://github.com/decidim/decidim/archive/refs/tags/v0.26.2.tar.gz
|
||||
SOURCE_SUM=1dcc49b95543604302bc65df4d2119f90dcb10ad7cc68c4f3e7cc6ffc64eabc5
|
||||
SOURCE_SUM_PRG=sha256sum
|
||||
SOURCE_FORMAT=tar.gz
|
||||
SOURCE_IN_SUBDIR=true
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
location __PATH__/ {
|
||||
|
||||
# Path to source
|
||||
alias __FINALPATH__/live/public ;
|
||||
alias __FINALPATH__/live/public/;
|
||||
|
||||
client_max_body_size 32M;
|
||||
|
||||
|
@ -17,7 +17,7 @@ location __PATH__/ {
|
|||
location __PATH__/decidim-packs/ {
|
||||
|
||||
# Path to source
|
||||
alias __FINALPATH__/live/public/decidim-packs/ ;
|
||||
alias __FINALPATH__/live/public/decidim-packs/;
|
||||
gzip_static on;
|
||||
expires max;
|
||||
more_set_headers "Cache-Control: public";
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
"description": {
|
||||
"en": "Participatory democracy framework,"
|
||||
},
|
||||
"version": "0.26.1~ynh3",
|
||||
"version": "0.26.2~ynh1",
|
||||
"url": "https://decidim.org/",
|
||||
"upstream": {
|
||||
"license": "AGPL-3.0-or-later",
|
||||
|
@ -44,7 +44,22 @@
|
|||
"en": "Choose the application language",
|
||||
"fr": "Choisissez la langue de l'application"
|
||||
},
|
||||
"choices": ["ca", "cs", "de", "en", "es", "eu", "fi", "fr", "it", "ja", "nl", "pl", "pt", "ro"],
|
||||
"choices": [
|
||||
"ca",
|
||||
"cs",
|
||||
"de",
|
||||
"en",
|
||||
"es",
|
||||
"eu",
|
||||
"fi",
|
||||
"fr",
|
||||
"it",
|
||||
"ja",
|
||||
"nl",
|
||||
"pl",
|
||||
"pt",
|
||||
"ro"
|
||||
],
|
||||
"default": "en"
|
||||
},
|
||||
{
|
||||
|
|
|
@ -4,16 +4,15 @@
|
|||
# COMMON VARIABLES
|
||||
#=================================================
|
||||
|
||||
# dependencies used by the app
|
||||
ruby_version=2.7.4
|
||||
nodejs_version=16
|
||||
bundler_version=2.2.19
|
||||
rails_version=6.0.4
|
||||
|
||||
# dependencies used by the app (must be on a single line)
|
||||
pkg_dependencies="postgresql imagemagick redis-server"
|
||||
build_pkg_dependencies="libyaml-dev libreadline6-dev libncurses5-dev libffi-dev libgdbm-dev libpq-dev libicu-dev"
|
||||
|
||||
ruby_version="2.7.4"
|
||||
nodejs_version="16"
|
||||
decidim_version="0.26.1"
|
||||
bundler_version="2.2.19"
|
||||
rails_version="6.0.4"
|
||||
|
||||
#=================================================
|
||||
# PERSONAL HELPERS
|
||||
#=================================================
|
||||
|
|
|
@ -15,7 +15,7 @@ source /usr/share/yunohost/helpers
|
|||
#=================================================
|
||||
|
||||
ynh_clean_setup () {
|
||||
ynh_clean_check_starting
|
||||
true
|
||||
}
|
||||
# Exit if an error occurs during the execution of the script
|
||||
ynh_abort_if_errors
|
||||
|
@ -39,7 +39,7 @@ admin_mail=$(ynh_user_get_info --username=$admin --key=mail)
|
|||
#=================================================
|
||||
# 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"
|
||||
|
@ -50,7 +50,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
|
||||
|
@ -63,7 +63,7 @@ ynh_app_setting_set --app=$app --key=secret_key_base --value=$secret_key_base
|
|||
#=================================================
|
||||
# INSTALL DEPENDENCIES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Installing dependencies..."
|
||||
ynh_script_progression --message="Installing dependencies..." --weight=1
|
||||
|
||||
ynh_install_app_dependencies $pkg_dependencies $build_pkg_dependencies
|
||||
ynh_install_nodejs --nodejs_version=$nodejs_version
|
||||
|
@ -75,7 +75,7 @@ ynh_install_ruby --ruby_version=$ruby_version
|
|||
#=================================================
|
||||
# CREATE DEDICATED USER
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring system user..."
|
||||
ynh_script_progression --message="Configuring system user..." --weight=1
|
||||
|
||||
# Create a system user
|
||||
ynh_system_user_create --username=$app --home_dir="$final_path"
|
||||
|
@ -83,7 +83,7 @@ ynh_system_user_create --username=$app --home_dir="$final_path"
|
|||
#=================================================
|
||||
# CREATE A POSTGRESQL DATABASE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Creating a PostgreSQL database..."
|
||||
ynh_script_progression --message="Creating a PostgreSQL database..." --weight=1
|
||||
|
||||
ynh_psql_test_if_first_run
|
||||
db_name=$(ynh_sanitize_dbid --db_name=$app)
|
||||
|
@ -99,7 +99,7 @@ db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd)
|
|||
#=================================================
|
||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Setting up source files..."
|
||||
ynh_script_progression --message="Setting up source files..." --weight=1
|
||||
|
||||
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
|
||||
# Download, check integrity, uncompress and patch the source from app.src
|
||||
|
@ -112,7 +112,7 @@ chown -R $app:www-data "$final_path"
|
|||
#=================================================
|
||||
# NGINX CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring NGINX web server..."
|
||||
ynh_script_progression --message="Configuring NGINX web server..." --weight=1
|
||||
|
||||
# Create a dedicated NGINX config
|
||||
ynh_add_nginx_config
|
||||
|
@ -122,14 +122,14 @@ ynh_add_nginx_config
|
|||
#=================================================
|
||||
# INSTALL GEMS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Installing gems..."
|
||||
ynh_script_progression --message="Installing gems..." --weight=1
|
||||
|
||||
pushd $final_path
|
||||
ynh_use_ruby
|
||||
ynh_use_nodejs
|
||||
ynh_exec_warn_less $ynh_gem install bundler --version $bundler_version
|
||||
ynh_exec_warn_less $ynh_gem install rails --version $rails_version
|
||||
ynh_exec_warn_less $ynh_gem install decidim -v $decidim_version
|
||||
ynh_exec_warn_less $ynh_gem install decidim -v $(ynh_app_upstream_version)
|
||||
ynh_exec_warn_less decidim live
|
||||
popd
|
||||
|
||||
|
@ -140,7 +140,7 @@ chown -R $app:www-data "$final_path"
|
|||
#=================================================
|
||||
# CREATE DATA DIRECTORY
|
||||
#=================================================
|
||||
ynh_script_progression --message="Creating a data directory..."
|
||||
ynh_script_progression --message="Creating a data directory..." --weight=1
|
||||
|
||||
datadir=/home/yunohost.app/$app
|
||||
ynh_app_setting_set --app=$app --key=datadir --value=$datadir
|
||||
|
@ -154,7 +154,7 @@ chown -R $app:www-data "$datadir"
|
|||
#=================================================
|
||||
# ADD A CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Adding a configuration file..."
|
||||
ynh_script_progression --message="Adding a configuration file..." --weight=1
|
||||
|
||||
ynh_add_config --template="../conf/schedule.rb" --destination="$final_path/live/config/schedule.rb"
|
||||
chmod 400 "$final_path/live/config/schedule.rb"
|
||||
|
@ -180,7 +180,7 @@ chmod 644 "/etc/cron.d/$app"
|
|||
#=================================================
|
||||
# BUILD APP
|
||||
#=================================================
|
||||
ynh_script_progression --message="Building app..."
|
||||
ynh_script_progression --message="Building app..." --weight=1
|
||||
|
||||
pushd "$final_path/live"
|
||||
ynh_secure_remove --file="$final_path/live/Gemfile.lock"
|
||||
|
@ -212,7 +212,7 @@ ynh_package_autoremove
|
|||
#=================================================
|
||||
# SETUP SSOWAT
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring permissions..."
|
||||
ynh_script_progression --message="Configuring permissions..." --weight=1
|
||||
|
||||
# Make app public if necessary
|
||||
if [ $is_public -eq 1 ]
|
||||
|
@ -225,7 +225,7 @@ fi
|
|||
#=================================================
|
||||
# RELOAD NGINX
|
||||
#=================================================
|
||||
ynh_script_progression --message="Reloading NGINX web server..."
|
||||
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
|
||||
|
||||
ynh_systemd_action --service_name=nginx --action=reload
|
||||
|
||||
|
@ -233,4 +233,4 @@ ynh_systemd_action --service_name=nginx --action=reload
|
|||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Installation of $app completed"
|
||||
ynh_script_progression --message="Installation of $app completed" --last
|
||||
|
|
|
@ -13,7 +13,7 @@ source /usr/share/yunohost/helpers
|
|||
#=================================================
|
||||
# LOAD SETTINGS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Loading installation settings..."
|
||||
ynh_script_progression --message="Loading installation settings..." --weight=1
|
||||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
|
@ -28,7 +28,7 @@ datadir=$(ynh_app_setting_get --app=$app --key=datadir)
|
|||
#=================================================
|
||||
# REMOVE THE POSTGRESQL DATABASE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing the PostgreSQL database..."
|
||||
ynh_script_progression --message="Removing the PostgreSQL database..." --weight=1
|
||||
|
||||
# Remove a database if it exists, along with the associated user
|
||||
ynh_psql_remove_db --db_user=$db_user --db_name=$db_name
|
||||
|
@ -36,7 +36,7 @@ ynh_psql_remove_db --db_user=$db_user --db_name=$db_name
|
|||
#=================================================
|
||||
# REMOVE APP MAIN DIR
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing app main directory..."
|
||||
ynh_script_progression --message="Removing app main directory..." --weight=1
|
||||
|
||||
# Remove the app directory securely
|
||||
ynh_secure_remove --file="$final_path"
|
||||
|
@ -48,14 +48,14 @@ ynh_secure_remove --file="$final_path"
|
|||
# Remove the data directory if --purge option is used
|
||||
if [ "${YNH_APP_PURGE:-0}" -eq 1 ]
|
||||
then
|
||||
ynh_script_progression --message="Removing app data directory..."
|
||||
ynh_script_progression --message="Removing app data directory..." --weight=1
|
||||
ynh_secure_remove --file="$datadir"
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# REMOVE NGINX CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing NGINX web server configuration..."
|
||||
ynh_script_progression --message="Removing NGINX web server configuration..." --weight=1
|
||||
|
||||
# Remove the dedicated NGINX config
|
||||
ynh_remove_nginx_config
|
||||
|
@ -63,7 +63,7 @@ ynh_remove_nginx_config
|
|||
#=================================================
|
||||
# REMOVE DEPENDENCIES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing dependencies..."
|
||||
ynh_script_progression --message="Removing dependencies..." --weight=1
|
||||
|
||||
# Remove metapackage and its dependencies
|
||||
ynh_remove_nodejs
|
||||
|
@ -75,7 +75,7 @@ ynh_remove_app_dependencies
|
|||
#=================================================
|
||||
# REMOVE VARIOUS FILES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing various files..."
|
||||
ynh_script_progression --message="Removing various files..." --weight=1
|
||||
|
||||
# Remove a cron file
|
||||
ynh_secure_remove --file="/etc/cron.d/$app"
|
||||
|
@ -85,7 +85,7 @@ ynh_secure_remove --file="/etc/cron.d/$app"
|
|||
#=================================================
|
||||
# REMOVE DEDICATED USER
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing the dedicated system user..."
|
||||
ynh_script_progression --message="Removing the dedicated system user..." --weight=1
|
||||
|
||||
# Delete a system user
|
||||
ynh_system_user_delete --username=$app
|
||||
|
@ -94,4 +94,4 @@ ynh_system_user_delete --username=$app
|
|||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Removal of $app completed"
|
||||
ynh_script_progression --message="Removal of $app completed" --last
|
||||
|
|
|
@ -16,7 +16,7 @@ source /usr/share/yunohost/helpers
|
|||
#=================================================
|
||||
|
||||
ynh_clean_setup () {
|
||||
ynh_clean_check_starting
|
||||
true
|
||||
}
|
||||
# Exit if an error occurs during the execution of the script
|
||||
ynh_abort_if_errors
|
||||
|
@ -24,7 +24,7 @@ ynh_abort_if_errors
|
|||
#=================================================
|
||||
# LOAD SETTINGS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Loading installation settings..."
|
||||
ynh_script_progression --message="Loading installation settings..." --weight=1
|
||||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
|
@ -38,24 +38,17 @@ datadir=$(ynh_app_setting_get --app=$app --key=datadir)
|
|||
#=================================================
|
||||
# CHECK IF THE APP CAN BE RESTORED
|
||||
#=================================================
|
||||
ynh_script_progression --message="Validating restoration parameters..."
|
||||
ynh_script_progression --message="Validating restoration parameters..." --weight=1
|
||||
|
||||
test ! -d $final_path \
|
||||
|| ynh_die --message="There is already a directory: $final_path "
|
||||
|
||||
#=================================================
|
||||
# STANDARD RESTORATION STEPS
|
||||
#=================================================
|
||||
# RESTORE THE NGINX CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring the NGINX web server configuration..."
|
||||
|
||||
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||
|
||||
#=================================================
|
||||
# RECREATE THE DEDICATED USER
|
||||
#=================================================
|
||||
ynh_script_progression --message="Recreating the dedicated system user..."
|
||||
ynh_script_progression --message="Recreating the dedicated system user..." --weight=1
|
||||
|
||||
# Create the dedicated user (if not existing)
|
||||
ynh_system_user_create --username=$app --home_dir="$final_path"
|
||||
|
@ -63,7 +56,7 @@ ynh_system_user_create --username=$app --home_dir="$final_path"
|
|||
#=================================================
|
||||
# RESTORE THE APP MAIN DIR
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring the app main directory..."
|
||||
ynh_script_progression --message="Restoring the app main directory..." --weight=1
|
||||
|
||||
ynh_restore_file --origin_path="$final_path"
|
||||
|
||||
|
@ -74,7 +67,7 @@ chown -R $app:www-data "$final_path"
|
|||
#=================================================
|
||||
# RESTORE THE DATA DIRECTORY
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring the data directory..."
|
||||
ynh_script_progression --message="Restoring the data directory..." --weight=1
|
||||
|
||||
ynh_restore_file --origin_path="$datadir" --not_mandatory
|
||||
|
||||
|
@ -89,7 +82,7 @@ chown -R $app:www-data "$datadir"
|
|||
#=================================================
|
||||
# REINSTALL DEPENDENCIES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Reinstalling dependencies..."
|
||||
ynh_script_progression --message="Reinstalling dependencies..." --weight=1
|
||||
|
||||
# Define and install dependencies
|
||||
ynh_install_app_dependencies $pkg_dependencies $build_pkg_dependencies
|
||||
|
@ -99,10 +92,17 @@ apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 561F9B9CAC40B2
|
|||
ynh_install_extra_app_dependencies --repo="deb https://oss-binaries.phusionpassenger.com/apt/passenger $(lsb_release -cs) main" --package="libnginx-mod-http-passenger"
|
||||
ynh_install_ruby --ruby_version=$ruby_version
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE NGINX CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring the NGINX web server configuration..." --weight=1
|
||||
|
||||
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE POSTGRESQL DATABASE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring the PostgreSQL database..."
|
||||
ynh_script_progression --message="Restoring the PostgreSQL database..." --weight=1
|
||||
|
||||
db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd)
|
||||
ynh_psql_test_if_first_run
|
||||
|
@ -112,20 +112,20 @@ ynh_psql_execute_file_as_root --file="./db.sql" --database=$db_name
|
|||
#=================================================
|
||||
# INSTALL GEMS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Installing gems..."
|
||||
ynh_script_progression --message="Installing gems..." --weight=1
|
||||
|
||||
pushd $final_path
|
||||
ynh_use_ruby
|
||||
ynh_use_nodejs
|
||||
ynh_exec_warn_less $ynh_gem install bundler --version $bundler_version
|
||||
ynh_exec_warn_less $ynh_gem install rails --version $rails_version
|
||||
ynh_exec_warn_less $ynh_gem install decidim -v $decidim_version
|
||||
ynh_exec_warn_less $ynh_gem install decidim -v $(ynh_app_upstream_version)
|
||||
popd
|
||||
|
||||
#=================================================
|
||||
# BUILD APP
|
||||
#=================================================
|
||||
ynh_script_progression --message="Building app..."
|
||||
ynh_script_progression --message="Building app..." --weight=1
|
||||
|
||||
pushd "$final_path/live"
|
||||
ynh_secure_remove --file="$final_path/live/Gemfile.lock"
|
||||
|
@ -140,7 +140,7 @@ ynh_package_autoremove
|
|||
#=================================================
|
||||
# RESTORE VARIOUS FILES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring various files..."
|
||||
ynh_script_progression --message="Restoring various files..." --weight=1
|
||||
|
||||
ynh_restore_file --origin_path="/etc/cron.d/$app"
|
||||
|
||||
|
@ -149,7 +149,7 @@ ynh_restore_file --origin_path="/etc/cron.d/$app"
|
|||
#=================================================
|
||||
# RELOAD NGINX
|
||||
#=================================================
|
||||
ynh_script_progression --message="Reloading NGINX web server..."
|
||||
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
|
||||
|
||||
ynh_systemd_action --service_name=nginx --action=reload
|
||||
|
||||
|
@ -157,4 +157,4 @@ ynh_systemd_action --service_name=nginx --action=reload
|
|||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Restoration completed for $app"
|
||||
ynh_script_progression --message="Restoration completed for $app" --last
|
||||
|
|
|
@ -13,7 +13,7 @@ source /usr/share/yunohost/helpers
|
|||
#=================================================
|
||||
# LOAD SETTINGS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Loading installation settings..."
|
||||
ynh_script_progression --message="Loading installation settings..." --weight=1
|
||||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
|
@ -31,19 +31,18 @@ secret_key_base=$(ynh_app_setting_get --app=$app --key=secret_key_base)
|
|||
#=================================================
|
||||
# CHECK VERSION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Checking version..."
|
||||
ynh_script_progression --message="Checking version..." --weight=1
|
||||
|
||||
upgrade_type=$(ynh_check_app_version_changed)
|
||||
|
||||
#=================================================
|
||||
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
||||
#=================================================
|
||||
ynh_script_progression --message="Backing up the app before upgrading (may take a while)..."
|
||||
ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=1
|
||||
|
||||
# Backup the current version of the app
|
||||
ynh_backup_before_upgrade
|
||||
ynh_clean_setup () {
|
||||
ynh_clean_check_starting
|
||||
# Restore it if the upgrade fails
|
||||
ynh_restore_upgradebackup
|
||||
}
|
||||
|
@ -55,7 +54,7 @@ ynh_abort_if_errors
|
|||
#=================================================
|
||||
# ENSURE DOWNWARD COMPATIBILITY
|
||||
#=================================================
|
||||
ynh_script_progression --message="Ensuring downward compatibility..."
|
||||
ynh_script_progression --message="Ensuring downward compatibility..." --weight=1
|
||||
|
||||
# Cleaning legacy permissions
|
||||
if ynh_legacy_permissions_exists; then
|
||||
|
@ -67,7 +66,7 @@ fi
|
|||
#=================================================
|
||||
# CREATE DEDICATED USER
|
||||
#=================================================
|
||||
ynh_script_progression --message="Making sure dedicated system user exists..."
|
||||
ynh_script_progression --message="Making sure dedicated system user exists..." --weight=1
|
||||
|
||||
# Create a dedicated user (if not existing)
|
||||
ynh_system_user_create --username=$app --home_dir="$final_path"
|
||||
|
@ -78,7 +77,7 @@ ynh_system_user_create --username=$app --home_dir="$final_path"
|
|||
|
||||
if [ "$upgrade_type" == "UPGRADE_APP" ]
|
||||
then
|
||||
ynh_script_progression --message="Upgrading source files..."
|
||||
ynh_script_progression --message="Upgrading source files..." --weight=1
|
||||
|
||||
# Download, check integrity, uncompress and patch the source from app.src
|
||||
fi
|
||||
|
@ -87,18 +86,10 @@ chmod 750 "$final_path"
|
|||
chmod -R o-rwx "$final_path"
|
||||
chown -R $app:www-data "$final_path"
|
||||
|
||||
#=================================================
|
||||
# NGINX CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Upgrading NGINX web server configuration..."
|
||||
|
||||
# Create a dedicated NGINX config
|
||||
ynh_add_nginx_config
|
||||
|
||||
#=================================================
|
||||
# UPGRADE DEPENDENCIES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Upgrading dependencies..."
|
||||
ynh_script_progression --message="Upgrading dependencies..." --weight=1
|
||||
|
||||
ynh_install_app_dependencies $pkg_dependencies $build_pkg_dependencies
|
||||
ynh_install_nodejs --nodejs_version=$nodejs_version
|
||||
|
@ -107,12 +98,20 @@ apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys 561F9B9CAC40B2
|
|||
ynh_install_extra_app_dependencies --repo="deb https://oss-binaries.phusionpassenger.com/apt/passenger $(lsb_release -cs) main" --package="libnginx-mod-http-passenger"
|
||||
ynh_install_ruby --ruby_version=$ruby_version
|
||||
|
||||
#=================================================
|
||||
# NGINX CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=1
|
||||
|
||||
# Create a dedicated NGINX config
|
||||
ynh_add_nginx_config
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC UPGRADE
|
||||
#=================================================
|
||||
# INSTALL GEMS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Installing gems..."
|
||||
ynh_script_progression --message="Installing gems..." --weight=1
|
||||
|
||||
if [ "$upgrade_type" == "UPGRADE_APP" ]
|
||||
then
|
||||
|
@ -121,7 +120,7 @@ then
|
|||
ynh_use_nodejs
|
||||
ynh_exec_warn_less $ynh_gem install bundler --version $bundler_version
|
||||
ynh_exec_warn_less $ynh_gem install rails --version $rails_version
|
||||
ynh_exec_warn_less $ynh_gem install decidim -v $decidim_version
|
||||
ynh_exec_warn_less $ynh_gem install decidim -v $(ynh_app_upstream_version)
|
||||
popd
|
||||
fi
|
||||
|
||||
|
@ -132,7 +131,7 @@ chown -R $app:www-data "$final_path"
|
|||
#=================================================
|
||||
# ADD A CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Adding a configuration file..."
|
||||
ynh_script_progression --message="Adding a configuration file..." --weight=1
|
||||
|
||||
ynh_add_config --template="../conf/schedule.rb" --destination="$final_path/live/config/schedule.rb"
|
||||
chmod 400 "$final_path/live/config/schedule.rb"
|
||||
|
@ -158,7 +157,7 @@ chmod 644 "/etc/cron.d/$app"
|
|||
#=================================================
|
||||
# BUILD APP
|
||||
#=================================================
|
||||
ynh_script_progression --message="Building app..."
|
||||
ynh_script_progression --message="Building app..." --weight=1
|
||||
|
||||
if [ "$upgrade_type" == "UPGRADE_APP" ]
|
||||
then
|
||||
|
@ -185,7 +184,7 @@ ynh_package_autoremove
|
|||
#=================================================
|
||||
# RELOAD NGINX
|
||||
#=================================================
|
||||
ynh_script_progression --message="Reloading NGINX web server..."
|
||||
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
|
||||
|
||||
ynh_systemd_action --service_name=nginx --action=reload
|
||||
|
||||
|
@ -193,4 +192,4 @@ ynh_systemd_action --service_name=nginx --action=reload
|
|||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Upgrade of $app completed"
|
||||
ynh_script_progression --message="Upgrade of $app completed" --last
|
||||
|
|
Loading…
Reference in a new issue