mirror of
https://github.com/YunoHost-Apps/bookstack_ynh.git
synced 2024-09-03 18:16:02 +02:00
[autopatch] Automatic patch attempt for helpers 2.1 (#173)
* Update manifest.toml (#171) * Update manifest.toml * Auto-update READMEs * cleaning --------- Co-authored-by: yunohost-bot <yunohost@yunohost.org> * [autopatch] Automatic patch attempt for helpers 2.1 --------- Co-authored-by: eric_G <46165813+ericgaspar@users.noreply.github.com> Co-authored-by: Yunohost-Bot <>
This commit is contained in:
parent
f16f034cf9
commit
54a2d148f4
13 changed files with 96 additions and 322 deletions
|
@ -1,5 +0,0 @@
|
||||||
; Additional php.ini defines, specific to this pool of workers.
|
|
||||||
|
|
||||||
php_admin_value[upload_max_filesize] = 256M
|
|
||||||
php_admin_value[memory_limit] = 256M
|
|
||||||
php_admin_value[post_max_size] = 256M
|
|
|
@ -8,12 +8,12 @@ location __PATH__/ {
|
||||||
client_body_timeout 120s; # Default is 60, May need to be increased for very large uploads
|
client_body_timeout 120s; # Default is 60, May need to be increased for very large uploads
|
||||||
|
|
||||||
index index.php;
|
index index.php;
|
||||||
try_files $uri $uri/ @__NAME__;
|
try_files $uri $uri/ @__APP__;
|
||||||
|
|
||||||
#try_files $uri $uri/ index.php;
|
#try_files $uri $uri/ index.php;
|
||||||
location ~ [^/]\.php(/|$) {
|
location ~ [^/]\.php(/|$) {
|
||||||
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
|
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
|
||||||
fastcgi_pass unix:/var/run/php/php__PHPVERSION__-fpm-__NAME__.sock;
|
fastcgi_pass unix:/var/run/php/php__PHP_VERSION__-fpm-__APP__.sock;
|
||||||
fastcgi_index index.php;
|
fastcgi_index index.php;
|
||||||
include fastcgi_params;
|
include fastcgi_params;
|
||||||
fastcgi_param REMOTE_USER $remote_user;
|
fastcgi_param REMOTE_USER $remote_user;
|
||||||
|
@ -25,6 +25,6 @@ location __PATH__/ {
|
||||||
include conf.d/yunohost_panel.conf.inc;
|
include conf.d/yunohost_panel.conf.inc;
|
||||||
}
|
}
|
||||||
|
|
||||||
location @__NAME__ {
|
location @__APP__ {
|
||||||
rewrite ^__PATH__/(.*)$ __PATH__/index.php?/$1 last;
|
rewrite ^__PATH__/(.*)$ __PATH__/index.php?/$1 last;
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,7 @@ Description=BookStack: documentation/wiki content
|
||||||
User=__APP__
|
User=__APP__
|
||||||
Group=__APP__
|
Group=__APP__
|
||||||
Restart=always
|
Restart=always
|
||||||
ExecStart=/usr/bin/php__PHPVERSION__ __INSTALL_DIR__/artisan queue:work --sleep=3 --tries=1 --max-time=3600
|
ExecStart=/usr/bin/php__PHP_VERSION__ __INSTALL_DIR__/artisan queue:work --sleep=3 --tries=1 --max-time=3600
|
||||||
|
|
||||||
# Sandboxing options to harden security
|
# Sandboxing options to harden security
|
||||||
# Depending on specificities of your service/app, you may need to tweak these
|
# Depending on specificities of your service/app, you may need to tweak these
|
||||||
|
|
|
@ -1,39 +0,0 @@
|
||||||
version = "1.0"
|
|
||||||
|
|
||||||
[main]
|
|
||||||
name = "BookStack configuration"
|
|
||||||
services = ["__APP__"]
|
|
||||||
|
|
||||||
[main.maintenance_mode]
|
|
||||||
name = "Maintenance mode"
|
|
||||||
|
|
||||||
[main.maintenance_mode.maintenance_mode]
|
|
||||||
ask = "Enable maintenance mode"
|
|
||||||
type = "boolean"
|
|
||||||
default = "0"
|
|
||||||
|
|
||||||
[main.php_fpm_config]
|
|
||||||
name = "PHP-FPM configuration"
|
|
||||||
|
|
||||||
[main.php_fpm_config.fpm_footprint]
|
|
||||||
ask = "Memory footprint"
|
|
||||||
type = "select"
|
|
||||||
choices.low = "Low, <= 20Mb per pool"
|
|
||||||
choices.medium = "Medium, between 20Mb and 40Mb per pool"
|
|
||||||
choices.high = "High, > 40Mb per pool"
|
|
||||||
choices.specific = "Use specific value"
|
|
||||||
default = "low"
|
|
||||||
|
|
||||||
[main.php_fpm_config.fpm_free_footprint]
|
|
||||||
visible = "fpm_footprint == 'specific'"
|
|
||||||
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"
|
|
||||||
type = "select"
|
|
||||||
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."
|
|
|
@ -19,6 +19,7 @@ code = "https://github.com/BookStackApp/BookStack"
|
||||||
|
|
||||||
[integration]
|
[integration]
|
||||||
yunohost = ">= 11.2.29"
|
yunohost = ">= 11.2.29"
|
||||||
|
helpers_version = "2.1"
|
||||||
architectures = "all"
|
architectures = "all"
|
||||||
multi_instance = true
|
multi_instance = true
|
||||||
|
|
||||||
|
@ -67,6 +68,7 @@ ram.runtime = "50M"
|
||||||
[resources.system_user]
|
[resources.system_user]
|
||||||
|
|
||||||
[resources.install_dir]
|
[resources.install_dir]
|
||||||
|
group = "www-data:r-x"
|
||||||
|
|
||||||
[resources.permissions]
|
[resources.permissions]
|
||||||
main.url = "/"
|
main.url = "/"
|
||||||
|
|
|
@ -1,19 +1,7 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# COMMON VARIABLES
|
# COMMON VARIABLES AND CUSTOM HELPERS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
YNH_COMPOSER_VERSION=2.5.8
|
composer_version=2.5.8
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# PERSONAL HELPERS
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# EXPERIMENTAL HELPERS
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# FUTURE OFFICIAL HELPERS
|
|
||||||
#=================================================
|
|
||||||
|
|
|
@ -1,44 +1,35 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# GENERIC START
|
|
||||||
#=================================================
|
|
||||||
# IMPORT GENERIC HELPERS
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
source ../settings/scripts/_common.sh
|
source ../settings/scripts/_common.sh
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
#=================================================
|
ynh_print_info "Declaring files to be backed up..."
|
||||||
# DECLARE DATA AND CONF FILES TO BACKUP
|
|
||||||
#=================================================
|
|
||||||
ynh_print_info --message="Declaring files to be backed up..."
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP THE APP MAIN DIR
|
# BACKUP THE APP MAIN DIR
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_backup --src_path="$install_dir"
|
ynh_backup "$install_dir"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP THE NGINX CONFIGURATION
|
# BACKUP THE NGINX CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||||
|
|
||||||
ynh_backup --src_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
|
ynh_backup "/etc/php/$php_version/fpm/pool.d/$app.conf"
|
||||||
|
|
||||||
ynh_backup --src_path="/etc/systemd/system/$app.service"
|
ynh_backup "/etc/systemd/system/$app.service"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP THE MYSQL DATABASE
|
# BACKUP THE MYSQL DATABASE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_print_info --message="Backing up the MySQL database..."
|
ynh_print_info "Backing up the MySQL database..."
|
||||||
|
|
||||||
ynh_mysql_dump_db --database="$db_name" > db.sql
|
ynh_mysql_dump_db > db.sql
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_print_info --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)."
|
ynh_print_info "Backup script completed for $app. (YunoHost will then actually copy those files to the archive)."
|
||||||
|
|
|
@ -1,56 +1,44 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# GENERIC STARTING
|
|
||||||
#=================================================
|
|
||||||
# IMPORT GENERIC HELPERS
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
source _common.sh
|
source _common.sh
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# STANDARD MODIFICATIONS
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STOP SYSTEMD SERVICE
|
# STOP SYSTEMD SERVICE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Stopping a systemd service..." --weight=1
|
ynh_script_progression "Stopping $app's systemd service..."
|
||||||
|
|
||||||
ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd"
|
ynh_systemctl --service=$app --action="stop" --log_path="systemd"
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# STANDARD MODIFICATIONS
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# MODIFY URL IN NGINX CONF
|
# MODIFY URL IN NGINX CONF
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Updating NGINX web server configuration..." --weight=1
|
ynh_script_progression "Updating NGINX web server configuration..."
|
||||||
|
|
||||||
ynh_change_url_nginx_config
|
ynh_config_change_url_nginx
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# MODIFY A CONFIG FILE
|
# MODIFY A CONFIG FILE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Reconfiguring congif file.." --weight=1
|
ynh_script_progression "Reconfiguring congif file.."
|
||||||
|
|
||||||
old_app_url_domain="https://${old_domain}${old_path%/}"
|
old_app_url_domain="https://${old_domain}${old_path%/}"
|
||||||
|
|
||||||
pushd $install_dir
|
pushd $install_dir
|
||||||
yes | php$phpversion artisan bookstack:update-url $old_app_url_domain https://${new_domain}${new_path}
|
yes | php$php_version artisan bookstack:update-url $old_app_url_domain https://${new_domain}${new_path}
|
||||||
popd
|
popd
|
||||||
|
|
||||||
sed -i "/APP_URL=/c\APP_URL=https://${new_domain}${new_path}" $install_dir/.env
|
sed -i "/APP_URL=/c\APP_URL=https://${new_domain}${new_path}" $install_dir/.env
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# GENERIC FINALISATION
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# START SYSTEMD SERVICE
|
# START SYSTEMD SERVICE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Starting a systemd service..." --weight=1
|
ynh_script_progression "Starting $app's systemd service..."
|
||||||
|
|
||||||
ynh_systemd_action --service_name=$app --action="start" --log_path="systemd"
|
ynh_systemctl --service=$app --action="start" --log_path="systemd"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_script_progression --message="Change of URL completed for $app" --last
|
ynh_script_progression "Change of URL completed for $app"
|
||||||
|
|
119
scripts/config
119
scripts/config
|
@ -1,119 +0,0 @@
|
||||||
#!/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__maintenance_mode() {
|
|
||||||
# Maintenance mode status
|
|
||||||
if [ -f $install_dir/.maintenance ]
|
|
||||||
then
|
|
||||||
echo "1"
|
|
||||||
else
|
|
||||||
echo "0"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
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__maintenance_mode() {
|
|
||||||
if [ "$maintenance_mode" -eq "1" ]; then
|
|
||||||
# If maintenance_mode was set to 1, enable maintenance mode
|
|
||||||
(cd "$install_dir" && ynh_exec_as "$app" \
|
|
||||||
echo "Site under maintenance." > .maintenance)
|
|
||||||
ynh_print_info "Maintenance mode disabled"
|
|
||||||
elif [ "$maintenance_mode" -eq "0" ]; then
|
|
||||||
# If maintenance_mode was set to 0, disable maintenance mode
|
|
||||||
ynh_secure_remove --file=$install_dir/.maintenance
|
|
||||||
ynh_print_info "Maintenance mode enabled"
|
|
||||||
fi
|
|
||||||
ynh_app_setting_set --app=$app --key=maintenance_mode --value="$maintenance_mode"
|
|
||||||
}
|
|
||||||
|
|
||||||
set__fpm_footprint() {
|
|
||||||
if [ "$fpm_footprint" != "specific" ]
|
|
||||||
then
|
|
||||||
ynh_app_setting_set --app=$app --key=fpm_footprint --value="$fpm_footprint"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
set__fpm_free_footprint() {
|
|
||||||
if [ "$fpm_footprint" = "specific" ]
|
|
||||||
then
|
|
||||||
ynh_app_setting_set --app=$app --key=fpm_footprint --value="$fpm_free_footprint"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# GENERIC FINALIZATION
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
ynh_app_config_validate() {
|
|
||||||
_ynh_app_config_validate
|
|
||||||
|
|
||||||
if [ "${changed[fpm_usage]}" == "true" ] || [ "${changed[fpm_footprint]}" == "true" ] || [ "${changed[fpm_free_footprint]}" == "true" ]; then
|
|
||||||
# If fpm_footprint is set to 'specific', use $fpm_free_footprint value.
|
|
||||||
if [ "$fpm_footprint" = "specific" ]
|
|
||||||
then
|
|
||||||
fpm_footprint=$fpm_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
|
|
|
@ -1,14 +1,12 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# GENERIC START
|
|
||||||
#=================================================
|
|
||||||
# IMPORT GENERIC HELPERS
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
source _common.sh
|
source _common.sh
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
|
ynh_app_setting_set --key=php_upload_max_filesize --value=256M
|
||||||
|
|
||||||
|
ynh_app_setting_set --key=php_memory_limit --value=256M
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RETRIEVE ARGUMENTS FROM THE MANIFEST
|
# RETRIEVE ARGUMENTS FROM THE MANIFEST
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -21,80 +19,71 @@ email=$(ynh_user_get_info --username=$admin --key=mail)
|
||||||
# STORE SETTINGS FROM MANIFEST
|
# STORE SETTINGS FROM MANIFEST
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_app_setting_set --app=$app --key=redis_db --value=$redis_db
|
ynh_app_setting_set --key=redis_db --value=$redis_db
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Setting up source files..." --weight=7
|
ynh_script_progression "Setting up source files..."
|
||||||
|
|
||||||
ynh_setup_source --dest_dir="$install_dir"
|
ynh_setup_source --dest_dir="$install_dir"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SYSTEM CONFIGURATION
|
# SYSTEM CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Adding system configurations related to $app..." --weight=1
|
ynh_script_progression "Adding system configurations related to $app..."
|
||||||
|
|
||||||
# Create a dedicated PHP-FPM config
|
ynh_config_add_phpfpm
|
||||||
ynh_add_fpm_config
|
|
||||||
|
|
||||||
# Create a dedicated NGINX config
|
ynh_config_add_nginx
|
||||||
ynh_add_nginx_config
|
|
||||||
|
|
||||||
# Create a dedicated systemd config
|
ynh_config_add_systemd
|
||||||
ynh_add_systemd_config
|
|
||||||
|
|
||||||
yunohost service add $app --description="Platform to create documentation/wiki content" --log="/var/log/$app/$app.log"
|
yunohost service add $app --description="Platform to create documentation/wiki content" --log="/var/log/$app/$app.log"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# INSTALL BOOKSTACK WITH COMPOSER
|
# INSTALL BOOKSTACK WITH COMPOSER
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Installing $app with Composer..." --weight=5
|
ynh_script_progression "Installing $app with Composer..."
|
||||||
|
|
||||||
# Install composer
|
ynh_composer_install
|
||||||
ynh_install_composer
|
ynh_composer_exec install --no-dev
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# MODIFY A CONFIG FILE
|
# MODIFY A CONFIG FILE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Adding a configuration file..." --weight=1
|
ynh_script_progression "Adding $app's configuration..."
|
||||||
|
|
||||||
app_url_domain="https://$domain${path%/}"
|
app_url_domain="https://$domain${path%/}"
|
||||||
|
|
||||||
ynh_add_config --template=.env --destination=$install_dir/.env
|
ynh_config_add --template=.env --destination=$install_dir/.env
|
||||||
|
|
||||||
chmod 640 $install_dir/.env
|
|
||||||
chown $app:$app $install_dir/.env
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# FINAL BOOKSTACK INSTALL
|
# FINAL BOOKSTACK INSTALL
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Install $app" --weight=5
|
ynh_script_progression "Install $app"
|
||||||
|
|
||||||
pushd $install_dir
|
pushd $install_dir
|
||||||
php$phpversion artisan key:generate --no-interaction --force
|
php$php_version artisan key:generate --no-interaction --force
|
||||||
php$phpversion artisan migrate --no-interaction --force
|
php$php_version artisan migrate --no-interaction --force
|
||||||
php$phpversion artisan bookstack:create-admin --email="$email" --name="$admin" --external-auth-id="$admin"
|
php$php_version artisan bookstack:create-admin --email="$email" --name="$admin" --external-auth-id="$admin"
|
||||||
popd
|
popd
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SET PERMISSIONS
|
# SET PERMISSIONS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
chmod -R o-rwx $install_dir
|
|
||||||
chmod -R 775 $install_dir/storage $install_dir/bootstrap/cache $install_dir/public/uploads
|
chmod -R 775 $install_dir/storage $install_dir/bootstrap/cache $install_dir/public/uploads
|
||||||
chown -R $app:www-data $install_dir
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# START SYSTEMD SERVICE
|
# START SYSTEMD SERVICE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Starting a systemd service..." --weight=1
|
ynh_script_progression "Starting $app's systemd service..."
|
||||||
|
|
||||||
# Start a systemd service
|
ynh_systemctl --service=$app --action="start" --log_path="systemd"
|
||||||
ynh_systemd_action --service_name=$app --action="start" --log_path="systemd"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_script_progression --message="Installation of $app completed" --last
|
ynh_script_progression "Installation of $app completed"
|
||||||
|
|
|
@ -1,11 +1,5 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# GENERIC START
|
|
||||||
#=================================================
|
|
||||||
# IMPORT GENERIC HELPERS
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
source _common.sh
|
source _common.sh
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
|
@ -13,29 +7,30 @@ source /usr/share/yunohost/helpers
|
||||||
# REMOVE SYSTEM CONFIGURATIONS
|
# REMOVE SYSTEM CONFIGURATIONS
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE SYSTEMD SERVICE
|
# REMOVE SYSTEMD SERVICE
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Removing system configurations related to $app..." --weight=1
|
ynh_script_progression "Removing system configurations related to $app..."
|
||||||
|
|
||||||
# Remove the service from the list of services known by YunoHost (added from `yunohost service add`)
|
# 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
|
if ynh_hide_warnings yunohost service status $app >/dev/null
|
||||||
then
|
then
|
||||||
ynh_script_progression --message="Removing $app service integration..." --weight=1
|
ynh_script_progression "Removing $app service integration..."
|
||||||
yunohost service remove $app
|
yunohost service remove $app
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Remove the dedicated systemd config
|
# Remove the dedicated systemd config
|
||||||
ynh_remove_systemd_config
|
ynh_config_remove_systemd
|
||||||
|
|
||||||
ynh_redis_remove_db "$redis_db"
|
ynh_redis_remove_db "$redis_db"
|
||||||
|
|
||||||
# Remove the dedicated NGINX config
|
# Remove the dedicated NGINX config
|
||||||
ynh_remove_nginx_config
|
ynh_config_remove_nginx
|
||||||
|
|
||||||
# Remove the dedicated PHP-FPM config
|
# Remove the dedicated PHP-FPM config
|
||||||
ynh_remove_fpm_config
|
ynh_config_remove_phpfpm
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_script_progression --message="Removal of $app completed" --last
|
ynh_script_progression "Removal of $app completed"
|
||||||
|
|
|
@ -1,64 +1,56 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# GENERIC START
|
|
||||||
#=================================================
|
|
||||||
# IMPORT GENERIC HELPERS
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
source ../settings/scripts/_common.sh
|
source ../settings/scripts/_common.sh
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE THE APP MAIN DIR
|
# RESTORE THE APP MAIN DIR
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Restoring the app main directory..." --weight=1
|
ynh_script_progression "Restoring the app main directory..."
|
||||||
|
|
||||||
ynh_restore_file --origin_path="$install_dir"
|
ynh_restore "$install_dir"
|
||||||
|
|
||||||
# Restore permissions on app files
|
# Restore permissions on app files
|
||||||
chmod -R o-rwx $install_dir
|
#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod -R o-rwx $install_dir
|
||||||
chmod -R 775 $install_dir/storage $install_dir/bootstrap/cache $install_dir/public/uploads
|
chmod -R 775 $install_dir/storage $install_dir/bootstrap/cache $install_dir/public/uploads
|
||||||
chown -R $app:www-data $install_dir
|
#REMOVEME? Assuming the install dir is setup using ynh_setup_source, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chown -R $app:www-data $install_dir
|
||||||
chmod 640 $install_dir/.env
|
#REMOVEME? Assuming the file is setup using ynh_config_add, the proper chmod/chowns are now already applied and it shouldn't be necessary to tweak perms | chmod 640 $install_dir/.env
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE THE MYSQL DATABASE
|
# RESTORE THE MYSQL DATABASE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Restoring the MySQL database..." --weight=2
|
ynh_script_progression "Restoring the MySQL database..."
|
||||||
|
|
||||||
ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql
|
ynh_mysql_db_shell < ./db.sql
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE SYSTEM CONFIGURATIONS
|
# RESTORE SYSTEM CONFIGURATIONS
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE THE PHP-FPM CONFIGURATION
|
# RESTORE THE PHP-FPM CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Restoring system configurations related to $app..." --weight=1
|
ynh_script_progression "Restoring system configurations related to $app..."
|
||||||
|
|
||||||
ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
|
ynh_restore "/etc/php/$php_version/fpm/pool.d/$app.conf"
|
||||||
|
|
||||||
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
ynh_restore "/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||||
|
|
||||||
ynh_restore_file --origin_path="/etc/systemd/system/$app.service"
|
ynh_restore "/etc/systemd/system/$app.service"
|
||||||
systemctl enable $app.service --quiet
|
systemctl enable $app.service --quiet
|
||||||
|
|
||||||
yunohost service add $app --description="Platform to create documentation/wiki content" --log="/var/log/$app/$app.log"
|
yunohost service add $app --description="Platform to create documentation/wiki content" --log="/var/log/$app/$app.log"
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# GENERIC FINALIZATION
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RELOAD NGINX AND PHP-FPM OR THE APP SERVICE
|
# RELOAD NGINX AND PHP-FPM OR THE APP SERVICE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Reloading NGINX web server and $app's service..." --weight=1
|
ynh_script_progression "Reloading NGINX web server and $app's service..."
|
||||||
|
|
||||||
ynh_systemd_action --service_name=php$phpversion-fpm --action=reload
|
ynh_systemctl --service=php$php_version-fpm --action=reload
|
||||||
ynh_systemd_action --service_name=nginx --action=reload
|
ynh_systemctl --service=nginx --action=reload
|
||||||
|
|
||||||
ynh_systemd_action --service_name=$app --action="start" --log_path="systemd"
|
ynh_systemctl --service=$app --action="start" --log_path="systemd"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_script_progression --message="Restoration completed for $app" --last
|
ynh_script_progression "Restoration completed for $app"
|
||||||
|
|
|
@ -1,86 +1,78 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# GENERIC START
|
|
||||||
#=================================================
|
|
||||||
# IMPORT GENERIC HELPERS
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
source _common.sh
|
source _common.sh
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
|
ynh_app_setting_set_default --key=php_upload_max_filesize --value=256M
|
||||||
|
|
||||||
|
ynh_app_setting_set_default --key=php_memory_limit --value=256M
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Upgrading source files..." --weight=1
|
ynh_script_progression "Upgrading source files..."
|
||||||
|
|
||||||
# Download, check integrity, uncompress and patch the source from app.src
|
ynh_setup_source --dest_dir="$install_dir" --full_replace --keep=".env public/uploads storage/uploads"
|
||||||
ynh_setup_source --dest_dir="$install_dir" --full_replace=1 --keep=".env public/uploads storage/uploads"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# REAPPLY SYSTEM CONFIGURATIONS
|
# REAPPLY SYSTEM CONFIGURATIONS
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Upgrading system configurations related to $app..." --weight=1
|
ynh_script_progression "Upgrading system configurations related to $app..."
|
||||||
|
|
||||||
# Create a dedicated PHP-FPM config
|
ynh_config_add_phpfpm
|
||||||
ynh_add_fpm_config
|
|
||||||
|
|
||||||
# Create a dedicated NGINX config
|
ynh_config_add_nginx
|
||||||
ynh_add_nginx_config
|
|
||||||
|
|
||||||
# Create a dedicated systemd config
|
ynh_config_add_systemd
|
||||||
ynh_add_systemd_config
|
|
||||||
|
|
||||||
yunohost service add $app --description="Platform to create documentation/wiki content" --log="/var/log/$app/$app.log"
|
yunohost service add $app --description="Platform to create documentation/wiki content" --log="/var/log/$app/$app.log"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# INSTALL LYCHEE WITH COMPOSER
|
# INSTALL LYCHEE WITH COMPOSER
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Installing BookStack with Composer..." --weight=5
|
ynh_script_progression "Installing BookStack with Composer..."
|
||||||
|
|
||||||
# Install composer
|
ynh_composer_install
|
||||||
ynh_install_composer
|
ynh_composer_exec install --no-dev
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# MODIFY A CONFIG FILE
|
# MODIFY A CONFIG FILE
|
||||||
#=================================================
|
#=================================================
|
||||||
#ynh_script_progression --message="Adding a configuration file..." --weight=1
|
#ynh_script_progression "Adding $app's configuration..."
|
||||||
|
|
||||||
#timezone="$(cat /etc/timezone)"
|
#timezone="$(cat /etc/timezone)"
|
||||||
#app_url_domain="https://$domain${path%/}"
|
#app_url_domain="https://$domain${path%/}"
|
||||||
|
|
||||||
#ynh_add_config --template=.env --destination=$install_dir/.env
|
#ynh_config_add --template=.env --destination=$install_dir/.env
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# FINAL BOOKSTACK INSTALL
|
# FINAL BOOKSTACK INSTALL
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Install BookStack" --weight=5
|
ynh_script_progression "Install BookStack"
|
||||||
|
|
||||||
pushd $install_dir
|
pushd $install_dir
|
||||||
php$phpversion artisan migrate --force
|
php$php_version artisan migrate --force
|
||||||
php$phpversion artisan key:generate --force
|
php$php_version artisan key:generate --force
|
||||||
php$phpversion artisan cache:clear
|
php$php_version artisan cache:clear
|
||||||
php$phpversion artisan config:clear
|
php$php_version artisan config:clear
|
||||||
php$phpversion artisan view:clear
|
php$php_version artisan view:clear
|
||||||
popd
|
popd
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SET PERMISSIONS
|
# SET PERMISSIONS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
chmod -R o-rwx $install_dir
|
|
||||||
chmod -R 775 $install_dir/storage $install_dir/bootstrap/cache $install_dir/public/uploads
|
chmod -R 775 $install_dir/storage $install_dir/bootstrap/cache $install_dir/public/uploads
|
||||||
chown -R $app:www-data $install_dir
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# START SYSTEMD SERVICE
|
# START SYSTEMD SERVICE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Starting a systemd service..." --weight=1
|
ynh_script_progression "Starting $app's systemd service..."
|
||||||
|
|
||||||
ynh_systemd_action --service_name=$app --action="start" --log_path="systemd"
|
ynh_systemctl --service=$app --action="start" --log_path="systemd"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_script_progression --message="Upgrade of $app completed" --last
|
ynh_script_progression "Upgrade of $app completed"
|
||||||
|
|
Loading…
Reference in a new issue