mirror of
https://github.com/YunoHost-Apps/monica_ynh.git
synced 2024-09-03 19:46:23 +02:00
Composer fix
This commit is contained in:
parent
c18880a965
commit
226ed3d450
10 changed files with 69 additions and 56 deletions
31
README.md
31
README.md
|
@ -1,7 +1,6 @@
|
|||
# Monica for YunoHost
|
||||
|
||||
[](https://dash.yunohost.org/appci/app/monica)  
|
||||
|
||||
[](https://dash.yunohost.org/appci/app/monica)  
|
||||
[](https://install-app.yunohost.org/?app=monica)
|
||||
|
||||
> *This package allows you to install Monica quickly and simply on a YunoHost server.
|
||||
|
@ -18,10 +17,20 @@ Monica is an open-source web application to organize the interactions with your
|
|||
|
||||
## Configuration
|
||||
|
||||
Change the settings of the app by changing the values in .env
|
||||
Change the settings of the app by changing the values in `.env`
|
||||
|
||||
## YunoHost specific features
|
||||
|
||||
## What works?
|
||||
* [X] Update and remove script
|
||||
* [X] Upgrade script
|
||||
* [X] Backup and restore script
|
||||
* [X] Multi-instance
|
||||
* [x] make root domain redirect to index.php
|
||||
* [x] Chang URL (Need testing,backup before trying this)
|
||||
* [ ] LDAP/SSO support
|
||||
* [x] Make monica installable into subdirectory (eg. https://example.com/monica/)
|
||||
|
||||
#### Multi-user support
|
||||
|
||||
**First User Registration:** Visit the app **domain** after the installation is complete to register as **first user**. After the first user is registered the registration will be **locked**. You can open the register for all by changing the value **APP_DISABLE_SIGNUP** to **false** in **.env**. There is **no admin interface** in the Monica app currently.
|
||||
|
@ -38,23 +47,9 @@ Change the settings of the app by changing the values in .env
|
|||
* Upstream app repository: https://github.com/monicahq/monica
|
||||
* YunoHost website: https://yunohost.org/
|
||||
|
||||
## Introduction
|
||||
|
||||
|
||||
## What works?
|
||||
* [X] Update and remove script
|
||||
* [X] Upgrade script
|
||||
* [X] Backup and restore script
|
||||
* [X] Multi-instance
|
||||
* [x] make root domain redirect to index.php
|
||||
* [x] Chang URL (Need testing,backup before trying this)
|
||||
* [ ] LDAP/SSO support
|
||||
* [x] Make monica installable into subdirectory (eg. https://example.com/monica/)
|
||||
|
||||
---
|
||||
|
||||
Developer info
|
||||
----------------
|
||||
## Developer info
|
||||
|
||||
Please send your pull request to the [testing branch](https://github.com/YunoHost-Apps/monica_ynh/tree/testing).
|
||||
|
||||
|
|
|
@ -44,3 +44,5 @@ Notification=change
|
|||
name=2.14.0
|
||||
; commit=4b497cf6445fc515070265721f40ceb816864bf1
|
||||
name=2.17.0~ynh1
|
||||
; commit=d03eaae18c5b99f7933ae18378d5567fc46389f5
|
||||
name=2.17.0~ynh2
|
||||
|
|
|
@ -7,7 +7,7 @@ about: Create a report to help us debug, it would be nice to fill the template a
|
|||
**How to post a meaningful bug report**
|
||||
1. *Read this whole template first.*
|
||||
2. *Determine if you are on the right place:*
|
||||
- *If you were performing an action on the app from the webadmin or the CLI (install, update, backup, restore, change url...), you are on the right place!*
|
||||
- *If you were performing an action on the app from the webadmin or the CLI (install, update, backup, restore, change_url...), you are on the right place!*
|
||||
- *Otherwise, the issue may be due to Monica itself. Refer to its documentation or repository for help.*
|
||||
- *If you have a doubt, post here, we will figure it out together.*
|
||||
3. *Delete the italic comments as you write over them below, and remove this guide.*
|
||||
|
@ -34,8 +34,8 @@ about: Create a report to help us debug, it would be nice to fill the template a
|
|||
- *If you used the webadmin, please perform the equivalent command from the CLI first.*
|
||||
- *If the error occurs in your browser, explain what you did:*
|
||||
1. *Go to '...'*
|
||||
2. *Click on '....'*
|
||||
3. *Scroll down to '....'*
|
||||
2. *Click on '...'*
|
||||
3. *Scroll down to '...'*
|
||||
4. *See error*
|
||||
|
||||
**Expected behavior**
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
"url": "http://github.com/rndmh3ro/monica_ynh"
|
||||
},
|
||||
"requirements": {
|
||||
"yunohost": ">= 3.5"
|
||||
"yunohost": ">= 3.8.1"
|
||||
},
|
||||
"multi_instance": true,
|
||||
"services": [
|
||||
|
@ -75,7 +75,8 @@
|
|||
"name": "dav_support",
|
||||
"type": "boolean",
|
||||
"ask": {
|
||||
"en": "Enable DAV support?"
|
||||
"en": "Enable DAV support?",
|
||||
"fr": "Activer le support DAV ?"
|
||||
},
|
||||
"default": true
|
||||
},
|
||||
|
@ -83,7 +84,8 @@
|
|||
"name": "signup",
|
||||
"type": "boolean",
|
||||
"ask": {
|
||||
"en": "Enable signup for public users?"
|
||||
"en": "Enable signup for public users?",
|
||||
"fr": "Activer l'inscription pour les utilisateurs publics ?"
|
||||
},
|
||||
"default": false
|
||||
},
|
||||
|
@ -91,7 +93,8 @@
|
|||
"name": "two_factor",
|
||||
"type": "boolean",
|
||||
"ask": {
|
||||
"en": "Enable Two Factor Authentication for accounts?"
|
||||
"en": "Enable Two Factor Authentication for accounts?",
|
||||
"fr": "Activer l'authentification à deux facteurs pour les comptes ?"
|
||||
},
|
||||
"default": false
|
||||
}
|
||||
|
|
|
@ -38,7 +38,7 @@ phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
|
|||
#=================================================
|
||||
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
||||
#=================================================
|
||||
ynh_script_progression --message="Backing up the app before changing its url (may take a while)..."
|
||||
ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..."
|
||||
|
||||
# Backup the current version of the app
|
||||
ynh_backup_before_upgrade
|
||||
|
@ -73,22 +73,23 @@ fi
|
|||
#=================================================
|
||||
# MODIFY URL IN NGINX CONF
|
||||
#=================================================
|
||||
ynh_script_progression --message="Updating NGINX web server configuration..."
|
||||
|
||||
nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf
|
||||
|
||||
# Change the path in the nginx config file
|
||||
# Change the path in the NGINX config file
|
||||
if [ $change_path -eq 1 ]
|
||||
then
|
||||
# Make a backup of the original nginx config file if modified
|
||||
# Make a backup of the original NGINX config file if modified
|
||||
ynh_backup_if_checksum_is_different --file="$nginx_conf_path"
|
||||
# Set global variables for nginx helper
|
||||
# Set global variables for NGINX helper
|
||||
domain="$old_domain"
|
||||
path_url="$new_path"
|
||||
# Create a dedicated nginx config
|
||||
# Create a dedicated NGINX config
|
||||
ynh_add_nginx_config
|
||||
fi
|
||||
|
||||
# Change the domain for nginx
|
||||
# Change the domain for NGINX
|
||||
if [ $change_domain -eq 1 ]
|
||||
then
|
||||
# Delete file checksum for the old conf file location
|
||||
|
@ -102,14 +103,16 @@ fi
|
|||
# SPECIFIC MODIFICATIONS
|
||||
#=================================================
|
||||
# Run monica update
|
||||
cd $final_path && sudo /usr/bin/php7.2 artisan monica:update --force
|
||||
pushd "$final_path"
|
||||
php$phpversion artisan monica:update --force
|
||||
popd
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALISATION
|
||||
#=================================================
|
||||
# RELOAD NGINX
|
||||
#=================================================
|
||||
ynh_script_progression --message="Reloading nginx web server..."
|
||||
ynh_script_progression --message="Reloading NGINX web server..."
|
||||
|
||||
ynh_systemd_action --service_name=nginx --action=reload
|
||||
|
||||
|
|
|
@ -93,9 +93,9 @@ ynh_setup_source --dest_dir="$final_path"
|
|||
#=================================================
|
||||
# NGINX CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring nginx web server..."
|
||||
ynh_script_progression --message="Configuring NGINX web server..."
|
||||
|
||||
# Create a dedicated nginx config
|
||||
# Create a dedicated NGINX config
|
||||
ynh_add_nginx_config
|
||||
|
||||
#=================================================
|
||||
|
@ -109,9 +109,9 @@ ynh_system_user_create --username=$app
|
|||
#=================================================
|
||||
# PHP-FPM CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring php-fpm..."
|
||||
ynh_script_progression --message="Configuring PHP-FPM..."
|
||||
|
||||
# Create a dedicated php-fpm config
|
||||
# Create a dedicated PHP-FPM config
|
||||
ynh_add_fpm_config --usage=low --footprint=low --package="$extra_php_dependencies"
|
||||
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
|
||||
|
||||
|
@ -120,7 +120,7 @@ phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
|
|||
#=================================================
|
||||
# INSTALL COMPOSER DEPENDENCIES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Installing composer dependencies..."
|
||||
ynh_script_progression --message="Installing Composer dependencies..."
|
||||
|
||||
ynh_exec_warn_less ynh_install_composer --phpversion="$phpversion" --workdir="$final_path"
|
||||
|
||||
|
@ -216,6 +216,7 @@ ynh_script_progression --message="Securing files and directories..."
|
|||
# Set permissions to app files
|
||||
chown -R $app: $final_path
|
||||
chmod -R 775 "$final_path/storage"
|
||||
|
||||
#=================================================
|
||||
# SETUP SSOWAT
|
||||
#=================================================
|
||||
|
@ -231,7 +232,7 @@ fi
|
|||
#=================================================
|
||||
# RELOAD NGINX
|
||||
#=================================================
|
||||
ynh_script_progression --message="Reloading nginx web server..."
|
||||
ynh_script_progression --message="Reloading NGINX web server..."
|
||||
|
||||
ynh_systemd_action --service_name=nginx --action=reload
|
||||
|
||||
|
|
|
@ -50,17 +50,17 @@ ynh_secure_remove --file="$final_path"
|
|||
#=================================================
|
||||
# REMOVE NGINX CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing nginx web server configuration..."
|
||||
ynh_script_progression --message="Removing NGINX web server configuration..."
|
||||
|
||||
# Remove the dedicated nginx config
|
||||
# Remove the dedicated NGINX config
|
||||
ynh_remove_nginx_config
|
||||
|
||||
#=================================================
|
||||
# REMOVE PHP-FPM CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing php-fpm configuration..."
|
||||
ynh_script_progression --message="Removing PHP-FPM configuration..."
|
||||
|
||||
# Remove the dedicated php-fpm config
|
||||
# Remove the dedicated PHP-FPM config
|
||||
ynh_remove_fpm_config
|
||||
|
||||
#=================================================
|
||||
|
|
|
@ -49,7 +49,7 @@ test ! -d $final_path \
|
|||
#=================================================
|
||||
# RESTORE THE NGINX CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring the nginx configuration..."
|
||||
ynh_script_progression --message="Restoring the NGINX configuration..."
|
||||
|
||||
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||
|
||||
|
@ -76,6 +76,7 @@ ynh_script_progression --message="Restoring user rights..."
|
|||
# Restore permissions on app files
|
||||
chown -R $app: $final_path
|
||||
chmod -R 775 "$final_path/storage"
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE PHP-FPM CONFIGURATION
|
||||
#=================================================
|
||||
|
@ -83,7 +84,7 @@ ynh_script_progression --message="Restoring PHP-FPM configuration..."
|
|||
|
||||
ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
|
||||
|
||||
# Recreate a dedicated php-fpm config
|
||||
# Recreate a dedicated PHP-FPM config
|
||||
ynh_add_fpm_config --usage=low --footprint=low --package="$extra_php_dependencies"
|
||||
|
||||
#=================================================
|
||||
|
@ -117,7 +118,7 @@ ynh_restore_file --origin_path="/etc/cron.d/$app"
|
|||
#=================================================
|
||||
# RELOAD NGINX AND PHP-FPM
|
||||
#=================================================
|
||||
ynh_script_progression --message="Reloading nginx web server and php-fpm..."
|
||||
ynh_script_progression --message="Reloading NGINX web server and PHP-FPM..."
|
||||
|
||||
ynh_systemd_action --service_name=php$phpversion-fpm --action=reload
|
||||
ynh_systemd_action --service_name=nginx --action=reload
|
||||
|
|
|
@ -111,9 +111,9 @@ fi
|
|||
#=================================================
|
||||
# NGINX CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Upgrading nginx web server configuration..."
|
||||
ynh_script_progression --message="Upgrading NGINX web server configuration..."
|
||||
|
||||
# Create a dedicated nginx config
|
||||
# Create a dedicated NGINX config
|
||||
ynh_add_nginx_config
|
||||
|
||||
#=================================================
|
||||
|
@ -134,9 +134,9 @@ ynh_system_user_create --username=$app
|
|||
#=================================================
|
||||
# PHP-FPM CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Upgrading php-fpm configuration..."
|
||||
ynh_script_progression --message="Upgrading PHP-FPM configuration..."
|
||||
|
||||
# Create a dedicated php-fpm config
|
||||
# Create a dedicated PHP-FPM config
|
||||
ynh_add_fpm_config --usage=low --footprint=low --package="$extra_php_dependencies"
|
||||
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
|
||||
|
||||
|
@ -145,9 +145,9 @@ phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
|
|||
#=================================================
|
||||
# UPDATE PHP DEPENDENCIES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Updating php dependencies..."
|
||||
ynh_script_progression --message="Updating PHP dependencies..."
|
||||
|
||||
chown -R "$app": "$final_path"
|
||||
chown -R $app: "$final_path"
|
||||
|
||||
ynh_exec_warn_less ynh_composer_exec --phpversion="$phpversion" --workdir="$final_path" --commands="update"
|
||||
|
||||
|
@ -261,6 +261,7 @@ ynh_script_progression --message="Securing files and directories..."
|
|||
# Set permissions on app files
|
||||
chown -R $app: $final_path
|
||||
chmod -R 775 "$final_path/storage"
|
||||
|
||||
#=================================================
|
||||
# SETUP SSOWAT
|
||||
#=================================================
|
||||
|
@ -276,7 +277,7 @@ fi
|
|||
#=================================================
|
||||
# RELOAD NGINX
|
||||
#=================================================
|
||||
ynh_script_progression --message="Reloading nginx web server..."
|
||||
ynh_script_progression --message="Reloading NGINX web server..."
|
||||
|
||||
ynh_systemd_action --service_name=nginx --action=reload
|
||||
|
||||
|
|
|
@ -1,5 +1,10 @@
|
|||
#!/bin/bash
|
||||
|
||||
readonly YNH_DEFAULT_COMPOSER_VERSION=1.10.17
|
||||
# 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_composer_exec [--phpversion=phpversion] [--workdir=$final_path] --commands="commands"
|
||||
|
@ -25,26 +30,28 @@ ynh_composer_exec () {
|
|||
|
||||
# Install and initialize Composer in the given directory
|
||||
#
|
||||
# usage: ynh_install_composer [--phpversion=phpversion] [--workdir=$final_path] [--install_args="--optimize-autoloader"]
|
||||
# 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
|
||||
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=)
|
||||
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 \
|
||||
| COMPOSER_HOME="$workdir/.composer" \
|
||||
php${phpversion} -- --install-dir="$workdir" \
|
||||
php${phpversion} -- --install-dir="$workdir" --version="$composerversion" \
|
||||
|| ynh_die "Unable to install Composer."
|
||||
|
||||
# update dependencies to create composer.lock
|
||||
|
|
Loading…
Add table
Reference in a new issue