diff --git a/README.md b/README.md index c15391e..0c08406 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in Monica is an open-source web application to organize the interactions with your loved ones. I call it a PRM, or Personal Relationship Management. Think of it as a [CRM](https://en.wikipedia.org/wiki/Customer_relationship_management) (a popular tool used by sales teams in the corporate world) for your friends or family. -**Shipped version:** 2.17.0~ynh3 +**Shipped version:** 3.6.1~ynh1 diff --git a/README_fr.md b/README_fr.md index c18fd76..065284a 100644 --- a/README_fr.md +++ b/README_fr.md @@ -14,7 +14,7 @@ Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour Monica is an open-source web application to organize the interactions with your loved ones. I call it a PRM, or Personal Relationship Management. Think of it as a [CRM](https://en.wikipedia.org/wiki/Customer_relationship_management) (a popular tool used by sales teams in the corporate world) for your friends or family. -**Version incluse :** 2.17.0~ynh3 +**Version incluse :** 3.6.1~ynh1 @@ -28,10 +28,10 @@ Monica is an open-source web application to organize the interactions with your ## Documentations et ressources -* Site officiel de l'app : https://monicahq.com -* Dépôt de code officiel de l'app : https://github.com/monicahq/monica -* Documentation YunoHost pour cette app : https://yunohost.org/app_monica -* Signaler un bug : https://github.com/YunoHost-Apps/monica_ynh/issues +* Site officiel de l'app : https://monicahq.com +* Dépôt de code officiel de l'app : https://github.com/monicahq/monica +* Documentation YunoHost pour cette app : https://yunohost.org/app_monica +* Signaler un bug : https://github.com/YunoHost-Apps/monica_ynh/issues ## Informations pour les développeurs @@ -44,4 +44,4 @@ ou sudo yunohost app upgrade monica -u https://github.com/YunoHost-Apps/monica_ynh/tree/testing --debug ``` -**Plus d'infos sur le packaging d'applications :** https://yunohost.org/packaging_apps \ No newline at end of file +**Plus d'infos sur le packaging d'applications :** https://yunohost.org/packaging_apps \ No newline at end of file diff --git a/check_process b/check_process index 0a3c338..c36bb46 100644 --- a/check_process +++ b/check_process @@ -5,6 +5,7 @@ admin="john" language="fr" is_public=1 + password="1Strong-Password" ; Checks pkg_linter=1 setup_sub_dir=0 @@ -19,6 +20,8 @@ # upgrade=1 from_commit=4b497cf6445fc515070265721f40ceb816864bf1 # 2.17.0~ynh2 upgrade=1 from_commit=abd951313924e009a1e2c6dda5f78fe3a2564004 + # 2.17.0~ynh3 + upgrade=1 from_commit=a302e339956009004ece10bec8028f26a59d665e backup_restore=1 multi_instance=1 port_already_use=0 @@ -33,3 +36,5 @@ Notification=change name=2.17.0~ynh1 ; commit=abd951313924e009a1e2c6dda5f78fe3a2564004 name=2.17.0~ynh2 + ; commit=a302e339956009004ece10bec8028f26a59d665e + name=2.17.0~ynh3 diff --git a/conf/.env b/conf/.env index 5bf10ca..ff67513 100644 --- a/conf/.env +++ b/conf/.env @@ -24,8 +24,13 @@ HASH_LENGTH=18 # The URL of your application. APP_URL=https://__DOMAIN__ +# Force using APP_URL as base url of your application. +# You should not need this, unless you are using subdirectory config. +APP_FORCE_URL=false + # Database information # To keep this information secure, we urge you to change the default password +# Currently only "mysql" compatible servers are working DB_CONNECTION=mysql DB_HOST=127.0.0.1 DB_PORT=3306 @@ -45,7 +50,7 @@ DB_TEST_PASSWORD=secret DB_USE_UTF8MB4=true # Mail credentials used to send emails from the application. -MAIL_DRIVER=mail +MAIL_DRIVER=smtp MAIL_HOST=127.0.0.1 MAIL_PORT=25 MAIL_USERNAME= @@ -126,6 +131,10 @@ AWS_REGION=us-east-1 AWS_BUCKET= AWS_SERVER= +# Set to true if you use S3 and need path style URL support for bucket access +# The default is to use virtual-hosted style URLs which may not work everywhere +S3_PATH_STYLE= + # Allow Two Factor Authentication feature on your instance MFA_ENABLED=false @@ -185,7 +194,10 @@ LOCATION_IQ_API_KEY= ENABLE_WEATHER=false # Access to weather data from darksky api -# https://darksky.net/dev/register -# Darksky provides an api with 1000 free API calls per day +# https://www.weatherapi.com/signup.aspx # You need to enable the weather above if you provide an API key here. -DARKSKY_API_KEY= +WEATHERAPI_KEY= + +# Configure rate limits for RouteService per minute +RATE_LIMIT_PER_MINUTE_API=60 +RATE_LIMIT_PER_MINUTE_OAUTH=5 diff --git a/conf/app.src b/conf/app.src index 65c7a00..671396a 100644 --- a/conf/app.src +++ b/conf/app.src @@ -1,7 +1,7 @@ -SOURCE_URL=https://github.com/monicahq/monica/archive/v2.17.0.zip -SOURCE_SUM=834c91b901f84e4a14a7e4697c0b6226b9b0768ff0b0ed761029c4e9d765262c +SOURCE_URL=https://github.com/monicahq/monica/archive/v3.6.1.zip +SOURCE_SUM=8f2fdbd91e22bee2bcebc8cfeda0aa3a305d2e5dfd99a659cd30f9b92b2c2bd9 SOURCE_SUM_PRG=sha256sum SOURCE_FORMAT=zip SOURCE_IN_SUBDIR=true -SOURCE_FILENAME=v2.17.0.zip +SOURCE_FILENAME=v3.6.1.zip SOURCE_EXTRACT=true diff --git a/conf/nginx.conf b/conf/nginx.conf index ce0fb76..b5a1952 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -8,7 +8,7 @@ location ^~ __PATH__/ { # Common parameter to increase upload size limit in conjunction with dedicated php-fpm file #client_max_body_size 50M; - + try_files $uri $uri/ @monica; location ~ \.php { fastcgi_split_path_info ^(.+?\.php)(/.*)$; diff --git a/doc/DISCLAIMER.md b/doc/DISCLAIMER.md index 3e91430..80e7b35 100644 --- a/doc/DISCLAIMER.md +++ b/doc/DISCLAIMER.md @@ -1 +1,3 @@ -* **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. +* You can connect using the email address of the user choosen during the installation and password provided during the installation +* New registrations are disabled, 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. diff --git a/manifest.json b/manifest.json index f314b7e..5a20210 100644 --- a/manifest.json +++ b/manifest.json @@ -5,7 +5,7 @@ "description": { "en": " Personal Relationship Manager - a new kind of CRM to organize interactions with your friends and family." }, - "version": "2.17.0~ynh3", + "version": "3.6.1~ynh1", "url": "https://monicahq.com", "upstream": { "license": "GPL-3.0", @@ -61,6 +61,10 @@ }, "choices": ["cs","de","en","es","fr","he","it","nl","pt","ru","zh"], "default": "en" + }, + { + "name": "password", + "type": "password" } ] } diff --git a/scripts/_common.sh b/scripts/_common.sh index 0f97942..fa8503b 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -7,9 +7,13 @@ # dependencies used by the app pkg_dependencies="" -YNH_PHP_VERSION="7.3" +NODEJS_VERSION=16 -extra_php_dependencies="php${YNH_PHP_VERSION}-cli php${YNH_PHP_VERSION}-json php${YNH_PHP_VERSION}-opcache php${YNH_PHP_VERSION}-mysql php${YNH_PHP_VERSION}-mbstring php${YNH_PHP_VERSION}-zip php${YNH_PHP_VERSION}-bcmath php${YNH_PHP_VERSION}-intl php${YNH_PHP_VERSION}-xml php${YNH_PHP_VERSION}-curl php${YNH_PHP_VERSION}-gd php${YNH_PHP_VERSION}-gmp php${YNH_PHP_VERSION}-redis" +YNH_PHP_VERSION="7.4" + +YNH_COMPOSER_VERSION="2.2.5" + +extra_php_dependencies="php${YNH_PHP_VERSION}-bcmath php${YNH_PHP_VERSION}-cli php${YNH_PHP_VERSION}-curl php${YNH_PHP_VERSION}-dom php${YNH_PHP_VERSION}-gd php${YNH_PHP_VERSION}-gmp php${YNH_PHP_VERSION}-iconv php${YNH_PHP_VERSION}-intl php${YNH_PHP_VERSION}-json php${YNH_PHP_VERSION}-mbstring php${YNH_PHP_VERSION}-mysql php${YNH_PHP_VERSION}-mysqli php${YNH_PHP_VERSION}-opcache php${YNH_PHP_VERSION}-redis php${YNH_PHP_VERSION}-xml php${YNH_PHP_VERSION}-zip" #================================================= # PERSONAL HELPERS diff --git a/scripts/install b/scripts/install index 36da5aa..f8ca614 100755 --- a/scripts/install +++ b/scripts/install @@ -25,8 +25,9 @@ path_url=$YNH_APP_ARG_PATH admin=$YNH_APP_ARG_ADMIN is_public=$YNH_APP_ARG_IS_PUBLIC language=$YNH_APP_ARG_LANGUAGE +password=$YNH_APP_ARG_PASSWORD random_key=$(ynh_string_random --length=32) -email=$(ynh_user_get_info $admin 'mail') +email=$(ynh_user_get_info --username=$admin --key="mail") app=$YNH_APP_INSTANCE_NAME @@ -60,6 +61,8 @@ ynh_app_setting_set --app=$app --key=random_key --value=$random_key ynh_script_progression --message="Installing dependencies..." ynh_install_app_dependencies $pkg_dependencies +ynh_install_nodejs --nodejs_version=$NODEJS_VERSION +ynh_install_extra_app_dependencies --repo="deb https://dl.yarnpkg.com/debian/ stable main" --package="yarn" --key="https://dl.yarnpkg.com/debian/pubkey.gpg" #================================================= # CREATE DEDICATED USER @@ -118,6 +121,10 @@ ynh_script_progression --message="Installing composer dependencies..." ynh_exec_warn_less ynh_install_composer --phpversion="$phpversion" --workdir="$final_path" +chmod 750 "$final_path" +chmod -R o-rwx "$final_path" +chown -R $app:www-data "$final_path" + #================================================= # ADD A CONFIGURATION #================================================= @@ -139,10 +146,14 @@ ynh_replace_string --match_string="__LANGUAGE__" --replace_string="$language" -- #================================================= ynh_script_progression --message="Deploying..." +update-alternatives --set php /usr/bin/php$phpversion + pushd "$final_path" - php$phpversion artisan monica:update --force - php$phpversion artisan passport:keys - php$phpversion artisan passport:client --password -n > key.txt + ynh_use_nodejs + ynh_exec_warn_less ynh_exec_as $app $ynh_node_load_PATH yarn install + ynh_exec_warn_less ynh_exec_as $app $ynh_node_load_PATH yarn run production + ynh_exec_warn_less ynh_exec_as $app php$phpversion artisan setup:production --force --email=$email --password=$password + ynh_exec_warn_less ynh_exec_as $app php$phpversion artisan passport:client --password -n > key.txt mobile_id=$( cd $final_path && tail -2 key.txt | head -1 | cut -c 12- ) mobile_key=$( cd $final_path && tail -1 key.txt | cut -c 16- ) ynh_replace_string --match_string="__MOBILE_ID__" --replace_string="$mobile_id" --target_file="$config" @@ -150,6 +161,7 @@ pushd "$final_path" ynh_app_setting_set --app=$app --key=mobile_id --value=$mobile_id ynh_app_setting_set --app=$app --key=mobile_key --value=$mobile_key ynh_secure_remove --file="$final_path/key.txt" + ynh_exec_warn_less ynh_exec_as $app php$phpversion artisan config:cache popd # Calculate and store the config file checksum into the app settings @@ -158,6 +170,8 @@ ynh_store_file_checksum --file="$config" chmod 400 "$config" chown $app:$app "$config" +update-alternatives --set php /usr/bin/php${YNH_DEFAULT_PHP_VERSION} + #================================================= # INSTALL THE CRON FILE #================================================= diff --git a/scripts/remove b/scripts/remove index f0c04b5..a157c1f 100755 --- a/scripts/remove +++ b/scripts/remove @@ -61,6 +61,7 @@ ynh_remove_fpm_config ynh_script_progression --message="Removing dependencies..." # Remove metapackage and its dependencies +ynh_remove_nodejs ynh_remove_app_dependencies #================================================= diff --git a/scripts/restore b/scripts/restore index cc192c4..5dc4cfd 100755 --- a/scripts/restore +++ b/scripts/restore @@ -93,6 +93,8 @@ ynh_script_progression --message="Reinstalling dependencies..." # Define and install dependencies ynh_install_app_dependencies $pkg_dependencies +ynh_install_nodejs --nodejs_version=$NODEJS_VERSION +ynh_install_extra_app_dependencies --repo="deb https://dl.yarnpkg.com/debian/ stable main" --package="yarn" --key="https://dl.yarnpkg.com/debian/pubkey.gpg" #================================================= # RESTORE THE MYSQL DATABASE diff --git a/scripts/upgrade b/scripts/upgrade index 7441a92..c3f3be4 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -109,6 +109,8 @@ ynh_add_nginx_config ynh_script_progression --message="Upgrading dependencies..." ynh_install_app_dependencies $pkg_dependencies +ynh_install_nodejs --nodejs_version=$NODEJS_VERSION +ynh_install_extra_app_dependencies --repo="deb https://dl.yarnpkg.com/debian/ stable main" --package="yarn" --key="https://dl.yarnpkg.com/debian/pubkey.gpg" #================================================= # PHP-FPM CONFIGURATION @@ -128,6 +130,10 @@ ynh_script_progression --message="Updating php dependencies..." ynh_exec_warn_less ynh_composer_exec --phpversion="$phpversion" --workdir="$final_path" --commands="update" +chmod 750 "$final_path" +chmod -R o-rwx "$final_path" +chown -R $app:www-data "$final_path" + #================================================= # UPDATE A CONFIG FILE #================================================= @@ -150,8 +156,13 @@ ynh_replace_string --match_string="__LANGUAGE__" --replace_string="$language" -- #================================================= ynh_script_progression --message="Deploying..." +update-alternatives --set php /usr/bin/php$phpversion + pushd "$final_path" - php$phpversion artisan monica:update --force + ynh_use_nodejs + ynh_exec_warn_less ynh_exec_as $app $ynh_node_load_PATH yarn install + ynh_exec_warn_less ynh_exec_as $app $ynh_node_load_PATH yarn run production + ynh_exec_warn_less ynh_exec_as $app php$phpversion artisan setup:production --force popd if [ -f $final_path/storage/oauth-private.key ]; then @@ -161,36 +172,36 @@ if [ -f $final_path/storage/oauth-private.key ]; then ynh_replace_string --match_string="__MOBILE_KEY__" --replace_string="$mobile_key" --target_file="$config" else pushd "$final_path" - php$phpversion artisan passport:keys - php$phpversion artisan passport:client --password -n > key.txt + ynh_exec_warn_less ynh_exec_as $app php$phpversion artisan passport:keys + ynh_exec_warn_less ynh_exec_as $app php$phpversion artisan passport:client --password -n > key.txt mobile_id=$( tail -2 key.txt | head -1 | cut -c 12- ) mobile_key=$( tail -1 key.txt | cut -c 16- ) ynh_replace_string --match_string="__MOBILE_ID__" --replace_string="$mobile_id" --target_file="$config" ynh_replace_string --match_string="__MOBILE_KEY__" --replace_string="$mobile_key" --target_file="$config" ynh_app_setting_set --app=$app --key=mobile_id --value=$mobile_id ynh_app_setting_set --app=$app --key=mobile_key --value=$mobile_key - rm -f key.txt + ynh_secure_remove --file="$final_path/key.txt" popd fi +pushd "$final_path" + ynh_exec_warn_less ynh_exec_as $app php$phpversion artisan config:cache +popd if ynh_version_gt "2.15.0" "${previous_version}" ; then ynh_script_progression --message="Upgrading for 2.15.0..." pushd "$final_path" - php$phpversion artisan monica:moveavatarstophotosdirectory + ynh_exec_warn_less ynh_exec_as $app php$phpversion artisan monica:moveavatarstophotosdirectory popd fi -#================================================= -# STORE THE CONFIG FILE CHECKSUM -#================================================= -ynh_script_progression --message="Storing the config file checksum..." - # Calculate and store the config file checksum into the app settings ynh_store_file_checksum --file="$config" chmod 400 "$config" chown $app:$app "$config" +update-alternatives --set php /usr/bin/php${YNH_DEFAULT_PHP_VERSION} + #================================================= # GENERIC FINALIZATION #=================================================