mirror of
https://github.com/YunoHost-Apps/cachet_ynh.git
synced 2024-09-03 18:16:03 +02:00
* Version 2 (#32) * v2 * Auto-update README * v2 * fix * Auto-update README --------- Co-authored-by: yunohost-bot <yunohost@yunohost.org> * Update _common.sh * Update manifest.toml * Auto-update README * Update manifest.toml * Update manifest.toml Co-authored-by: Alexandre Aubin <alex.aubin@mailoo.org> * Upgrade to v2023.08.13 (#37) * Upgrade to v2023.08.13 * Auto-update README * Update manifest.toml * Update tests.toml * Update manifest.toml * Auto-update README * Upgrade to v2023.08.17 (#39) * Upgrade to v2023.08.17 * Auto-update README * Update manifest.toml * Upgrade to v2023.08.19 (#41) * Upgrade to v2023.08.19 * Auto-update README * Upgrade to v2023.08.21 (#42) * Upgrade to v2023.08.21 * Auto-update README * Upgrade to v2023.08.24 (#43) * Upgrade to v2023.08.24 * Auto-update README * Upgrade to v2023.09.05 (#45) * Upgrade to v2023.09.05 * Auto-update README * Cleaning (#49) * cleaning * Auto-update README * cleaning * Auto-update README --------- Co-authored-by: yunohost-bot <yunohost@yunohost.org> * Upgrade to v2023.10.11 (#50) * Upgrade to v2023.10.11 * Auto-update README * Upgrade to v2023.10.27 (#52) * Upgrade to v2023.11.07 (#53) * Upgrade to v2023.11.07 * Auto-update README * cleaning * Update manifest.toml * Auto-update README * cleaning * Upgrade to v2023.12.01 (#56) * Upgrade to v2023.12.01 * Auto-update README --------- Co-authored-by: Éric Gaspar <46165813+ericgaspar@users.noreply.github.com> --------- Co-authored-by: yunohost-bot <yunohost@yunohost.org> Co-authored-by: Alexandre Aubin <alex.aubin@mailoo.org> Co-authored-by: YunoHost Bot <yunohost-bot@users.noreply.github.com> Co-authored-by: Félix Piédallu <felix@piedallu.me>
96 lines
3.5 KiB
Bash
96 lines
3.5 KiB
Bash
#!/bin/bash
|
|
|
|
#=================================================
|
|
# GENERIC START
|
|
#=================================================
|
|
# IMPORT GENERIC HELPERS
|
|
#=================================================
|
|
|
|
source _common.sh
|
|
source /usr/share/yunohost/helpers
|
|
|
|
#=================================================
|
|
# RETRIEVE ARGUMENTS FROM THE MANIFEST
|
|
#=================================================
|
|
|
|
admin_mail="$(ynh_user_get_info --username=$admin --key=mail)"
|
|
|
|
#=================================================
|
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
|
#=================================================
|
|
ynh_script_progression --message="Setting up source files..." --weight=5
|
|
|
|
# Download, check integrity, uncompress and patch the source from app.src
|
|
ynh_setup_source --dest_dir="$install_dir"
|
|
|
|
chmod -R o-rwx "$install_dir"
|
|
chown -R $app:www-data "$install_dir"
|
|
|
|
#=================================================
|
|
# SYSTEM CONFIGURATION
|
|
#=================================================
|
|
ynh_script_progression --message="Adding system configurations related to $app..." --weight=1
|
|
|
|
# Create a dedicated NGINX config
|
|
ynh_add_nginx_config
|
|
|
|
# Create a dedicated PHP-FPM config
|
|
ynh_add_fpm_config
|
|
|
|
#=================================================
|
|
# SPECIFIC SETUP
|
|
#=================================================
|
|
# PRE-CONFIGURE CACHET
|
|
#=================================================
|
|
ynh_script_progression --message="Pre-configuring Cachet..." --weight=10
|
|
|
|
ynh_add_config --template=".env.example" --destination="$install_dir/.env"
|
|
|
|
#=================================================
|
|
# INSTALL AND INITIALIZE COMPOSER
|
|
#=================================================
|
|
ynh_script_progression --message="Installing with composer..."
|
|
|
|
ynh_install_composer --install_args="--optimize-autoloader"
|
|
|
|
#=================================================
|
|
# FINALIZE CACHET INSTALLATION
|
|
#=================================================
|
|
ynh_script_progression --message="Installing Cachet..."
|
|
|
|
mkdir -p "$install_dir/storage/app/public"
|
|
exec_artisan "key:generate"
|
|
exec_artisan "cachet:install"
|
|
|
|
#=================================================
|
|
# FINALIZE CACHET CONFIGURATION
|
|
#=================================================
|
|
ynh_script_progression --message="Finalizing Cachet configuration..."
|
|
|
|
password_hash="$(cd $install_dir ; php$phpversion artisan tinker -q --no-ansi <<< "echo Hash::make('$password');" |head -n 1)"
|
|
password_pash="${password_hash::-1}" # Remove last character
|
|
|
|
# Populate MySQL database
|
|
ynh_add_config --template="init-mysql.sql" --destination="$install_dir/init-mysql.sql"
|
|
ynh_mysql_connect_as --user="$db_name" --password="$db_pwd" --database="$db_name" < "$install_dir/init-mysql.sql"
|
|
ynh_delete_file_checksum --file="$install_dir/init-mysql.sql"
|
|
#REMOVEME? ynh_secure_remove --file="$install_dir/init-mysql.sql"
|
|
|
|
ynh_add_config --template="../conf/production.php" --destination="$install_dir/bootstrap/cachet/production.php"
|
|
chown $app: $install_dir/bootstrap/cachet/production.php
|
|
|
|
#=================================================
|
|
# SECURE FILES AND DIRECTORIES
|
|
#=================================================
|
|
|
|
# Set permissions to app files
|
|
chmod 750 "$install_dir"
|
|
chmod -R o-rwx "$install_dir"
|
|
chown -R $app:www-data "$install_dir"
|
|
chown -R $app: "${install_dir}/.env" "${install_dir}/storage/" "${install_dir}/bootstrap/"
|
|
|
|
#=================================================
|
|
# END OF SCRIPT
|
|
#=================================================
|
|
|
|
ynh_script_progression --message="Installation of $app completed" --last
|