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

Merge branch 'testing' into Fix-url

This commit is contained in:
ericgaspar 2022-02-28 13:45:11 +01:00
commit 9f50a3c575
No known key found for this signature in database
GPG key ID: 574F281483054D44
15 changed files with 380 additions and 30 deletions

136
.github/workflows/updater.sh vendored Executable file
View file

@ -0,0 +1,136 @@
#!/bin/bash
#=================================================
# PACKAGE UPDATING HELPER
#=================================================
# This script is meant to be run by GitHub Actions
# The YunoHost-Apps organisation offers a template Action to run this script periodically
# Since each app is different, maintainers can adapt its contents so as to perform
# automatic actions when a new upstream release is detected.
# Remove this exit command when you are ready to run this Action
exit 1
#=================================================
# FETCHING LATEST RELEASE AND ITS ASSETS
#=================================================
# 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]')
# 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 "'"))
# Later down the script, we assume the version has only digits and dots
# Sometimes the release name starts with a "v", so let's filter it out.
# You may need more tweaks here if the upstream repository has different naming conventions.
if [[ ${version:0:1} == "v" || ${version:0:1} == "V" ]]; then
version=${version:1}
fi
# Setting up the environment variables
echo "Current version: $current_version"
echo "Latest release from upstream: $version"
echo "VERSION=$version" >> $GITHUB_ENV
# For the time being, let's assume the script will fail
echo "PROCEED=false" >> $GITHUB_ENV
# Proceed only if the retrieved version is greater than the current one
if ! dpkg --compare-versions "$current_version" "lt" "$version" ; then
echo "::warning ::No new version available"
exit 0
# Proceed only if a PR for this new version does not already exist
elif git ls-remote -q --exit-code --heads https://github.com/$GITHUB_REPOSITORY.git ci-auto-update-v$version ; then
echo "::warning ::A branch already exists for this update"
exit 0
fi
# 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
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
# Create the temporary directory
tempdir="$(mktemp -d)"
# Download sources and calculate checksum
filename=${asset_url##*/}
curl --silent -4 -L $asset_url -o "$tempdir/$filename"
checksum=$(sha256sum "$tempdir/$filename" | head -c 64)
# Delete temporary directory
rm -rf $tempdir
# Get extension
if [[ $filename == *.tar.gz ]]; then
extension=tar.gz
else
extension=${filename##*.}
fi
# Rewrite source file
cat <<EOT > conf/$src.src
SOURCE_URL=$asset_url
SOURCE_SUM=$checksum
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=$extension
SOURCE_IN_SUBDIR=true
SOURCE_FILENAME=
EOT
echo "... conf/$src.src updated"
else
echo "... asset ignored"
fi
done
#=================================================
# SPECIFIC UPDATE STEPS
#=================================================
# Any action on the app's source code can be done.
# The GitHub Action workflow takes care of committing all changes after this script ends.
#=================================================
# GENERIC FINALIZATION
#=================================================
# Replace new version in manifest
echo "$(jq -s --indent 4 ".[] | .version = \"$version~ynh1\"" manifest.json)" > manifest.json
# No need to update the README, yunohost-bot takes care of it
# The Action will proceed only if the PROCEED environment variable is set to true
echo "PROCEED=true" >> $GITHUB_ENV
exit 0

View file

@ -17,8 +17,14 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in
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.
### Features
- Multi-Factor Authentication
- Dark & Light Modes
- LDAP Authentication
- Optional Markdown Editor
- Multi-Lingual
**Shipped version:** 21.12.3~ynh2
**Shipped version:** 22.02.1~ynh1
**Demo:** https://demo.bookstackapp.com
@ -30,14 +36,16 @@ BookStack is an opinionated wiki system that provides a pleasant and simple out
## Configuration
For the first time Login, use the default credentials `admin@admin.com` and `password`. You should change these details immediately after logging in for the first time.
BookStack uses LDAP authentication by default.
* How to configure this app: From an admin panel, a plain file with SSH, or any other way.
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
* Official admin documentation: https://www.bookstackapp.com/docs
* Official user documentation: https://www.bookstackapp.com/docs/user/
* Official admin documentation: https://www.bookstackapp.com/docs/admin/
* Upstream app code repository: https://github.com/BookStackApp/BookStack
* YunoHost documentation for this app: https://yunohost.org/app_bookstack
* Report a bug: https://github.com/YunoHost-Apps/bookstack_ynh/issues

View file

@ -13,8 +13,15 @@ Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour
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.
### Features
- Multi-Factor Authentication
- Dark & Light Modes
- LDAP Authentication
- Optional Markdown Editor
- Multi-Lingual
**Version incluse :** 21.12.3~ynh2
**Version incluse :** 22.02.1~ynh1
**Démo :** https://demo.bookstackapp.com
@ -24,14 +31,13 @@ BookStack is an opinionated wiki system that provides a pleasant and simple out
## Avertissements / informations importantes
## Configuration
Login using the default admin details `admin@admin.com` with a password of `password`. You should change these details immediately after logging in for the first time.
## Documentations et ressources
* Site officiel de l'app : https://www.bookstackapp.com
* Documentation officielle de l'admin : https://www.bookstackapp.com/docs
* Documentation officielle utilisateur : https://www.bookstackapp.com/docs/user/
* Documentation officielle de l'admin : https://www.bookstackapp.com/docs/admin/
* Dépôt de code officiel de l'app : https://github.com/BookStackApp/BookStack
* Documentation YunoHost pour cette app : https://yunohost.org/app_bookstack
* Signaler un bug : https://github.com/YunoHost-Apps/bookstack_ynh/issues

View file

@ -2,6 +2,8 @@
; Manifest
domain="domain.tld"
path="/path"
admin="john"
password="1Strong-Password"
language="fr"
is_public=1
; Checks
@ -12,8 +14,8 @@
setup_private=1
setup_public=1
upgrade=1
#Testing
upgrade=1 from_commit=aaa9c9534b01a210989aceb4ad4d2b9c585be6df
upgrade=1 from_commit=12ee6097f4f48e6fb765afbe25dd10345e9c8adb
backup_restore=1
multi_instance=0
change_url=1
@ -23,4 +25,6 @@ Notification=none
;;; Upgrade options
; commit=aaa9c9534b01a210989aceb4ad4d2b9c585be6df
name=Testing (#35)
; commit=12ee6097f4f48e6fb765afbe25dd10345e9c8adb
name=Testing (#38)
manifest_arg=domain=DOMAIN&path=PATH&admin=USER&language=fr&is_public=1&password=pass&port=666&

View file

@ -45,11 +45,11 @@ MAIL_FROM=bookstack@__DOMAIN__
MAIL_HOST=localhost
MAIL_PORT=25
MAIL_USERNAME=bookstack
MAIL_PASSWORD="__MAIL_PWD__"
MAIL_PASSWORD=__MAIL_PWD__
MAIL_ENCRYPTION=null
# General auth
AUTH_METHOD=standard
AUTH_METHOD=__AUTH_METHOD__
# LDAP authentication configuration
# Refer to https://www.bookstackapp.com/docs/admin/ldap-auth/
@ -57,7 +57,7 @@ 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_USER_FILTER=(&(uid=${user}))
LDAP_VERSION=3
LDAP_TLS_INSECURE=false
LDAP_ID_ATTRIBUTE=uid
@ -76,3 +76,11 @@ REDIS_SERVERS=127.0.0.1:6379:__REDIS_DB__
# Storage system to use
# Can be 'local', 'local_secure' or 's3'
STORAGE_TYPE=local
# Default item listing view
# Used for public visitors and user's without a preference
# Can be 'list' or 'grid'
APP_VIEWS_BOOKS=list
APP_VIEWS_BOOKSHELVES=grid

View file

@ -1,5 +1,5 @@
SOURCE_URL=https://github.com/BookStackApp/BookStack/archive/refs/tags/v21.12.3.tar.gz
SOURCE_SUM=c6182009052069b62e1c70307bc030cc22439ef1da29baf6a315690093693557
SOURCE_URL=https://github.com/BookStackApp/BookStack/archive/refs/tags/v22.02.1.tar.gz
SOURCE_SUM=af2e816a3b78058f97de167c36560f2d3fa7cb4c680221a0f9d0a0b7a39fcd52
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=tar.gz
SOURCE_IN_SUBDIR=true

35
config_panel.toml Normal file
View file

@ -0,0 +1,35 @@
version = "1.0"
[main]
name = "BookStack configuration"
[main.auth_config]
name = "Authentication configuration"
[main.auth_config.auth_method]
ask = "General authentication"
choices = ["standard", "ldap"]
default = "ldap"
help = "Select an authentication method to connect to BookStack."
bind = "AUTH_METHOD:__FINALPATH__/.env"
[main.php_fpm_config]
name = "PHP-FPM configuration"
[main.php_fpm_config.fpm_footprint]
ask = "Memory footprint of the service?"
choices = ["low", "medium", "high", "specific"]
default = "low"
help = "low <= 20Mb per pool. medium between 20Mb and 40Mb per pool. high > 40Mb per pool.<br>Use specific to set a value with the following option."
[main.php_fpm_config.free_footprint]
ask = "Memory footprint of the service?"
type = "number"
default = "0"
help = "Free field to specify exactly the footprint in Mb if you don't want to use one of the three previous values."
[main.php_fpm_config.fpm_usage]
ask = "Expected usage of the service?"
choices = ["low", "medium", "high"]
default = "low"
help = "low: Personal usage, behind the SSO. No RAM footprint when not used, but the impact on the processor can be high if many users are using the service.<br>medium: Low usage, few people or/and publicly accessible. Low RAM footprint, medium processor footprint when used.<br>high: High usage, frequently visited website. High RAM footprint, but lower on processor usage and quickly responding."

View file

@ -1 +1,8 @@
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.
### Features
- Multi-Factor Authentication
- Dark & Light Modes
- LDAP Authentication
- Optional Markdown Editor
- Multi-Lingual

View file

@ -1,5 +1,6 @@
## Configuration
For the first time Login, use the default credentials `admin@admin.com` and `password`. You should change these details immediately after logging in for the first time.
BookStack uses LDAP authentication by default.
* How to configure this app: From an admin panel, a plain file with SSH, or any other way.
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.

View file

@ -1,3 +1 @@
## Configuration
Login using the default admin details `admin@admin.com` with a password of `password`. You should change these details immediately after logging in for the first time.

View file

@ -6,13 +6,14 @@
"en": "Platform to create documentation/wiki content",
"fr": "Plateforme pour créer du contenu de documentation/wiki"
},
"version": "21.12.3~ynh2",
"version": "22.02.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",
"admindoc": "https://www.bookstackapp.com/docs/admin/",
"userdoc": "https://www.bookstackapp.com/docs/user/",
"code": "https://github.com/BookStackApp/BookStack"
},
"license": "MIT",
@ -40,6 +41,10 @@
"example": "/bookstack",
"default": "/bookstack"
},
{
"name": "admin",
"type": "user"
},
{
"name": "language",
"type": "string",
@ -47,7 +52,7 @@
"en": "Choose the application language",
"fr": "Choisissez la langue de l'application"
},
"choices": ["de", "en", "es", "fr", "it", "nl", "pt"],
"choices": ["de", "en", "es_ES", "fa", "fr", "it", "lt", "nl", "pl", "pt_PT", "uk", "zh_CN"],
"default": "en"
},
{

95
scripts/config Normal file
View file

@ -0,0 +1,95 @@
#!/bin/bash
#=================================================
# GENERIC STARTING
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh
source /usr/share/yunohost/helpers
ynh_abort_if_errors
#=================================================
# RETRIEVE ARGUMENTS
#=================================================
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
current_fpm_footprint=$(ynh_app_setting_get --app=$app --key=fpm_footprint)
#=================================================
# SPECIFIC GETTERS FOR TOML SHORT KEY
#=================================================
get__fpm_footprint() {
# Free footprint value for php-fpm
# Check if current_fpm_footprint is an integer
if [ "$current_fpm_footprint" -eq "$current_fpm_footprint" ] 2> /dev/null
then
echo "specific"
else
echo "$current_fpm_footprint"
fi
}
get__free_footprint() {
# Free footprint value for php-fpm
# Check if current_fpm_footprint is an integer
if [ "$current_fpm_footprint" -eq "$current_fpm_footprint" ] 2> /dev/null
then
# If current_fpm_footprint is an integer, that's a numeric value for the footprint
echo "$current_fpm_footprint"
else
echo "0"
fi
}
#=================================================
# SPECIFIC SETTERS FOR TOML SHORT KEYS
#=================================================
set__fpm_footprint() {
if [ "$fpm_footprint" != "specific" ]
then
ynh_app_setting_set --app=$app --key=fpm_footprint --value="$fpm_footprint"
fi
}
set__free_footprint() {
if [ "$fpm_footprint" == "specific" ]
then
ynh_app_setting_set --app=$app --key=fpm_footprint --value="$free_footprint"
fi
}
#=================================================
# GENERIC FINALIZATION
#=================================================
ynh_app_config_validate() {
_ynh_app_config_validate
if [ "${changed[fpm_usage]}" == "true" ] || [ "${changed[fpm_footprint]}" == "true" ] || [ "${changed[free_footprint]}" == "true" ]; then
# If fpm_footprint is set to 'specific', use $free_footprint value.
if [ "$fpm_footprint" == "specific" ]
then
fpm_footprint=$free_footprint
fi
if [ "$fpm_footprint" == "0" ]
then
ynh_print_err --message="When selecting 'specific', you have to set a footprint value into the field below."
exit 0
fi
fi
}
ynh_app_config_apply() {
_ynh_app_config_apply
ynh_add_fpm_config --phpversion=$phpversion --usage=$fpm_usage --footprint=$fpm_footprint
}
ynh_app_config_run $1

View file

@ -28,9 +28,13 @@ 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"
#=================================================
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
#=================================================
@ -50,7 +54,9 @@ 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
#=================================================
# INSTALL DEPENDENCIES
@ -86,11 +92,6 @@ 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"
# Set permissions to app files
chmod 755 $final_path
chmod -R o-rwx $final_path
chown -R $app:www-data $final_path
#=================================================
# NGINX CONFIGURATION
#=================================================
@ -105,7 +106,7 @@ ynh_add_nginx_config
ynh_script_progression --message="Configuring PHP-FPM..." --weight=2
# Create a dedicated PHP-FPM config
ynh_add_fpm_config
ynh_add_fpm_config --usage=low --footprint=low
#=================================================
# INSTALL LYCHEE WITH COMPOSER
@ -133,8 +134,15 @@ ynh_script_progression --message="Install BookStack" --weight=5
pushd $final_path
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
chown $app:$app $final_path/.env
#=================================================
# SETUP SSOWAT
#=================================================

View file

@ -29,6 +29,9 @@ 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
#=================================================
@ -80,6 +83,9 @@ 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 MYSQL DATABASE
#=================================================

View file

@ -24,10 +24,15 @@ 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)
timezone="$(cat /etc/timezone)"
fpm_footprint=$(ynh_app_setting_get --app=$app --key=fpm_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
#=================================================
@ -53,6 +58,24 @@ ynh_abort_if_errors
#=================================================
ynh_script_progression --message="Ensuring downward compatibility..." --weight=1
# If fpm_footprint doesn't exist, create it
if [ -z "$fpm_footprint" ]; then
fpm_footprint=low
ynh_app_setting_set --app=$app --key=fpm_footprint --value=$fpm_footprint
fi
# If fpm_usage doesn't exist, create it
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
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
@ -101,7 +124,7 @@ ynh_install_app_dependencies $pkg_dependencies
ynh_script_progression --message="Upgrading PHP-FPM configuration..." --weight=1
# Create a dedicated PHP-FPM config
ynh_add_fpm_config
ynh_add_fpm_config --usage=$fpm_usage --footprint=$fpm_footprint
#=================================================
# MODIFY A CONFIG FILE
@ -119,7 +142,17 @@ chmod 600 $final_path/.env
ynh_script_progression --message="Installing BookStack with Composer..." --weight=5
# Install composer
ynh_install_composer --install_args="--no-dev"
ynh_install_composer --phpversion=$phpversion --workdir=$final_path --install_args="--no-dev"
#=================================================
# MODIFY A CONFIG FILE
#=================================================
ynh_script_progression --message="Adding a configuration file..." --weight=1
app_url_domain="https://$domain${path_url%/}"
ynh_add_config --template=../conf/.env.example --destination=$final_path/.env
chmod 600 $final_path/.env
#=================================================
# FINAL BOOKSTACK INSTALL
@ -137,7 +170,7 @@ 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
#=================================================
# RELOAD NGINX