diff --git a/README.md b/README.md index 8ce1261..badeb3a 100644 --- a/README.md +++ b/README.md @@ -1,29 +1,72 @@ -# BookStack app for YunoHost -BookStack Server +# BookStack for YunoHost -**Shipped version:** 0.26.3 +[![Integration level](https://dash.yunohost.org/integration/bookstack.svg)](https://dash.yunohost.org/appci/app/bookstack) ![](https://ci-apps.yunohost.org/ci/badges/bookstack.status.svg) ![](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) -- [Yunohost project](https://yunohost.org) -- [BookStack website](https://github.com/BookStackApp/BookStack/) +*[Lire ce readme en français.](./README_fr.md)* -![](https://avatars1.githubusercontent.com/u/20912696?s=400&v=4) +> *This package allows you to install BookStack quickly and simply on a YunoHost server. +If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/install) to learn how to install it.* +## Overview +Quick description of this app. -[![Install BookStack with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=bookstack) +**Shipped version:** 0.31.4 -### Installing guide +## Screenshots - App can be installed by YunoHost **admin web-interface** or by **running following command**: +![](https://www.bookstackapp.com/images/screenshots/page-view.png) - $ sudo yunohost app install https://github.com/YunoHost-Apps/bookstack_ynh - - After install : - - 1. Login in bookstack - 2. your user : admin@admin.com and password : password +## Demo - -### Upgrade this package: +* [Official demo](https://www.bookstackapp.com/#demo) - $ sudo yunohost app upgrade bookstack -u https://github.com/YunoHost-Apps/bookstack_ynh +## Configuration +How to configure this app: From an admin panel, a plain file with SSH, or any other way. + +## Documentation + + * Official documentation: https://www.bookstackapp.com/docs/ + * YunoHost documentation: If specific documentation is needed, feel free to contribute. + +## YunoHost specific features + +#### Multi-user support + +Are LDAP and HTTP auth supported? +Can the app be used by multiple users? + +#### Supported architectures + +* x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/bookstack%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/bookstack/) +* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/bookstack%20%28Apps%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/bookstack/) + +## Limitations + +* Any known limitations. + +## Additional information + +* Other info you would like to add about this app. + +## Links + + * Report a bug: https://github.com/YunoHost-Apps/bookstack_ynh/issues + * App website: Link to the official website of this app. + * Upstream app repository: https://github.com/BookStackApp/BookStack + * YunoHost website: https://yunohost.org/ + +--- + +## Developer info + +**Only if you want to use a testing branch for coding, instead of merging directly into master.** +Please send your pull request to the [testing branch](https://github.com/YunoHost-Apps/bookstack_ynh/tree/testing). + +To try the testing branch, please proceed like that. +``` +sudo yunohost app install https://github.com/YunoHost-Apps/bookstack_ynh/tree/testing --debug +or +sudo yunohost app upgrade bookstack -u https://github.com/YunoHost-Apps/bookstack_ynh/tree/testing --debug +``` diff --git a/check_process b/check_process index 0cbeae3..089936a 100644 --- a/check_process +++ b/check_process @@ -8,8 +8,6 @@ domain="domain.tld" (DOMAIN) path="/" (PATH) is_public=1 (PUBLIC|public=1|private=0) -# password="pass" -# nextclouddomain="domain.tld" port="9980" (PORT) ; Checks pkg_linter=1 @@ -21,22 +19,8 @@ upgrade=1 backup_restore=1 multi_instance=1 - incorrect_path=1 port_already_use=0 change_url=0 -;;; Levels - Level 1=auto - Level 2=auto - Level 3=auto -# Level 4: - Level 4=1 (This app supports the Nextcloud LDAP auth) -# Level 5: - Level 5=auto - Level 6=auto - Level 7=auto - Level 8=0 - Level 9=0 - Level 10=0 ;;; Options Email= Notification=none diff --git a/conf/.env.example b/conf/.env.example index 249e668..fb6dfc2 100644 --- a/conf/.env.example +++ b/conf/.env.example @@ -1,31 +1,44 @@ +# This file, when named as ".env" in the root of your BookStack install +# folder, is used for the core configuration of the application. +# By default this file contains the most common required options but +# a full list of options can be found in the '.env.example.complete' file. + +# 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") + # Application key # Used for encryption where needed. # Run `php artisan key:generate` to generate a valid key. APP_KEY=SomeRandomString # Application URL -# Remove the hash below and set a URL if using BookStack behind -# a proxy, if using a third-party authentication option. # This must be the root URL that you want to host BookStack on. -# All URL's in BookStack will be generated using this value. -#APP_URL=https://example.com +# All URLs in BookStack will be generated using this value +# to ensure URLs generated are consistent and secure. +# If you change this in the future you may need to run a command +# to update stored URLs in the database. Command example: +# php artisan bookstack:update-url https://old.example.com https://new.example.com +APP_URL=https:__DOMAIN__ # Database details DB_HOST=localhost -DB_DATABASE=yunobase -DB_USERNAME=yunouser -DB_PASSWORD=yunopass +DB_DATABASE=__DB_NAME__ +DB_USERNAME=__DB_NAME__ +DB_PASSWORD=__DB_PWD__ # Mail system to use -# Can be 'smtp', 'mail' or 'sendmail' +# Can be 'smtp' or 'sendmail' MAIL_DRIVER=smtp +# Mail sender details +MAIL_FROM_NAME="BookStack" +MAIL_FROM=bookstack@example.com + # SMTP mail options +# These settings can be checked using the "Send a Test Email" +# feature found in the "Settings > Maintenance" area of the system. MAIL_HOST=localhost MAIL_PORT=1025 MAIL_USERNAME=null MAIL_PASSWORD=null MAIL_ENCRYPTION=null - - -# A full list of options can be found in the '.env.example.complete' file. \ No newline at end of file diff --git a/conf/nginx.conf b/conf/nginx.conf index 91f4854..e94ff8c 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -1,19 +1,30 @@ -# Force usage of https +#sub_path_only rewrite ^__PATH__$ __PATH__/ permanent; +location __PATH__/ { + + # Path to source + alias __FINALPATH__/public ; + + # Force usage of https if ($scheme = http) { rewrite ^ https://$server_name$request_uri? permanent; -} - -root /var/www/bookstack/public; -index index.php index.html; - -location __PATH__/ { - try_files $uri $uri/ /index.php?$query_string; } - location ~ \.php$ { + try_files $uri $uri/ /index.php?$query_string; + + index index.php; + + try_files $uri $uri/ index.php; + location ~ [^/]\.php(/|$) { + fastcgi_split_path_info ^(.+?\.php)(/.*)$; + fastcgi_pass unix:/var/run/php/php__PHPVERSION__-fpm-__NAME__.sock; + fastcgi_index index.php; - try_files $uri =404; include fastcgi_params; - fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; - fastcgi_pass unix:/run/php/php7.0-fpm.sock; + fastcgi_param REMOTE_USER $remote_user; + fastcgi_param PATH_INFO $fastcgi_path_info; + fastcgi_param SCRIPT_FILENAME $request_filename; + } + + # Include SSOWAT user panel. + include conf.d/yunohost_panel.conf.inc; } diff --git a/manifest.json b/manifest.json index bd51e32..9138058 100644 --- a/manifest.json +++ b/manifest.json @@ -3,23 +3,23 @@ "id": "bookstack", "packaging_format": 1, "description": { - "en": "BookStack package for YunoHost.", - "fr": "BookStack pour YunoHost." + "en": "A platform to create documentation/wiki content", + "fr": "" }, - "version": "0.26.3", + "version": "0.31.4~ynh1", "url": "https://github.com/BookStackApp/BookStack", - "license": "free", + "license": "MIT", "maintainer": { "name": "liberodark", "email": "liberodark@gmail.com" }, "requirements": { - "yunohost": ">= 2.7.2" + "yunohost": ">= 4.0.0" }, "multi_instance": true, "services": [ "nginx", - "php5-fpm", + "php7.3-fpm", "mysql" ], "arguments": { @@ -32,7 +32,6 @@ }, "example": "example.com" }, - { "name": "path", "type": "path", @@ -43,15 +42,14 @@ "example": "/", "default": "/" }, - { "name": "is_public", "type": "boolean", "ask": { - "en": "Is it a public site ?", + "en": "Is it a public site?", "fr": "Est-ce un site public ?" }, - "default": "true" + "default": true } ] } diff --git a/scripts/_common.sh b/scripts/_common.sh index 0f53f77..b7490de 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -1,112 +1,85 @@ #!/bin/bash -# ============================================================================= -# YUNOHOST 2.7 FORTHCOMING HELPERS -# ============================================================================= +#================================================= +# COMMON VARIABLES +#================================================= -# Create a dedicated nginx config +YNH_PHP_VERSION="7.3" + +extra_php_dependencies="php${YNH_PHP_VERSION}-cli 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 php${YNH_PHP_VERSION}-mysql +" +# dependencies used by the app +#pkg_dependencies="deb1 deb2 php$YNH_DEFAULT_PHP_VERSION-deb1 php$YNH_DEFAULT_PHP_VERSION-deb2" + +#================================================= +# PERSONAL HELPERS +#================================================= + +#================================================= +# EXPERIMENTAL HELPERS +#================================================= + +#================================================= +# FUTURE OFFICIAL HELPERS +#================================================= + + +readonly YNH_DEFAULT_COMPOSER_VERSION=2.0.8 +# Declare the actual composer version to use. +# A packager willing to use another version of composer can override the variable into its _common.sh. +YNH_COMPOSER_VERSION=${YNH_COMPOSER_VERSION:-$YNH_DEFAULT_COMPOSER_VERSION} + +# Execute a command with Composer # -# usage: ynh_add_nginx_config -ynh_add_nginx_config () { - finalnginxconf="/etc/nginx/conf.d/$domain.d/$app.conf" - ynh_backup_if_checksum_is_different "$finalnginxconf" - sudo cp ../conf/nginx.conf "$finalnginxconf" +# usage: ynh_composer_exec [--phpversion=phpversion] [--workdir=$final_path] --commands="commands" +# | arg: -v, --phpversion - PHP version to use with composer +# | arg: -w, --workdir - The directory from where the command will be executed. Default $final_path. +# | arg: -c, --commands - Commands to execute. +ynh_composer_exec () { + # Declare an array to define the options of this helper. + local legacy_args=vwc + declare -Ar args_array=( [v]=phpversion= [w]=workdir= [c]=commands= ) + local phpversion + local workdir + local commands + # Manage arguments with getopts + ynh_handle_getopts_args "$@" + workdir="${workdir:-$final_path}" + phpversion="${phpversion:-$YNH_PHP_VERSION}" - # To avoid a break by set -u, use a void substitution ${var:-}. If the variable is not set, it's simply set with an empty variable. - # Substitute in a nginx config file only if the variable is not empty - if test -n "${path_url:-}"; then - ynh_replace_string "__PATH__" "$path_url" "$finalnginxconf" - fi - if test -n "${domain:-}"; then - ynh_replace_string "__DOMAIN__" "$domain" "$finalnginxconf" - fi - if test -n "${port:-}"; then - ynh_replace_string "__PORT__" "$port" "$finalnginxconf" - fi - if test -n "${app:-}"; then - ynh_replace_string "__NAME__" "$app" "$finalnginxconf" - fi - if test -n "${final_path:-}"; then - ynh_replace_string "__FINALPATH__" "$final_path" "$finalnginxconf" - fi - ynh_store_file_checksum "$finalnginxconf" - - sudo systemctl reload nginx + COMPOSER_HOME="$workdir/.composer" \ + php${phpversion} "$workdir/composer.phar" $commands \ + -d "$workdir" --quiet --no-interaction } -# Remove the dedicated nginx config +# Install and initialize Composer in the given directory # -# usage: ynh_remove_nginx_config -ynh_remove_nginx_config () { - ynh_secure_remove "/etc/nginx/conf.d/$domain.d/$app.conf" - sudo systemctl reload nginx -} - -# Create a dedicated php-fpm config -# -# usage: ynh_add_fpm_config -ynh_add_fpm_config () { - finalphpconf="/etc/php5/fpm/pool.d/$app.conf" - ynh_backup_if_checksum_is_different "$finalphpconf" - sudo cp ../conf/php-fpm.conf "$finalphpconf" - ynh_replace_string "__NAMETOCHANGE__" "$app" "$finalphpconf" - ynh_replace_string "__FINALPATH__" "$final_path" "$finalphpconf" - ynh_replace_string "__USER__" "$app" "$finalphpconf" - sudo chown root: "$finalphpconf" - ynh_store_file_checksum "$finalphpconf" - - if [ -e "../conf/php-fpm.ini" ] - then - finalphpini="/etc/php5/fpm/conf.d/20-$app.ini" - ynh_backup_if_checksum_is_different "$finalphpini" - sudo cp ../conf/php-fpm.ini "$finalphpini" - sudo chown root: "$finalphpini" - ynh_store_file_checksum "$finalphpini" - fi - - sudo systemctl reload php5-fpm -} - -# Remove the dedicated php-fpm config -# -# usage: ynh_remove_fpm_config -ynh_remove_fpm_config () { - ynh_secure_remove "/etc/php5/fpm/pool.d/$app.conf" - ynh_secure_remove "/etc/php5/fpm/conf.d/20-$app.ini" 2>&1 - sudo systemctl reload php5-fpm -} - -# Create a dedicated systemd config -# -# usage: ynh_add_systemd_config -ynh_add_systemd_config () { - finalsystemdconf="/etc/systemd/system/$app.service" - ynh_backup_if_checksum_is_different "$finalsystemdconf" - sudo cp ../conf/systemd.service "$finalsystemdconf" - - # To avoid a break by set -u, use a void substitution ${var:-}. If the variable is not set, it's simply set with an empty variable. - # Substitute in a nginx config file only if the variable is not empty - if test -n "${final_path:-}"; then - ynh_replace_string "__FINALPATH__" "$final_path" "$finalsystemdconf" - fi - if test -n "${app:-}"; then - ynh_replace_string "__APP__" "$app" "$finalsystemdconf" - fi - ynh_store_file_checksum "$finalsystemdconf" - - sudo chown root: "$finalsystemdconf" - sudo systemctl enable $app - sudo systemctl daemon-reload -} - -# Remove the dedicated systemd config -# -# usage: ynh_remove_systemd_config -ynh_remove_systemd_config () { - finalsystemdconf="/etc/systemd/system/$app.service" - if [ -e "$finalsystemdconf" ]; then - sudo systemctl stop $app - sudo systemctl disable $app - ynh_secure_remove "$finalsystemdconf" - fi +# usage: ynh_install_composer [--phpversion=phpversion] [--workdir=$final_path] [--install_args="--optimize-autoloader"] [--composerversion=composerversion] +# | arg: -v, --phpversion - PHP version to use with composer +# | arg: -w, --workdir - The directory from where the command will be executed. Default $final_path. +# | arg: -a, --install_args - Additional arguments provided to the composer install. Argument --no-dev already include +# | arg: -c, --composerversion - Composer version to install +ynh_install_composer () { + # Declare an array to define the options of this helper. + local legacy_args=vwa + declare -Ar args_array=( [v]=phpversion= [w]=workdir= [a]=install_args= [c]=composerversion=) + local phpversion + local workdir + local install_args + local composerversion + # Manage arguments with getopts + ynh_handle_getopts_args "$@" + workdir="${workdir:-$final_path}" + phpversion="${phpversion:-$YNH_PHP_VERSION}" + install_args="${install_args:-}" + composerversion="${composerversion:-$YNH_COMPOSER_VERSION}" + + curl -sS https://getcomposer.org/installer 2>&1 \ + | COMPOSER_HOME="$workdir/.composer" \ + php${phpversion} -- --quiet --install-dir="$workdir" --version=$composerversion \ + || ynh_die "Unable to install Composer." 2>&1 + + # update dependencies to create composer.lock + ynh_composer_exec --phpversion="${phpversion}" --workdir="$workdir" --commands="install --no-dev $install_args" \ + || ynh_die "Unable to update core dependencies with Composer." } diff --git a/scripts/install b/scripts/install index a946d89..87135bd 100644 --- a/scripts/install +++ b/scripts/install @@ -14,7 +14,6 @@ source /usr/share/yunohost/helpers #================================================= ynh_clean_setup () { - ### Remove this function if there's nothing to clean before calling the remove script. true } # Exit if an error occurs during the execution of the script @@ -29,145 +28,99 @@ domain=$YNH_APP_ARG_DOMAIN path_url=$YNH_APP_ARG_PATH is_public=$YNH_APP_ARG_IS_PUBLIC -### If it's a multi-instance app, meaning it can be installed several times independently -### The id of the app as stated in the manifest is available as $YNH_APP_ID -### The instance number is available as $YNH_APP_INSTANCE_NUMBER (equals "1", "2", ...) -### The app instance name is available as $YNH_APP_INSTANCE_NAME -### - the first time the app is installed, YNH_APP_INSTANCE_NAME = ynhexample -### - the second time the app is installed, YNH_APP_INSTANCE_NAME = ynhexample__2 -### - ynhexample__{N} for the subsequent installations, with N=3,4, ... -### The app instance name is probably what interests you most, since this is -### guaranteed to be unique. This is a good unique identifier to define installation path, -### db names, ... app=$YNH_APP_INSTANCE_NAME #================================================= # CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS #================================================= +ynh_script_progression --message="Validating installation parameters..." --weight=1 -### If the app uses nginx as web server (written in HTML/PHP in most cases), the final path should be "/var/www/$app". -### If the app provides an internal web server (or uses another application server such as uwsgi), the final path should be "/opt/yunohost/$app" final_path=/var/www/$app test ! -e "$final_path" || ynh_die "This path already contains a folder" -# Normalize the url path syntax -path_url=$(ynh_normalize_url_path $path_url) - -# Check web path availability -ynh_webpath_available $domain $path_url # Register (book) web path -ynh_webpath_register $app $domain $path_url +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 domain $domain -ynh_app_setting_set $app path $path_url -ynh_app_setting_set $app is_public $is_public - -#============================================== -# INSTALL DEPS -#============================================== - -ynh_print_info "Installing dependencies..." - -ynh_install_app_dependencies php7.0-fpm php7.0-cli php7.0-curl php7.0-mysql php7.0-ldap php7.0-mbstring php7.0-tidy php7.0-xml php7.0-zip php7.0-gd php7.0-mysql - -## Start php7 -systemctl enable php7.0-fpm -systemctl start php7.0-fpm +ynh_app_setting_set --app=$app --key=domain --value=$domain +ynh_app_setting_set --app=$app --key=path --value=$path_url #================================================= # CREATE A MYSQL DATABASE #================================================= -ynh_print_info "Creating a MySQL database..." +ynh_script_progression --message="Creating a MySQL database..." --time --weight=1 -### Use these lines if you need a database for the application. -### `ynh_mysql_setup_db` will create a database, an associated user and a ramdom password. -### The password will be stored as 'mysqlpwd' into the app settings, -### and will be available as $db_pwd -### If you're not using these lines: -### - Remove the section "BACKUP THE MYSQL DATABASE" in the backup script -### - Remove also the section "REMOVE THE MYSQL DATABASE" in the remove script -### - As well as the section "RESTORE THE MYSQL DATABASE" in the restore script - -db_name=$(ynh_sanitize_dbid $app) -ynh_app_setting_set $app db_name $db_name -ynh_mysql_setup_db $db_name $db_name +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 #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= +ynh_script_progression --message="Setting up source files..." --weight=7 -ynh_print_info "Download BookStack" - -ynh_app_setting_set $app final_path $final_path +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 "$final_path" - -#================================================= -# INSTALL BOOKSTACK DEPS -#================================================= - -ynh_print_info "Install BookStack composer dependancies" - -pushd $final_path || exit -php -r "readfile('https://getcomposer.org/installer');" | php -php composer.phar install -popd || exit - -#================================================= -# SPECIFIC SETUP -#================================================= - -# setup application config -cp -a ../conf/.env.example $final_path/.env - -#================================================= -# MODIFY A CONFIG FILE -#================================================= - -ynh_replace_string "yunouser" "$db_name" "$final_path/.env" -ynh_replace_string "yunopass" "$db_pwd" "$final_path/.env" -ynh_replace_string "yunobase" "$db_name" "$final_path/.env" - -#================================================= -# FINAL BOOKSTACK INSTALL -#================================================= - -ynh_print_info "Install BookStack" - -pushd $final_path || exit -php artisan key:generate --no-interaction --force -php artisan migrate --no-interaction --force -chown www-data:www-data -R bootstrap/cache public/uploads storage && chmod -R 755 bootstrap/cache public/uploads storage -popd || exit +ynh_setup_source --dest_dir="$final_path" #================================================= # NGINX CONFIGURATION #================================================= +ynh_script_progression --message="Configuring NGINX web server..." --weight=2 -# Create a dedicated nginx config +# Create a dedicated NGINX config ynh_add_nginx_config #================================================= # CREATE DEDICATED USER #================================================= +ynh_script_progression --message="Configuring system user..." --weight=2 # Create a system user -ynh_system_user_create $app +ynh_system_user_create --username=$app #================================================= -# STORE THE CONFIG FILE CHECKSUM +# PHP-FPM CONFIGURATION #================================================= +ynh_script_progression --message="Configuring PHP-FPM..." --weight=2 -### `ynh_store_file_checksum` is used to store the checksum of a file. -### That way, during the upgrade script, by using `ynh_backup_if_checksum_is_different`, -### you can make a backup of this file before modifying it again if the admin had modified it. +# Create a dedicated PHP-FPM config +ynh_add_fpm_config --package="$extra_php_dependencies" +phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) -# Calculate and store the config file checksum into the app settings -#ynh_store_file_checksum "$final_path/config.json" +#================================================= +# INSTALL LYCHEE WITH COMPOSER +#================================================= +ynh_script_progression --message="Installing BookStack with Composer..." --weight=15 + +# Install composer +ynh_install_composer --phpversion=$phpversion --workdir=$final_path --install_args="--prefer-source --no-dev" + +#================================================= +# MODIFY A CONFIG FILE +#================================================= +cp -a ../conf/.env.example $final_path/.env + +ynh_replace_string --match_string="__DB_NAME__" --replace_string="$db_name" --target_file="$final_path/.env" +ynh_replace_string --match_string="__DB_PWD__" --replace_string="$db_pwd" --target_file="$final_path/.env" +ynh_replace_string --match_string="__DOMAIN__" --replace_string="$domain" --target_file="$final_path/.env" + +ynh_store_file_checksum "$final_path/.env" + +#================================================= +# FINAL BOOKSTACK INSTALL +#================================================= +ynh_script_progression --message="Install BookStack" --time --weight=1 + +pushd $final_path + php$phpversion artisan key:generate --no-interaction --force + php$phpversion artisan migrate --no-interaction --force +popd #================================================= # GENERIC FINALIZATION @@ -175,23 +128,30 @@ ynh_system_user_create $app # SECURE FILES AND DIRECTORIES #================================================= -### For security reason, any app should set the permissions to root: before anything else. -### Then, if write authorization is needed, any access should be given only to directories -### that really need such authorization. - # Set permissions to app files - chown -R www-data:www-data $final_path +chmod -R 755 $final_path/bootstrap/cache $final_path/public/uploads $final_path/storage #================================================= # SETUP SSOWAT #================================================= +ynh_script_progression --message="Configuring permissions..." --time --weight=1 -# If app is public, add url to SSOWat conf as skipped_uris -if [ $is_public -eq 1 ]; then - # unprotected_uris allows SSO credentials to be passed anyway. - ynh_app_setting_set "$app" unprotected_uris "/" +# Make app public if necessary +if [ $is_public -eq 1 ] +then + ynh_permission_update --permission="main" --add="visitors" fi -# Reload services -systemctl reload nginx +#================================================= +# RELOAD NGINX +#================================================= +ynh_script_progression --message="Reloading NGINX web server..." --time --weight=1 + +ynh_systemd_action --service_name=nginx --action=reload + +#================================================= +# END OF SCRIPT +#================================================= + +ynh_script_progression --message="Installation of $app completed" --time --last