1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/bookstack_ynh.git synced 2024-09-03 18:16:02 +02:00
- Upgrade to 21.12.3
- (partially) fix change_url script (we still have problems on multiple URL changes)
- Now the app preseves images when updating
- Update to PHP8
This commit is contained in:
Éric Gaspar 2022-01-29 15:29:42 +01:00 committed by GitHub
parent aaa9c9534b
commit 12ee6097f4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 166 additions and 81 deletions

View file

@ -15,9 +15,10 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in
## Overview
Platform to create documentation/wiki content
BookStack is an opinionated wiki system that provides a pleasant and simple out of the box experience. New users to an instance should find the experience intuitive and only basic word-processing skills should be required to get involved in creating content on BookStack. The platform should provide advanced power features to those that desire it but they should not interfere with the core simple user experience.
**Shipped version:** 21.05.3~ynh1
**Shipped version:** 21.12.3~ynh1
**Demo:** https://demo.bookstackapp.com
@ -36,7 +37,6 @@ For the first time Login, use the default credentials `admin@admin.com` and `pas
## Documentation and resources
* Official app website: https://www.bookstackapp.com
* Official user documentation: https://yunohost.org/en/app_bookstack
* Official admin documentation: https://www.bookstackapp.com/docs
* Upstream app code repository: https://github.com/BookStackApp/BookStack
* YunoHost documentation for this app: https://yunohost.org/app_bookstack

View file

@ -11,9 +11,10 @@ Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour
## Vue d'ensemble
Plateforme pour créer du contenu de documentation/wiki
BookStack is an opinionated wiki system that provides a pleasant and simple out of the box experience. New users to an instance should find the experience intuitive and only basic word-processing skills should be required to get involved in creating content on BookStack. The platform should provide advanced power features to those that desire it but they should not interfere with the core simple user experience.
**Version incluse :** 21.05.3~ynh1
**Version incluse :** 21.12.3~ynh1
**Démo :** https://demo.bookstackapp.com
@ -30,7 +31,6 @@ Login using the default admin details `admin@admin.com` with a password of `pass
## Documentations et ressources
* Site officiel de l'app : https://www.bookstackapp.com
* Documentation officielle utilisateur : https://yunohost.org/en/app_bookstack
* Documentation officielle de l'admin : https://www.bookstackapp.com/docs
* Dépôt de code officiel de l'app : https://github.com/BookStackApp/BookStack
* Documentation YunoHost pour cette app : https://yunohost.org/app_bookstack

View file

@ -12,19 +12,15 @@
setup_private=1
setup_public=1
upgrade=1
#Testing (#30)
upgrade=1 from_commit=b7abcc46a0c3c90c9b36d4c00e40d26a1aab429b
#Testing
upgrade=1 from_commit=ad39f14ce54d80d30c2e847d0b47a7b5af6b6920
upgrade=1 from_commit=aaa9c9534b01a210989aceb4ad4d2b9c585be6df
backup_restore=1
multi_instance=0
change_url=0
change_url=1
;;; Options
Email=
Notification=none
;;; Upgrade options
; commit=b7abcc46a0c3c90c9b36d4c00e40d26a1aab429b
name=Testing (#30)
; commit=ad39f14ce54d80d30c2e847d0b47a7b5af6b6920
name=Testing
; commit=aaa9c9534b01a210989aceb4ad4d2b9c585be6df
name=Testing (#35)
manifest_arg=domain=DOMAIN&path=PATH&admin=USER&language=fr&is_public=1&password=pass&port=666&

View file

@ -6,11 +6,16 @@
# NOTE: If any of your values contain a space or a hash you will need to
# wrap the entire value in quotes. (eg. MAIL_FROM_NAME="BookStack Mailer")
# Enable debug mode
# Shows advanced debug information and errors.
# CAN EXPOSE OTHER VARIABLES, LEAVE DISABLED
APP_DEBUG=false
# Application key
APP_KEY=SomeRandomString
# Application URL
APP_URL=https://__DOMAIN____PATH__
APP_URL=__APP_URL_DOMAIN__
# Application default language
APP_LANG=__LANGUAGE__
@ -19,12 +24,12 @@ APP_LANG=__LANGUAGE__
APP_AUTO_LANG_PUBLIC=true
# Application timezone
APP_TIMEZONE=UTC
APP_TIMEZONE=__TIMEZONE__
# Database details
DB_HOST=localhost
DB_DATABASE=__DB_NAME__
DB_USERNAME=__DB_NAME__
DB_USERNAME=__DB_USER__
DB_PASSWORD=__DB_PWD__
# Mail system to use
@ -52,11 +57,22 @@ LDAP_SERVER=ldap://127.0.0.1:389
LDAP_BASE_DN=ou=users,dc=yunohost,dc=org
LDAP_DN=false
LDAP_PASS=false
LDAP_USER_FILTER="(&(|(objectclass=posixAccount))(uid={{username}})(permission=cn=__APP__.main,ou=permission,dc=yunohost,dc=org))"
LDAP_VERSION=false
LDAP_USER_FILTER=(&(|(objectclass=posixAccount))(uid={{username}})(permission=cn=__APP__.main,ou=permission,dc=yunohost,dc=org))
LDAP_VERSION=3
LDAP_TLS_INSECURE=false
LDAP_ID_ATTRIBUTE=uid
LDAP_EMAIL_ATTRIBUTE=mail
LDAP_DISPLAY_NAME_ATTRIBUTE=cn
LDAP_FOLLOW_REFERRALS=true
LDAP_DUMP_USER_DETAILS=false
# Set both the cache and session to use Redis
CACHE_DRIVER=redis
SESSION_DRIVER=redis
# Example of using a single local Redis server
REDIS_SERVERS=127.0.0.1:6379:__REDIS_DB__
# Storage system to use
# Can be 'local', 'local_secure' or 's3'
STORAGE_TYPE=local

View file

@ -1,9 +1,7 @@
SOURCE_URL=https://github.com/BookStackApp/BookStack/archive/refs/tags/v21.05.3.tar.gz
SOURCE_SUM=a83e2a30ebf58e2bf6d3f0581c7be2cd94d9db531532d1862bc61b6f60f50c0d
SOURCE_URL=https://github.com/BookStackApp/BookStack/archive/refs/tags/v21.12.3.tar.gz
SOURCE_SUM=c6182009052069b62e1c70307bc030cc22439ef1da29baf6a315690093693557
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=tar.gz
SOURCE_IN_SUBDIR=true
SOURCE_EXTRACT=true
SOURCE_FILENAME=bookstack.tar.gz

View file

@ -4,11 +4,6 @@ location __PATH__/ {
# Path to source
alias __FINALPATH__/public/;
# Force usage of https
if ($scheme = http) {
rewrite ^ https://$server_name$request_uri? permanent;
}
client_max_body_size 100m;
client_body_timeout 120s; # Default is 60, May need to be increased for very large uploads

1
doc/DESCRIPTION.md Normal file
View file

@ -0,0 +1 @@
BookStack is an opinionated wiki system that provides a pleasant and simple out of the box experience. New users to an instance should find the experience intuitive and only basic word-processing skills should be required to get involved in creating content on BookStack. The platform should provide advanced power features to those that desire it but they should not interfere with the core simple user experience.

View file

@ -4,16 +4,15 @@
"packaging_format": 1,
"description": {
"en": "Platform to create documentation/wiki content",
"fr": "Plateforme pour créer du contenu de documentation/wiki "
"fr": "Plateforme pour créer du contenu de documentation/wiki"
},
"version": "21.05.3~ynh1",
"version": "21.12.3~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",
"userdoc": "https://yunohost.org/en/app_bookstack",
"code": "https://github.com/BookStackApp/BookStack"
},
"license": "MIT",
@ -22,7 +21,7 @@
"email": "liberodark@gmail.com"
},
"requirements": {
"yunohost": ">= 4.2.4"
"yunohost": ">= 4.3.0"
},
"multi_instance": false,
"services": [
@ -33,8 +32,7 @@
"arguments": {
"install": [{
"name": "domain",
"type": "domain",
"example": "example.com"
"type": "domain"
},
{
"name": "path",
@ -49,7 +47,7 @@
"en": "Choose the application language",
"fr": "Choisissez la langue de l'application"
},
"choices": ["de", "en", "es", "fr", "it", "nl"],
"choices": ["de", "en", "es", "fr", "it", "nl", "pt"],
"default": "en"
},
{

View file

@ -4,9 +4,9 @@
# COMMON VARIABLES
#=================================================
YNH_PHP_VERSION="7.3"
YNH_PHP_VERSION="8.0"
extra_php_dependencies="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"
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.1.1
@ -21,3 +21,45 @@ YNH_COMPOSER_VERSION=2.1.1
#=================================================
# FUTURE OFFICIAL HELPERS
#=================================================
#=================================================
# REDIS HELPERS
#=================================================
# get the first available redis database
#
# usage: ynh_redis_get_free_db
# | returns: the database number to use
ynh_redis_get_free_db() {
local result max db
result="$(redis-cli INFO keyspace)"
# get the num
max=$(cat /etc/redis/redis.conf | grep ^databases | grep -Eow "[0-9]+")
db=0
# default Debian setting is 15 databases
for i in $(seq 0 "$max")
do
if ! echo "$result" | grep -q "db$i"
then
db=$i
break 1
fi
db=-1
done
test "$db" -eq -1 && ynh_die --message="No available Redis databases..."
echo "$db"
}
# Create a master password and set up global settings
# Please always call this script in install and restore scripts
#
# usage: ynh_redis_remove_db database
# | arg: database - the database to erase
ynh_redis_remove_db() {
local db=$1
redis-cli -n "$db" flushall
}

View file

@ -28,9 +28,7 @@ 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)
language=$(ynh_app_setting_get --app=$app --key=language)
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
phpversion=$YNH_PHP_VERSION
#=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
@ -99,14 +97,16 @@ fi
#=================================================
# MODIFY A CONFIG FILE
#=================================================
ynh_script_progression --message="Reconfiguring congif file.." --weight=1
path_url="$new_path"
domain="$new_domain"
mail_pwd=$(ynh_string_random --length=12)
new_app_url_domain="https://${new_domain}${new_path%/}"
old_app_url_domain="https://${old_domain}${old_path%/}"
ynh_add_config --template=../conf/.env.example --destination=$final_path/.env
pushd $final_path
yes | php$phpversion artisan bookstack:update-url $old_app_url_domain $new_app_url_domain
popd
chmod 600 $final_path/.env
sed -i "/APP_URL=/c\APP_URL=$new_app_url_domain" $final_path/.env
#=================================================
# RELOAD NGINX

View file

@ -24,6 +24,10 @@ 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)
app=$YNH_APP_INSTANCE_NAME
@ -46,6 +50,14 @@ 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=redis_db --value=$redis_db
#=================================================
# INSTALL DEPENDENCIES
#=================================================
ynh_script_progression --message="Installing dependencies..." --weight=1
ynh_install_app_dependencies $pkg_dependencies
#=================================================
# CREATE A MYSQL DATABASE
@ -76,8 +88,8 @@ ynh_setup_source --dest_dir="$final_path"
# Set permissions to app files
chmod 755 $final_path
chown -R $app:www-data $final_path
chmod -R o-rwx $final_path
chown -R $app:www-data $final_path
#=================================================
# NGINX CONFIGURATION
@ -93,8 +105,7 @@ ynh_add_nginx_config
ynh_script_progression --message="Configuring PHP-FPM..." --weight=2
# Create a dedicated PHP-FPM config
ynh_add_fpm_config --package="$extra_php_dependencies"
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
ynh_add_fpm_config
#=================================================
# INSTALL LYCHEE WITH COMPOSER
@ -107,8 +118,10 @@ ynh_install_composer --phpversion=$phpversion --workdir=$final_path --install_ar
#=================================================
# MODIFY A CONFIG FILE
#=================================================
ynh_script_progression --message="Adding a configuration file..." --weight=1
app_url_domain="https://$domain${path_url%/}"
mail_pwd=$(ynh_string_random --length=12)
ynh_add_config --template=../conf/.env.example --destination=$final_path/.env
chmod 600 $final_path/.env

View file

@ -20,6 +20,7 @@ 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)
#=================================================
# REMOVE THE MYSQL DATABASE
@ -29,6 +30,13 @@ 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
#=================================================
@ -53,6 +61,14 @@ 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
#=================================================

View file

@ -27,17 +27,14 @@ 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_app_setting_get --app=$app --key=phpversion)
phpversion=$YNH_PHP_VERSION
#=================================================
# CHECK IF THE APP CAN BE RESTORED
#=================================================
ynh_script_progression --message="Validating restoration parameters..." --weight=1
ynh_webpath_available --domain=$domain --path_url=$path_url \
|| ynh_die --message="Path not available: ${domain}${path_url}"
test ! -d $final_path \
|| ynh_die --message="There is already a directory: $final_path "
test ! -d $final_path || ynh_die --message="There is already a directory: $final_path "
#=================================================
# STANDARD RESTORATION STEPS
@ -68,6 +65,14 @@ 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
#=================================================
@ -75,8 +80,6 @@ ynh_script_progression --message="Reconfiguring PHP-FPM..." --weight=5
ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
ynh_add_fpm_config --package="$extra_php_dependencies"
#=================================================
# RESTORE THE MYSQL DATABASE
#=================================================

View file

@ -23,7 +23,9 @@ 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_app_setting_get --app=$app --key=phpversion)
phpversion=$YNH_PHP_VERSION
redis_db=$(ynh_app_setting_get --app=$app --key=redis_db)
mail_pwd=$(ynh_string_random --length=12)
#=================================================
# CHECK VERSION
@ -45,6 +47,18 @@ ynh_clean_setup () {
# 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
# 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
#=================================================
@ -61,23 +75,8 @@ if [ "$upgrade_type" == "UPGRADE_APP" ]
then
ynh_script_progression --message="Upgrading source files..." --weight=1
# Create a temporary directory
tmpdir="$(mktemp -d)"
# Backup the config file in the temp dir
cp -a "$final_path/.env" "$tmpdir/.env"
# Remove the app directory securely
ynh_secure_remove --file="$final_path"
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$final_path"
# Copy the admin saved settings from tmp directory to final path
cp -a "$tmpdir/.env" "$final_path/.env"
# Remove the tmp directory securely
ynh_secure_remove --file="$tmpdir"
ynh_setup_source --dest_dir="$final_path" --keep="$final_path/.env $final_path/public/uploads $final_path/storage/uploads"
fi
#=================================================
@ -88,13 +87,20 @@ 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..." --weight=1
ynh_install_app_dependencies $pkg_dependencies
#=================================================
# PHP-FPM CONFIGURATION
#=================================================
ynh_script_progression --message="Upgrading PHP-FPM configuration..." --weight=1
# Create a dedicated PHP-FPM config
ynh_add_fpm_config --package="$extra_php_dependencies"
ynh_add_fpm_config
#=================================================
# INSTALL LYCHEE WITH COMPOSER
@ -102,7 +108,7 @@ ynh_add_fpm_config --package="$extra_php_dependencies"
ynh_script_progression --message="Installing BookStack with Composer..." --weight=5
# Install composer
ynh_install_composer --phpversion=$phpversion --workdir=$final_path --install_args="--prefer-source --no-dev"
ynh_install_composer --install_args="--no-dev"
#=================================================
# FINAL BOOKSTACK INSTALL
@ -110,16 +116,17 @@ ynh_install_composer --phpversion=$phpversion --workdir=$final_path --install_ar
ynh_script_progression --message="Install BookStack" --weight=5
pushd $final_path
php$phpversion artisan migrate --no-interaction \
&& php$phpversion artisan cache:clear --no-interaction \
&& php$phpversion artisan view:clear --no-interaction
php$phpversion artisan migrate --force
php$phpversion artisan key:generate --force
php$phpversion artisan cache:clear
php$phpversion artisan config:clear
php$phpversion artisan view:clear
popd
# Set 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
chown -R $app:www-data $final_path
#chmod 600 $final_path/.env
#=================================================
# RELOAD NGINX