1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/bookstack_ynh.git synced 2024-09-03 18:16:02 +02:00
* 22.06

* Auto-update README

* Update manifest.json

* Fix

* 22.06.1

* Auto-update README

* Update upgrade

* 22.06.2

* Auto-update README

* Update app.src

* Update DESCRIPTION.md

* Auto-update README

* Update nginx.conf

* Update .env.example.complete

* Update .env.example.complete

* Update install

* Revert "Update install"

This reverts commit e43db7a0de.

* 22.07.1 (#80)

* 22.07.1

* Auto-update README

Co-authored-by: yunohost-bot <yunohost@yunohost.org>

* Auto-update README

* Auto-update README

* 22.07.2 (#82)

* 22.07.2

* Auto-update README

Co-authored-by: yunohost-bot <yunohost@yunohost.org>

* 22.07.3 (#84)

* 22.07.3

* Auto-update README

* Update manifest.json

Co-authored-by: yunohost-bot <yunohost@yunohost.org>

* Update upgrade

* 22.09 (#88)

* 22.09

* Auto-update README

* Update app.src

Co-authored-by: yunohost-bot <yunohost@yunohost.org>

* 22.09.1

* Auto-update README

* upgrade composer

* upgrade config (#91)

* Update manifest.json

* Auto-update README

* Update upgrade

* 22.10

* Auto-update README

* 22.10.1

* 22.11

* Auto-update README

* 22.11.1

* Auto-update README

* Upgrade to version 22.11.1 (#100)

* Upgrade to v22.11.1

* Auto-update README

Co-authored-by: yunohost-bot <yunohost-bot@users.noreply.github.com>
Co-authored-by: yunohost-bot <yunohost@yunohost.org>
Co-authored-by: Éric Gaspar <46165813+ericgaspar@users.noreply.github.com>

* Fis php (#102)

* Update upgrade

* reorder script

* Update manifest.json

* Auto-update README

* Update restore

* Fix size

* Auto-update README

* Update DESCRIPTION_fr.md

* Auto-update README

* Fix

* 23.01

* Auto-update README

* PHP8.1

* 23.01.1

* Auto-update README

* Upgrade auto-updater (#108)

* [autopatch] Upgrade auto-updater

* Auto-update README

---------

Co-authored-by: tituspijean <titus@pijean.ovh>

* V2 (#107)

* Auto-update README

* v2

* Fix

* Update manifest.toml

* Update manifest.toml

* Fix

* Create post_install.md

* Fix

* Auto-update README

* Update install

* Update config_panel.toml

* Update manifest.toml

* Update _common.sh

* Update tests.toml

* Add post

* Update manifest.toml

* Update remove

* Update install

* Update _common.sh

* Fix

* Update change_url

* Update upgrade

* Auto-update README

* cleaning

* remove PHP version

* Update _common.sh

* Update manifest.toml

* Fix

* fix

* Update manifest.toml

* Update manifest.toml

* Update upgrade

* Update manifest.toml

* 23.02

* Auto-update README

* Update change_url

* Update change_url

* Update upgrade

---------

Co-authored-by: yunohost-bot <yunohost@yunohost.org>

---------

Co-authored-by: yunohost-bot <yunohost@yunohost.org>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: yunohost-bot <yunohost-bot@users.noreply.github.com>
Co-authored-by: tituspijean <titus@pijean.ovh>
This commit is contained in:
Éric Gaspar 2023-02-26 16:31:30 +01:00 committed by GitHub
parent b360a40547
commit 7f742e98f3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
22 changed files with 151 additions and 631 deletions

View file

@ -17,8 +17,8 @@
#=================================================
# 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]')
current_version=$(cat manifest.toml | tomlq -j '.version|split("~")[0]')
repo=$(cat manifest.toml | tomlq -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 "'"))
@ -100,7 +100,7 @@ echo "... conf/$src.src updated"
#=================================================
# Replace new version in manifest
echo "$(jq -s --indent 4 ".[] | .version = \"$version~ynh1\"" manifest.json)" > manifest.json
echo "$(tomlq -s --indent 4 ".[] | .version = \"$version~ynh1\"" manifest.toml)" > manifest.toml
# No need to update the README, yunohost-bot takes care of it

View file

@ -14,7 +14,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Fetch the source code
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Run the updater script
@ -33,7 +33,7 @@ jobs:
- name: Create Pull Request
id: cpr
if: ${{ env.PROCEED == 'true' }}
uses: peter-evans/create-pull-request@v3
uses: peter-evans/create-pull-request@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: Update to version ${{ env.VERSION }}

View file

@ -6,6 +6,7 @@ It shall NOT be edited by hand.
# BookStack for YunoHost
[![Integration level](https://dash.yunohost.org/integration/bookstack.svg)](https://dash.yunohost.org/appci/app/bookstack) ![Working status](https://ci-apps.yunohost.org/ci/badges/bookstack.status.svg) ![Maintenance status](https://ci-apps.yunohost.org/ci/badges/bookstack.maintain.svg)
[![Install BookStack with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=bookstack)
*[Lire ce readme en français.](./README_fr.md)*
@ -28,7 +29,7 @@ BookStack is an opinionated wiki system that provides a pleasant and simple out
- Diagrams.net Integration
**Shipped version:** 23.01.1~ynh1
**Shipped version:** 23.02~ynh1
**Demo:** https://demo.bookstackapp.com
@ -36,16 +37,6 @@ BookStack is an opinionated wiki system that provides a pleasant and simple out
![Screenshot of BookStack](./doc/screenshots/screenshot.png)
## Disclaimers / important information
## Configuration
BookStack uses LDAP authentication by default.
You can switch to standard authentication in the webadmin -> bookstack -> config panel setting.
For the first time Login with standard authentication, use the default credentials `admin@admin.com` and `password`. You should change these details immediately after logging in for the first time.
## Documentation and resources
* Official app website: <https://www.bookstackapp.com>

View file

@ -6,6 +6,7 @@ It shall NOT be edited by hand.
# BookStack pour YunoHost
[![Niveau dintégration](https://dash.yunohost.org/integration/bookstack.svg)](https://dash.yunohost.org/appci/app/bookstack) ![Statut du fonctionnement](https://ci-apps.yunohost.org/ci/badges/bookstack.status.svg) ![Statut de maintenance](https://ci-apps.yunohost.org/ci/badges/bookstack.maintain.svg)
[![Installer BookStack avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=bookstack)
*[Read this readme in english.](./README.md)*
@ -26,7 +27,7 @@ BookStack est un système wiki simple prête à l'emploi. Les nouveaux utilisate
- Multilingue
**Version incluse :** 23.01.1~ynh1
**Version incluse :** 23.02~ynh1
**Démo :** https://demo.bookstackapp.com
@ -34,16 +35,6 @@ BookStack est un système wiki simple prête à l'emploi. Les nouveaux utilisate
![Capture décran de BookStack](./doc/screenshots/screenshot.png)
## Avertissements / informations importantes
## Configuration
BookStack utilise l'authentification LDAP par défaut.
Vous pouvez passer à l'authentification standard dans le webadmin -> Bookstack -> paramètre du panneau de configuration.
Pour la première connexion avec une authentification standard, utilisez les informations d'identification par défaut `admin@admin.com` et `password`. Vous devez modifier ces informations immédiatement après vous être connecté pour la première fois.
## Documentations et ressources
* Site officiel de lapp : <https://www.bookstackapp.com>

View file

@ -1,27 +0,0 @@
;; Test complet
; Manifest
domain="domain.tld"
path="/path"
admin="john"
password="1Strong-Password"
language="fr"
is_public=1
; Checks
pkg_linter=1
setup_sub_dir=1
setup_root=1
setup_nourl=0
setup_private=1
setup_public=1
upgrade=1
upgrade=1 from_commit=12ee6097f4f48e6fb765afbe25dd10345e9c8adb
backup_restore=1
multi_instance=1
change_url=1
;;; Options
Email=
Notification=none
;;; Upgrade options
; commit=12ee6097f4f48e6fb765afbe25dd10345e9c8adb
name=Testing (#38)
manifest_arg=domain=DOMAIN&path=PATH&admin=USER&language=fr&is_public=1&password=pass&port=666&

View file

@ -53,7 +53,7 @@ MAIL_FROM=bookstack@__DOMAIN__
MAIL_HOST=localhost
MAIL_PORT=25
MAIL_USERNAME=bookstack
MAIL_PASSWORD=__MAIL_PWD__
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
# General auth

View file

@ -1,5 +1,5 @@
SOURCE_URL=https://api.github.com/repos/BookStackApp/BookStack/tarball/v23.01.1
SOURCE_SUM=1a8ac2b5bbd983dcfd8a9218220dae8137de1790394d937d31d469e7e72dce1d
SOURCE_URL=https://api.github.com/repos/BookStackApp/BookStack/tarball/v23.02
SOURCE_SUM=416d770ff04608bea79c7d15e98e6388d59612283d82c8126132577aba7e086c
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=
SOURCE_IN_SUBDIR=true

View file

@ -2,7 +2,7 @@
location __PATH__/ {
# Path to source
alias __FINALPATH__/public/;
alias __INSTALL_DIR__/public/;
client_max_body_size 256M;
client_body_timeout 120s; # Default is 60, May need to be increased for very large uploads

View file

@ -5,7 +5,7 @@ Description=BookStack Queue Worker
User=__APP__
Group=__APP__
Restart=always
ExecStart=/usr/bin/php__PHPVERSION__ __FINALPATH__/artisan queue:work --sleep=3 --tries=1 --max-time=3600
ExecStart=/usr/bin/php__PHPVERSION__ __INSTALL_DIR__/artisan queue:work --sleep=3 --tries=1 --max-time=3600
# Sandboxing options to harden security
# Depending on specificities of your service/app, you may need to tweak these

View file

@ -11,7 +11,7 @@ name = "BookStack configuration"
choices = ["standard", "ldap"]
default = "ldap"
help = "Select an authentication method to connect to BookStack."
bind = "AUTH_METHOD:__FINALPATH__/.env"
bind = "AUTH_METHOD:__INSTALL_DIR__/.env"
[main.php_fpm_config]
name = "PHP-FPM configuration"

View file

@ -1,5 +1,3 @@
## Configuration
BookStack uses LDAP authentication by default.
You can switch to standard authentication in the webadmin -> bookstack -> config panel setting.

View file

@ -1,5 +1,3 @@
## Configuration
BookStack utilise l'authentification LDAP par défaut.
Vous pouvez passer à l'authentification standard dans le webadmin -> Bookstack -> paramètre du panneau de configuration.

View file

@ -1,83 +0,0 @@
{
"name": "BookStack",
"id": "bookstack",
"packaging_format": 1,
"description": {
"en": "Platform to create documentation/wiki content",
"fr": "Plateforme pour créer du contenu de documentation/wiki"
},
"version": "23.01.1~ynh1",
"url": "https://www.bookstackapp.com/",
"upstream": {
"license": "MIT",
"website": "https://www.bookstackapp.com",
"demo": "https://demo.bookstackapp.com",
"admindoc": "https://www.bookstackapp.com/docs/admin/",
"userdoc": "https://www.bookstackapp.com/docs/user/",
"code": "https://github.com/BookStackApp/BookStack"
},
"license": "MIT",
"maintainer": {
"name": "eric_G",
"email": ""
},
"requirements": {
"yunohost": ">= 11.0.9"
},
"multi_instance": true,
"services": [
"nginx",
"php8.1-fpm",
"mysql"
],
"arguments": {
"install": [
{
"name": "domain",
"type": "domain"
},
{
"name": "path",
"type": "path",
"example": "/bookstack",
"default": "/bookstack"
},
{
"name": "admin",
"type": "user"
},
{
"name": "language",
"type": "string",
"ask": {
"en": "Choose the application language",
"fr": "Choisissez la langue de l'application"
},
"choices": [
"de",
"en",
"es_ES",
"fa",
"fr",
"it",
"lt",
"nl",
"pl",
"pt_PT",
"uk",
"zh_CN"
],
"default": "en"
},
{
"name": "is_public",
"type": "boolean",
"help": {
"en": "If enabled, BookStack will be accessible by people who do not have an account. This can be changed later via the webadmin.",
"fr": "Si cette case est cochée, BookStack sera accessible aux personnes nayant pas de compte. Vous pourrez changer ceci plus tard via la webadmin."
},
"default": true
}
]
}
}

67
manifest.toml Normal file
View file

@ -0,0 +1,67 @@
packaging_format = 2
id = "bookstack"
name = "BookStack"
description.en = "Platform to create documentation/wiki content"
description.fr = "Plateforme pour créer du contenu de documentation/wiki"
version = "23.02~ynh1"
maintainers = ["eric_G"]
[upstream]
license = "MIT"
website = "https://www.bookstackapp.com"
demo = "https://demo.bookstackapp.com"
admindoc = "https://www.bookstackapp.com/docs/admin/"
userdoc = "https://www.bookstackapp.com/docs/user/"
code = "https://github.com/BookStackApp/BookStack"
[integration]
yunohost = ">= 11.1.11"
architectures = "all"
multi_instance = true
ldap = true
sso = false
disk = "50M"
ram.build = "500M"
ram.runtime = "50M"
[install]
[install.domain]
type = "domain"
[install.path]
type = "path"
default = "/bookstack"
[install.admin]
type = "user"
[install.language]
ask.en = "Choose the application language"
ask.fr = "Choisissez la langue de l'application"
type = "string"
choices = ["de", "en", "es_ES", "fa", "fr", "it", "lt", "nl", "pl", "pt_PT", "uk", "zh_CN"]
default = "en"
[install.init_main_permission]
help.en = "If enabled, BookStack will be accessible by people who do not have an account. This can be changed later via the webadmin."
help.fr = "Si cette case est cochée, BookStack sera accessible aux personnes nayant pas de compte. Vous pourrez changer ceci plus tard via la webadmin."
type = "group"
default = "visitors"
[resources]
[resources.system_user]
[resources.install_dir]
[resources.permissions]
main.url = "/"
[resources.apt]
packages = "mariadb-server, php8.1-curl, php8.1-mysql, php8.1-ldap, php8.1-mbstring, php8.1-tidy, php8.1-xml, php8.1-zip, php8.1-gd"
[resources.database]
type = "mysql"

View file

@ -6,8 +6,6 @@
YNH_PHP_VERSION="8.1"
pkg_dependencies="php${YNH_PHP_VERSION}-curl php${YNH_PHP_VERSION}-mysql php${YNH_PHP_VERSION}-ldap php${YNH_PHP_VERSION}-mbstring php${YNH_PHP_VERSION}-tidy php${YNH_PHP_VERSION}-xml php${YNH_PHP_VERSION}-zip php${YNH_PHP_VERSION}-gd"
YNH_COMPOSER_VERSION=2.4.2
#=================================================

View file

@ -9,24 +9,6 @@
source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers
#=================================================
# MANAGE SCRIPT FAILURE
#=================================================
ynh_abort_if_errors
#=================================================
# LOAD SETTINGS
#=================================================
ynh_print_info --message="Loading installation settings..."
app=$YNH_APP_INSTANCE_NAME
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
domain=$(ynh_app_setting_get --app=$app --key=domain)
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
#=================================================
# DECLARE DATA AND CONF FILES TO BACKUP
#=================================================
@ -36,7 +18,7 @@ ynh_print_info --message="Declaring files to be backed up..."
# BACKUP THE APP MAIN DIR
#=================================================
ynh_backup --src_path="$final_path"
ynh_backup --src_path="$install_dir"
#=================================================
# BACKUP THE NGINX CONFIGURATION

View file

@ -9,60 +9,6 @@
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# RETRIEVE ARGUMENTS
#=================================================
old_domain=$YNH_APP_OLD_DOMAIN
old_path=$YNH_APP_OLD_PATH
new_domain=$YNH_APP_NEW_DOMAIN
new_path=$YNH_APP_NEW_PATH
app=$YNH_APP_INSTANCE_NAME
#=================================================
# LOAD SETTINGS
#=================================================
ynh_script_progression --message="Loading installation settings..." --weight=1
# Needed for helper "ynh_add_nginx_config"
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
phpversion=$YNH_PHP_VERSION
#=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
#=================================================
ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..." --weight=1
# Backup the current version of the app
ynh_backup_before_upgrade
ynh_clean_setup () {
# Remove the new domain config file, the remove script won't do it as it doesn't know yet its location.
ynh_secure_remove --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
# Restore it if the upgrade fails
ynh_restore_upgradebackup
}
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#=================================================
# CHECK WHICH PARTS SHOULD BE CHANGED
#=================================================
change_domain=0
if [ "$old_domain" != "$new_domain" ]
then
change_domain=1
fi
change_path=0
if [ "$old_path" != "$new_path" ]
then
change_path=1
fi
#=================================================
# STANDARD MODIFICATIONS
#=================================================
@ -79,29 +25,7 @@ ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd"
#=================================================
ynh_script_progression --message="Updating NGINX web server configuration..." --weight=1
nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf
# Change the path in the NGINX config file
if [ $change_path -eq 1 ]
then
# Make a backup of the original NGINX config file if modified
ynh_backup_if_checksum_is_different --file="$nginx_conf_path"
# Set global variables for NGINX helper
domain="$old_domain"
path_url="$new_path"
# Create a dedicated NGINX config
ynh_add_nginx_config
fi
# Change the domain for NGINX
if [ $change_domain -eq 1 ]
then
# Delete file checksum for the old conf file location
ynh_delete_file_checksum --file="$nginx_conf_path"
mv $nginx_conf_path /etc/nginx/conf.d/$new_domain.d/$app.conf
# Store file checksum for the new config file location
ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
fi
ynh_change_url_nginx_config
#=================================================
# MODIFY A CONFIG FILE
@ -110,11 +34,11 @@ ynh_script_progression --message="Reconfiguring congif file.." --weight=1
old_app_url_domain="https://${old_domain}${old_path%/}"
pushd $final_path
pushd $install_dir
yes | php$phpversion artisan bookstack:update-url $old_app_url_domain https://${new_domain}${new_path}
popd
sed -i "/APP_URL=/c\APP_URL=https://${new_domain}${new_path}" $final_path/.env
sed -i "/APP_URL=/c\APP_URL=https://${new_domain}${new_path}" $install_dir/.env
#=================================================
# GENERIC FINALISATION
@ -125,13 +49,6 @@ ynh_script_progression --message="Starting a systemd service..." --weight=1
ynh_systemd_action --service_name=$app --action="start" --log_path="systemd"
#=================================================
# RELOAD NGINX
#=================================================
ynh_script_progression --message="Reloading NGINX web server..." --weight=2
ynh_systemd_action --service_name=nginx --action=reload
#=================================================
# END OF SCRIPT
#=================================================

View file

@ -9,112 +9,54 @@
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# MANAGE SCRIPT FAILURE
#=================================================
ynh_abort_if_errors
#=================================================
# RETRIEVE ARGUMENTS FROM THE MANIFEST
#=================================================
# Retrieve arguments
domain=$YNH_APP_ARG_DOMAIN
path_url=$YNH_APP_ARG_PATH
is_public=$YNH_APP_ARG_IS_PUBLIC
language=$YNH_APP_ARG_LANGUAGE
phpversion=$YNH_PHP_VERSION
timezone="$(cat /etc/timezone)"
redis_db=$(ynh_redis_get_free_db)
mail_pwd=$(ynh_string_random --length=12)
admin=$YNH_APP_ARG_ADMIN
email=$(ynh_user_get_info --username=$admin --key=mail)
app=$YNH_APP_INSTANCE_NAME
auth_method="ldap"
fpm_footprint="low"
fpm_free_footprint=0
fpm_usage="low"
#=================================================
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
#=================================================
ynh_script_progression --message="Validating installation parameters..." --weight=1
final_path=/var/www/$app
test ! -e "$final_path" || ynh_die "This path already contains a folder"
# Register (book) web path
ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url
#=================================================
# STORE SETTINGS FROM MANIFEST
#=================================================
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
ynh_app_setting_set --app=$app --key=language --value=$language
ynh_app_setting_set --app=$app --key=admin --value=$admin
ynh_app_setting_set --app=$app --key=redis_db --value=$redis_db
ynh_app_setting_set --app=$app --key=auth_method --value=$auth_method
ynh_app_setting_set --app=$app --key=fpm_footprint --value=$fpm_footprint
ynh_app_setting_set --app=$app --key=fpm_free_footprint --value=$fpm_free_footprint
ynh_app_setting_set --app=$app --key=fpm_usage --value=$fpm_usage
#=================================================
# INSTALL DEPENDENCIES
#=================================================
ynh_script_progression --message="Installing dependencies..." --weight=1
ynh_install_app_dependencies $pkg_dependencies
#=================================================
# CREATE A MYSQL DATABASE
#=================================================
ynh_script_progression --message="Creating a MySQL database..." --weight=1
db_name=$(ynh_sanitize_dbid --db_name=$app)
db_user=$db_name
ynh_app_setting_set --app=$app --key=db_name --value=$db_name
ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name
#=================================================
# CREATE DEDICATED USER
#=================================================
ynh_script_progression --message="Configuring system user..." --weight=2
# Create a system user
ynh_system_user_create --username=$app --home_dir=$final_path
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
ynh_script_progression --message="Setting up source files..." --weight=7
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"
ynh_setup_source --dest_dir="$install_dir"
# Set permissions to app files
chmod 750 $install_dir
chmod -R o-rwx $install_dir
chown -R $app:www-data $install_dir
#=================================================
# PHP-FPM CONFIGURATION
# SYSTEM CONFIGURATION
#=================================================
ynh_script_progression --message="Configuring PHP-FPM..." --weight=2
ynh_script_progression --message="Adding system configurations related to $app ..." --weight=1
# Create a dedicated PHP-FPM config
ynh_add_fpm_config --usage=$fpm_usage --footprint=$fpm_footprint
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
#=================================================
# NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Configuring NGINX web server..." --weight=2
# Create a dedicated NGINX config
ynh_add_nginx_config
# Create a dedicated systemd config
ynh_add_systemd_config
yunohost service add $app --description="BookStack Queue Worker" --log="/var/log/$app/$app.log"
#=================================================
# INSTALL LYCHEE WITH COMPOSER
#=================================================
@ -128,44 +70,24 @@ ynh_install_composer
#=================================================
ynh_script_progression --message="Adding a configuration file..." --weight=1
app_url_domain="https://$domain${path_url%/}"
app_url_domain="https://$domain${path%/}"
ynh_add_config --template=../conf/.env.example --destination=$final_path/.env
ynh_add_config --template=../conf/.env.example --destination=$install_dir/.env
chmod 600 $install_dir/.env
chown $app:$app $install_dir/.env
#=================================================
# FINAL BOOKSTACK INSTALL
#=================================================
ynh_script_progression --message="Install BookStack" --weight=5
pushd $final_path
pushd $install_dir
php$phpversion artisan key:generate --no-interaction --force
php$phpversion artisan migrate --no-interaction --force
php$phpversion artisan bookstack:create-admin --email="$email" --name="$admin" --external-auth-id="$admin"
popd
# Set permissions to app files
chmod 755 $final_path
chmod -R o-rwx $final_path
chown -R $app:www-data $final_path
chmod 600 $final_path/.env
chown $app:$app $final_path/.env
#=================================================
# SETUP SYSTEMD
#=================================================
ynh_script_progression --message="Configuring a systemd service..." --weight=1
# Create a dedicated systemd config
ynh_add_systemd_config
#=================================================
# INTEGRATE SERVICE IN YUNOHOST
#=================================================
ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
yunohost service add $app --description="BookStack Queue Worker" --log="/var/log/$app/$app.log"
#=================================================
# START SYSTEMD SERVICE
#=================================================
@ -174,24 +96,6 @@ ynh_script_progression --message="Starting a systemd service..." --weight=1
# Start a systemd service
ynh_systemd_action --service_name=$app --action="start" --log_path="systemd"
#=================================================
# SETUP SSOWAT
#=================================================
ynh_script_progression --message="Configuring permissions..." --weight=1
# Make app public if necessary
if [ $is_public -eq 1 ]
then
ynh_permission_update --permission="main" --add="visitors"
fi
#=================================================
# RELOAD NGINX
#=================================================
ynh_script_progression --message="Reloading NGINX web server..." --weight=2
ynh_systemd_action --service_name=nginx --action=reload
#=================================================
# END OF SCRIPT
#=================================================

View file

@ -10,23 +10,11 @@ source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# LOAD SETTINGS
# REMOVE SYSTEM CONFIGURATIONS
#=================================================
ynh_script_progression --message="Loading installation settings..." --weight=1
app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get --app=$app --key=domain)
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
db_user=$db_name
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
redis_db=$(ynh_app_setting_get --app=$app --key=redis_db)
#=================================================
# STANDARD REMOVE
#=================================================
# REMOVE SERVICE INTEGRATION IN YUNOHOST
# REMOVE SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Removing system configurations related to $app..." --weight=1
# Remove the service from the list of services known by YunoHost (added from `yunohost service add`)
if ynh_exec_warn_less yunohost service status $app >/dev/null
@ -35,71 +23,17 @@ then
yunohost service remove $app
fi
#=================================================
# STOP AND REMOVE SERVICE
#=================================================
ynh_script_progression --message="Stopping and removing the systemd service..." --weight=1
# Remove the dedicated systemd config
ynh_remove_systemd_config
#=================================================
# REMOVE THE MYSQL DATABASE
#=================================================
ynh_script_progression --message="Removing the MySQL database..." --weight=1
# Remove a database if it exists, along with the associated user
ynh_mysql_remove_db --db_user=$db_user --db_name=$db_name
#=================================================
# REMOVE THE REDIS DATABASE
#=================================================
ynh_script_progression --message="Removing the redis database..."
ynh_redis_remove_db "$redis_db"
#=================================================
# REMOVE APP MAIN DIR
#=================================================
ynh_script_progression --message="Removing app main directory..." --weight=2
# Remove the app directory securely
ynh_secure_remove --file="$final_path"
#=================================================
# REMOVE NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Removing NGINX web server configuration..." --weight=1
# Remove the dedicated NGINX config
ynh_remove_nginx_config
#=================================================
# REMOVE PHP-FPM CONFIGURATION
#=================================================
ynh_script_progression --message="Removing PHP-FPM configuration..." --weight=2
# Remove the dedicated PHP-FPM config
ynh_remove_fpm_config
#=================================================
# REMOVE DEPENDENCIES
#=================================================
ynh_script_progression --message="Removing dependencies..." --weight=1
# Remove metapackage and its dependencies
ynh_remove_app_dependencies
#=================================================
# GENERIC FINALIZATION
#=================================================
# REMOVE DEDICATED USER
#=================================================
ynh_script_progression --message="Removing the dedicated system user..." --weight=1
# Delete a system user
ynh_system_user_delete --username=$app
#=================================================
# END OF SCRIPT
#=================================================

View file

@ -9,126 +9,54 @@
source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers
#=================================================
# MANAGE SCRIPT FAILURE
#=================================================
ynh_abort_if_errors
#=================================================
# LOAD SETTINGS
#=================================================
ynh_script_progression --message="Loading installation settings..." --weight=1
app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get --app=$app --key=domain)
path_url=$(ynh_app_setting_get --app=$app --key=path)
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
db_user=$db_name
phpversion=$YNH_PHP_VERSION
fpm_footprint=$(ynh_app_setting_get --app=$app --key=fpm_footprint)
fpm_usage=$(ynh_app_setting_get --app=$app --key=fpm_usage)
#=================================================
# CHECK IF THE APP CAN BE RESTORED
#=================================================
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
#=================================================
# RECREATE THE DEDICATED USER
#=================================================
ynh_script_progression --message="Recreating the dedicated system user..." --weight=3
# Create the dedicated user (if not existing)
ynh_system_user_create --username=$app --home_dir=$final_path
#=================================================
# RESTORE THE APP MAIN DIR
#=================================================
ynh_script_progression --message="Restoring the app main directory..." --weight=1
ynh_restore_file --origin_path="$final_path"
ynh_restore_file --origin_path="$install_dir"
# Restore permissions on app files
chmod 755 $final_path
chown -R $app:www-data $final_path
chmod -R o-rwx $final_path
chmod 600 $final_path/.env
#=================================================
# REINSTALL DEPENDENCIES
#=================================================
ynh_script_progression --message="Reinstalling dependencies..." --weight=1
# Define and install dependencies
ynh_install_app_dependencies $pkg_dependencies
#=================================================
# RESTORE THE PHP-FPM CONFIGURATION
#=================================================
ynh_script_progression --message="Reconfiguring PHP-FPM..." --weight=5
ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
# Recreate a dedicated php-fpm config
ynh_add_fpm_config --usage=$fpm_usage --footprint=$fpm_footprint --phpversion=$phpversion
#=================================================
# RESTORE THE NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Restoring the NGINX configuration..." --weight=1
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
chmod 750 $install_dir
chmod -R o-rwx $install_dir
chown -R $app:www-data $install_dir
chmod 600 $install_dir/.env
#=================================================
# RESTORE THE MYSQL DATABASE
#=================================================
ynh_script_progression --message="Restoring the MySQL database..." --weight=2
db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd
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..." --weight=1
# RESTORE THE PHP-FPM CONFIGURATION
#=================================================
ynh_script_progression --message="Restoring system configurations related to $app..." --weight=1
ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
ynh_restore_file --origin_path="/etc/systemd/system/$app.service"
systemctl enable $app.service --quiet
#=================================================
# INTEGRATE SERVICE IN YUNOHOST
#=================================================
ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
yunohost service add $app --description="BookStack Queue Worker" --log="/var/log/$app/$app.log"
#=================================================
# START SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Starting a systemd service..." --weight=1
ynh_systemd_action --service_name=$app --action="start" --log_path="systemd"
#=================================================
# GENERIC FINALIZATION
#=================================================
# RELOAD NGINX AND PHP-FPM
# RELOAD NGINX AND PHP-FPM OR THE APP SERVICE
#=================================================
ynh_script_progression --message="Reloading NGINX web server and PHP-FPM..." --weight=2
ynh_script_progression --message="Reloading NGINX web server and $app's service..." --weight=1
ynh_systemd_action --service_name=php$phpversion-fpm --action=reload
ynh_systemd_action --service_name=nginx --action=reload
ynh_systemd_action --service_name=$app --action="start" --log_path="systemd"
#=================================================
# END OF SCRIPT
#=================================================

View file

@ -9,94 +9,41 @@
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# LOAD SETTINGS
#=================================================
ynh_script_progression --message="Loading installation settings..." --weight=1
app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get --app=$app --key=domain)
path_url=$(ynh_app_setting_get --app=$app --key=path)
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
language=$(ynh_app_setting_get --app=$app --key=language)
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
db_user=$db_name
db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
phpversion=$YNH_PHP_VERSION
timezone="$(cat /etc/timezone)"
redis_db=$(ynh_app_setting_get --app=$app --key=redis_db)
mail_pwd=$(ynh_string_random --length=12)
fpm_footprint=$(ynh_app_setting_get --app=$app --key=fpm_footprint)
fpm_free_footprint=$(ynh_app_setting_get --app=$app --key=fpm_free_footprint)
fpm_usage=$(ynh_app_setting_get --app=$app --key=fpm_usage)
auth_method=$(ynh_app_setting_get --app=$app --key=auth_method)
#=================================================
# CHECK VERSION
#=================================================
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)..." --weight=1
# Backup the current version of the app
ynh_backup_before_upgrade
ynh_clean_setup () {
# Restore it if the upgrade fails
ynh_restore_upgradebackup
}
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#=================================================
# ENSURE DOWNWARD COMPATIBILITY
#=================================================
ynh_script_progression --message="Ensuring downward compatibility..." --weight=1
# If fpm_footprint doesn't exist, create it
if [ -z "$fpm_footprint" ]; then
if [ -z "${fpm_footprint:-}" ]; then
fpm_footprint=low
ynh_app_setting_set --app=$app --key=fpm_footprint --value=$fpm_footprint
fi
# If fpm_free_footprint doesn't exist, create it
if [ -z "$fpm_free_footprint" ]; then
if [ -z "${fpm_free_footprint:-}" ]; then
fpm_free_footprint=0
ynh_app_setting_set --app=$app --key=fpm_free_footprint --value=$fpm_free_footprint
fi
# If fpm_usage doesn't exist, create it
if [ -z "$fpm_usage" ]; then
if [ -z "${fpm_usage:-}" ]; then
fpm_usage=low
ynh_app_setting_set --app=$app --key=fpm_usage --value=$fpm_usage
fi
# If auth_method doesn't exist, create it
if [ -z "$auth_method" ]; then
if [ -z "${auth_method:-}" ]; then
auth_method="standard"
ynh_app_setting_set --app=$app --key=auth_method --value=$auth_method
fi
# Cleaning legacy permissions
if ynh_legacy_permissions_exists; then
ynh_legacy_permissions_delete_all
ynh_app_setting_delete --app=$app --key=is_public
fi
#=================================================
# CREATE DEDICATED USER
#=================================================
ynh_script_progression --message="Making sure dedicated system user exists..." --weight=2
# Create a dedicated user (if not existing)
ynh_system_user_create --username=$app --home_dir=$final_path
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
@ -106,33 +53,29 @@ then
ynh_script_progression --message="Upgrading source files..." --weight=1
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$final_path" --keep=".env public/uploads storage/uploads"
ynh_setup_source --dest_dir="$install_dir" --keep=".env public/uploads storage/uploads"
fi
#=================================================
# UPGRADE DEPENDENCIES
#=================================================
ynh_script_progression --message="Upgrading dependencies..." --weight=1
ynh_install_app_dependencies $pkg_dependencies
chmod 755 $install_dir
chmod -R o-rwx $install_dir
chown -R $app:www-data $install_dir
#=================================================
# PHP-FPM CONFIGURATION
# REAPPLY SYSTEM CONFIGURATIONS
#=================================================
ynh_script_progression --message="Upgrading PHP-FPM configuration..." --weight=1
ynh_script_progression --message="Upgrading system configurations related to $app..." --weight=1
# Create a dedicated PHP-FPM config
ynh_add_fpm_config --phpversion=$phpversion --usage=$fpm_usage --footprint=$fpm_footprint
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
#=================================================
# NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=3
# Create a dedicated NGINX config
ynh_add_nginx_config
# Create a dedicated systemd config
ynh_add_systemd_config
yunohost service add $app --description="BookStack Queue Worker" --log="/var/log/$app/$app.log"
#=================================================
# INSTALL LYCHEE WITH COMPOSER
#=================================================
@ -146,16 +89,17 @@ ynh_install_composer
#=================================================
#ynh_script_progression --message="Adding a configuration file..." --weight=1
#app_url_domain="https://$domain${path_url%/}"
#timezone="$(cat /etc/timezone)"
#app_url_domain="https://$domain${path%/}"
#ynh_add_config --template=../conf/.env.example --destination=$final_path/.env
#ynh_add_config --template=../conf/.env.example --destination=$install_dir/.env
#=================================================
# FINAL BOOKSTACK INSTALL
#=================================================
ynh_script_progression --message="Install BookStack" --weight=5
pushd $final_path
pushd $install_dir
php$phpversion artisan migrate --force
php$phpversion artisan key:generate --force
php$phpversion artisan cache:clear
@ -163,28 +107,6 @@ pushd $final_path
php$phpversion artisan view:clear
popd
chmod 755 $final_path
chmod -R o-rwx $final_path
chown -R $app:www-data $final_path
chmod 600 $final_path/.env
chown $app:$app $final_path/.env
#=================================================
# SETUP SYSTEMD
#=================================================
ynh_script_progression --message="Upgrading systemd configuration..." --weight=1
# Create a dedicated systemd config
ynh_add_systemd_config
#=================================================
# INTEGRATE SERVICE IN YUNOHOST
#=================================================
ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
yunohost service add $app --description="BookStack Queue Worker" --log="/var/log/$app/$app.log"
#=================================================
# START SYSTEMD SERVICE
#=================================================
@ -192,13 +114,6 @@ ynh_script_progression --message="Starting a systemd service..." --weight=1
ynh_systemd_action --service_name=$app --action="start" --log_path="systemd"
#=================================================
# RELOAD NGINX
#=================================================
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
ynh_systemd_action --service_name=nginx --action=reload
#=================================================
# END OF SCRIPT
#=================================================

7
tests.toml Normal file
View file

@ -0,0 +1,7 @@
test_format = 1.0
[default]
exclude = ["install.nourl"]
test_upgrade_from.d653976.name = "Upgrade from 23.01"