1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/monica_ynh.git synced 2024-09-03 19:46:23 +02:00

Merge pull request #55 from YunoHost-Apps/testing

Testing
This commit is contained in:
yalh76 2022-01-28 19:51:21 +01:00 committed by GitHub
commit a302e33995
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
24 changed files with 299 additions and 372 deletions

View file

@ -1,22 +1,24 @@
--- ---
name: Bug report name: Bug report
about: Create a report to help us debug, it would be nice to fill the template as much as you can to help us, help you and help us all. about: When creating a bug report, please use the following template to provide all the relevant information and help debugging efficiently.
--- ---
**How to post a meaningful bug report** **How to post a meaningful bug report**
1. *Read this whole template first.* 1. *Read this whole template first.*
2. *Determine if you are on the right place:* 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.* - *Otherwise, the issue may be due to the app itself. Refer to its documentation or repository for help.*
- *If you have a doubt, post here, we will figure it out together.* - *When in doubt, post here and we will figure it out together.*
3. *Delete the italic comments as you write over them below, and remove this guide.* 3. *Delete the italic comments as you write over them below, and remove this guide.*
--- ---
**Describe the bug** ### Describe the bug
*A clear and concise description of what the bug is.* *A clear and concise description of what the bug is.*
**Versions** ### Context
- Hardware: *VPS bought online / Old laptop or computer / Raspberry Pi at home / Internet Cube with VPN / Other ARM board / ...* - Hardware: *VPS bought online / Old laptop or computer / Raspberry Pi at home / Internet Cube with VPN / Other ARM board / ...*
- YunoHost version: x.x.x - YunoHost version: x.x.x
- I have access to my server: *Through SSH | through the webadmin | direct access via keyboard / screen | ...* - I have access to my server: *Through SSH | through the webadmin | direct access via keyboard / screen | ...*
@ -25,22 +27,29 @@ about: Create a report to help us debug, it would be nice to fill the template a
- Using, or trying to install package version/branch: - Using, or trying to install package version/branch:
- If upgrading, current package version: *can be found in the admin, or with `yunohost app info $app_id`* - If upgrading, current package version: *can be found in the admin, or with `yunohost app info $app_id`*
**To Reproduce** ### Steps to reproduce
*Steps to reproduce the behavior.*
- *If you performed a command from the CLI, the command itself is enough. For example:* - *If you performed a command from the CLI, the command itself is enough. For example:*
```sh ```sh
sudo yunohost app install monica sudo yunohost app install the_app
``` ```
- *If you used the webadmin, please perform the equivalent command from the CLI first.* - *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:* - *If the error occurs in your browser, explain what you did:*
1. *Go to '...'* 1. *Go to '...'*
2. *Click on '....'* 2. *Click on '...'*
3. *Scroll down to '....'* 3. *Scroll down to '...'*
4. *See error* 4. *See error*
**Expected behavior** ### Expected behavior
*A clear and concise description of what you expected to happen. You can remove this section if the command above is enough to understand your intent.* *A clear and concise description of what you expected to happen. You can remove this section if the command above is enough to understand your intent.*
**Logs** ### Logs
*After a failed command, YunoHost makes the log available to you, but also to others, thanks to `yunohost log display [log name] --share`. The actual command, with the correct log name, is displayed at the end of the failed attempt in the CLI. Execute it and copy here the share link it outputs.*
*When an operation fails, YunoHost provides a simple way to share the logs.*
- *In the webadmin, the error message contains a link to the relevant log page. On that page, you will be able to 'Share with Yunopaste'. If you missed it, the logs of previous operations are also available under Tools > Logs.*
- *In command line, the command to share the logs is displayed at the end of the operation and looks like `yunohost log display [log name] --share`. If you missed it, you can find the log ID of a previous operation using `yunohost log list`.*
*After sharing the log, please copypaste directly the link provided by YunoHost (to help readability, no need to copypaste the entire content of the log here, just the link is enough...)*
*If applicable and useful, add screenshots to help explain your problem.* *If applicable and useful, add screenshots to help explain your problem.*

16
.github/PULL_REQUEST_TEMPLATE.md vendored Normal file
View file

@ -0,0 +1,16 @@
## Problem
- *Description of why you made this PR*
## Solution
- *And how do you fix that problem*
## PR Status
- [ ] Code finished and ready to be reviewed/tested
- [ ] The fix/enhancement were manually tested (if applicable)
## Automatic tests
Automatic tests can be triggered on https://ci-apps-dev.yunohost.org/ *after creating the PR*, by commenting "!testme", "!gogogadgetoci" or "By the power of systemd, I invoke The Great App CI to test this Pull Request!". (N.B. : for this to work you need to be a member of the Yunohost-Apps organization)

2
.gitignore vendored
View file

@ -1,2 +0,0 @@
*~
*.sw[op]

Binary file not shown.

Before

Width:  |  Height:  |  Size: 142 KiB

View file

@ -1,59 +1,43 @@
# Monica app for YunoHost <!--
N.B.: This README was automatically generated by https://github.com/YunoHost/apps/tree/master/tools/README-generator
It shall NOT be edited by hand.
-->
# Monica for YunoHost
[![Integration level](https://dash.yunohost.org/integration/monica.svg)](https://dash.yunohost.org/appci/app/monica) ![](https://ci-apps.yunohost.org/ci/badges/monica.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/monica.maintain.svg) [![Integration level](https://dash.yunohost.org/integration/monica.svg)](https://dash.yunohost.org/appci/app/monica) ![](https://ci-apps.yunohost.org/ci/badges/monica.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/monica.maintain.svg)
[![Install Monica with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=monica) [![Install Monica with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=monica)
*[Lire ce readme en français.](./README_fr.md)*
> *This package allows you to install Monica quickly and simply on a YunoHost server. > *This package allows you to install Monica 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.* If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/install) to learn how to install it.*
## Overview ## Overview
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. 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
**Shipped version:** 2.17.0~ynh3
## Screenshots ## Screenshots
![](https://www.monicahq.com/img/contacts.png) ![](./doc/screenshots/screenshot1.png)
## Configuration ## Disclaimers / important information
Change the settings of the app by changing the values in .env * **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.
## YunoHost specific features ## Documentation and resources
#### 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.
#### Supported architectures
* x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/monica%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/monica/)
* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/monica%20%28Apps%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/monica/)
## Links
* Official app website: https://monicahq.com
* Upstream app code repository: https://github.com/monicahq/monica
* YunoHost documentation for this app: https://yunohost.org/app_monica
* Report a bug: https://github.com/YunoHost-Apps/monica_ynh/issues * Report a bug: https://github.com/YunoHost-Apps/monica_ynh/issues
* App website: https://monicahq.com/
* Upstream app repository: https://github.com/monicahq/monica
* YunoHost website: https://yunohost.org/
## Introduction ## Developer info
## What works?
* [X] Update and remove script
* [X] Upgrade script
* [X] Backup and restore script (**Need testing**)
* [X] Multi-instance (**Need testing**)
* [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
----------------
Please send your pull request to the [testing branch](https://github.com/YunoHost-Apps/monica_ynh/tree/testing). Please send your pull request to the [testing branch](https://github.com/YunoHost-Apps/monica_ynh/tree/testing).
@ -63,3 +47,5 @@ sudo yunohost app install https://github.com/YunoHost-Apps/monica_ynh/tree/testi
or or
sudo yunohost app upgrade monica -u https://github.com/YunoHost-Apps/monica_ynh/tree/testing --debug sudo yunohost app upgrade monica -u https://github.com/YunoHost-Apps/monica_ynh/tree/testing --debug
``` ```
**More info regarding app packaging:** https://yunohost.org/packaging_apps

47
README_fr.md Normal file
View file

@ -0,0 +1,47 @@
# Monica pour YunoHost
[![Niveau d'intégration](https://dash.yunohost.org/integration/monica.svg)](https://dash.yunohost.org/appci/app/monica) ![](https://ci-apps.yunohost.org/ci/badges/monica.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/monica.maintain.svg)
[![Installer Monica avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=monica)
*[Read this readme in english.](./README.md)*
*[Lire ce readme en français.](./README_fr.md)*
> *Ce package vous permet d'installer Monica rapidement et simplement sur un serveur YunoHost.
Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour savoir comment l'installer et en profiter.*
## Vue d'ensemble
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
## Captures d'écran
![](./doc/screenshots/screenshot1.png)
## Avertissements / informations importantes
* **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.
## 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
## Informations pour les développeurs
Merci de faire vos pull request sur la [branche testing](https://github.com/YunoHost-Apps/monica_ynh/tree/testing).
Pour essayer la branche testing, procédez comme suit.
```
sudo yunohost app install https://github.com/YunoHost-Apps/monica_ynh/tree/testing --debug
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

View file

@ -1,15 +1,10 @@
# See here for more informations
# https://github.com/YunoHost/package_check#syntax-check_process-file
# Move this file from check_process.default to check_process when you have filled it.
;; Test complet ;; Test complet
; Manifest ; Manifest
domain="domain.tld" (DOMAIN) domain="domain.tld"
path="/" (PATH) path="/"
admin="john" (USER) admin="john"
is_public=1 (PUBLIC|public=1|private=0)
language="fr" language="fr"
is_public=1
; Checks ; Checks
pkg_linter=1 pkg_linter=1
setup_sub_dir=0 setup_sub_dir=0
@ -19,18 +14,15 @@
setup_public=1 setup_public=1
upgrade=1 upgrade=1
# 2.14.0 # 2.14.0
upgrade=1 from_commit=36d8f49e08958c19f99eda858f83a64e98be7844 # upgrade=1 from_commit=36d8f49e08958c19f99eda858f83a64e98be7844
# 2.17.0~ynh1 # 2.17.0~ynh1
upgrade=1 from_commit=4b497cf6445fc515070265721f40ceb816864bf1 # upgrade=1 from_commit=4b497cf6445fc515070265721f40ceb816864bf1
# 2.17.0~ynh2
upgrade=1 from_commit=abd951313924e009a1e2c6dda5f78fe3a2564004
backup_restore=1 backup_restore=1
multi_instance=1 multi_instance=1
# This test is no longer necessary since the version 2.7 (PR: https://github.com/YunoHost/yunohost/pull/304), you can still do it if your app could be installed with this version.
# incorrect_path=1
port_already_use=0 port_already_use=0
change_url=0 change_url=0
;;; Levels
# If the level 5 (Package linter) is forced to 1. Please add justifications here.
Level 5=auto
;;; Options ;;; Options
Email=anmol@datamol.org Email=anmol@datamol.org
Notification=change Notification=change
@ -39,3 +31,5 @@ Notification=change
name=2.14.0 name=2.14.0
; commit=4b497cf6445fc515070265721f40ceb816864bf1 ; commit=4b497cf6445fc515070265721f40ceb816864bf1
name=2.17.0~ynh1 name=2.17.0~ynh1
; commit=abd951313924e009a1e2c6dda5f78fe3a2564004
name=2.17.0~ynh2

View file

@ -13,8 +13,8 @@ APP_DEBUG=false
# The encryption key. This is the most important part of the application. Keep # The encryption key. This is the most important part of the application. Keep
# this secure otherwise, everyone will be able to access your application. # this secure otherwise, everyone will be able to access your application.
# Must be 32 characters long exactly. # Must be 32 characters long exactly.
# Use `php artisan key:generate` to generate a random key. # Use `php artisan key:generate` or `pwgen -s 32 1` to generate a random key.
APP_KEY=random_key APP_KEY=__RANDOM_KEY__
# Prevent information leakage by referring to IDs with hashIds instead of # Prevent information leakage by referring to IDs with hashIds instead of
# the actual IDs used in the database. # the actual IDs used in the database.
@ -31,9 +31,9 @@ DB_HOST=127.0.0.1
DB_PORT=3306 DB_PORT=3306
# You can use mysql unix socket if available, it overrides DB_HOST and DB_PORT values. # You can use mysql unix socket if available, it overrides DB_HOST and DB_PORT values.
#DB_UNIX_SOCKET=/var/run/mysqld/mysqld.sock #DB_UNIX_SOCKET=/var/run/mysqld/mysqld.sock
DB_DATABASE=yunobase DB_DATABASE=__DB_NAME__
DB_USERNAME=yunouser DB_USERNAME=__DB_USER__
DB_PASSWORD=yunopass DB_PASSWORD=__DB_PWD__
DB_PREFIX= DB_PREFIX=
DB_TEST_HOST=127.0.0.1 DB_TEST_HOST=127.0.0.1
DB_TEST_DATABASE=monica_test DB_TEST_DATABASE=monica_test
@ -52,13 +52,14 @@ MAIL_USERNAME=
MAIL_PASSWORD= MAIL_PASSWORD=
MAIL_ENCRYPTION= MAIL_ENCRYPTION=
# Outgoing emails will be sent with these identity # Outgoing emails will be sent with these identity
MAIL_FROM_ADDRESS=monica@yunodomain MAIL_FROM_ADDRESS=monica@__DOMAIN__
MAIL_FROM_NAME="Monica" MAIL_FROM_NAME="Monica"
APP_EMAIL_NEW_USERS_NOTIFICATION=yunomail # New registration notification sent to this email
APP_EMAIL_NEW_USERS_NOTIFICATION=__EMAIL__
# Default locale used in the application. # Default locale used in the application.
APP_DEFAULT_LOCALE=language APP_DEFAULT_LOCALE=__LANGUAGE__
# Ability to disable signups on your instance. # Ability to disable signups on your instance.
# Can be true or false. Default to false. # Can be true or false. Default to false.
@ -135,8 +136,8 @@ DAV_ENABLED=true
# This is to make sure that only the mobile application that you approve can # This is to make sure that only the mobile application that you approve can
# access the route to let your users sign in with their credentials # access the route to let your users sign in with their credentials
# Note: the official mobile application is not currently available on the stores. # Note: the official mobile application is not currently available on the stores.
MOBILE_CLIENT_ID=__IDENTITY__ MOBILE_CLIENT_ID=__MOBILE_ID__
MOBILE_CLIENT_SECRET=__KEY__ MOBILE_CLIENT_SECRET=__MOBILE_KEY__
# Allow to access general statistics about your instance through a public API # Allow to access general statistics about your instance through a public API
# call # call

View file

@ -4,3 +4,4 @@ SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=zip SOURCE_FORMAT=zip
SOURCE_IN_SUBDIR=true SOURCE_IN_SUBDIR=true
SOURCE_FILENAME=v2.17.0.zip SOURCE_FILENAME=v2.17.0.zip
SOURCE_EXTRACT=true

View file

@ -4,11 +4,6 @@ location ^~ __PATH__/ {
# Path to source # Path to source
alias __FINALPATH__/public/; alias __FINALPATH__/public/;
# Force usage of https
if ($scheme = http) {
rewrite ^ https://$server_name$request_uri? permanent;
}
index index.php; index index.php;
# Common parameter to increase upload size limit in conjunction with dedicated php-fpm file # Common parameter to increase upload size limit in conjunction with dedicated php-fpm file

0
doc/.gitkeep Normal file
View file

1
doc/DESCRIPTION.md Normal file
View file

@ -0,0 +1 @@
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.

1
doc/DISCLAIMER.md Normal file
View file

@ -0,0 +1 @@
* **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.

0
doc/screenshots/.gitkeep Normal file
View file

Binary file not shown.

After

Width:  |  Height:  |  Size: 431 KiB

View file

@ -5,8 +5,13 @@
"description": { "description": {
"en": " Personal Relationship Manager - a new kind of CRM to organize interactions with your friends and family." "en": " Personal Relationship Manager - a new kind of CRM to organize interactions with your friends and family."
}, },
"version": "2.17.0~ynh2", "version": "2.17.0~ynh3",
"url": "https://monicahq.com", "url": "https://monicahq.com",
"upstream": {
"license": "GPL-3.0",
"website": "https://monicahq.com",
"code": "https://github.com/monicahq/monica"
},
"license": "GPL-3.0", "license": "GPL-3.0",
"maintainer": { "maintainer": {
"name": "Sebastian Gumprich", "name": "Sebastian Gumprich",
@ -14,43 +19,29 @@
"url": "http://github.com/rndmh3ro/monica_ynh" "url": "http://github.com/rndmh3ro/monica_ynh"
}, },
"requirements": { "requirements": {
"yunohost": ">= 3.5" "yunohost": ">= 4.3.0"
}, },
"multi_instance": true, "multi_instance": true,
"services": [ "services": [
"nginx", "nginx",
"php7.0-fpm", "php7.3-fpm",
"mysql" "mysql"
], ],
"arguments": { "arguments": {
"install": [ "install": [
{ {
"name": "domain", "name": "domain",
"type": "domain", "type": "domain"
"ask": {
"en": "Choose a domain name for Monica",
"fr": "Choisissez un nom de domaine pour Monica"
},
"example": "monicahq.com"
}, },
{ {
"name": "path", "name": "path",
"type": "path", "type": "path",
"ask": {
"en": "Choose a path for Monica",
"fr": "Choisissez un chemin pour Monica"
},
"example": "/monica", "example": "/monica",
"default": "/monica" "default": "/monica"
}, },
{ {
"name": "admin", "name": "admin",
"type": "user", "type": "user"
"ask": {
"en": "Choose an admin user",
"fr": "Choisissez ladministrateur"
},
"example": "johndoe"
}, },
{ {
"name": "is_public", "name": "is_public",

View file

@ -1,18 +0,0 @@
## Problem
- *Description of why you made this PR*
## Solution
- *And how do you fix that problem*
## PR Status
- [ ] Code finished.
- [ ] Tested with Package_check.
- [ ] Fix or enhancement tested.
- [ ] Upgrade from last version tested.
- [ ] Can be reviewed and tested.
## Package_check results
---
*If you have access to [App Continuous Integration for packagers](https://yunohost.org/#/packaging_apps_ci) you can provide a link to the package_check results like below, replacing '-NUM-' in this link by the PR number and USERNAME by your username on the ci-apps-dev. Or you provide a screenshot or a pastebin of the results*
[![Build Status](https://ci-apps-dev.yunohost.org/jenkins/job/monica_ynh%20PR-NUM-%20(USERNAME)/badge/icon)](https://ci-apps-dev.yunohost.org/jenkins/job/monica_ynh%20PR-NUM-%20(USERNAME)/)

View file

@ -56,7 +56,7 @@ ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
ynh_backup --src_path="/etc/php/$phpversion/fpm/pool.d/$app.conf" ynh_backup --src_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
#================================================= #=================================================
# BACKUP A CRON FILE # BACKUP VARIOUS FILES
#================================================= #=================================================
ynh_backup --src_path="/etc/cron.d/$app" ynh_backup --src_path="/etc/cron.d/$app"

View file

@ -36,9 +36,9 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path)
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
#================================================= #=================================================
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP # BACKUP BEFORE CHANGE URL 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 # Backup the current version of the app
ynh_backup_before_upgrade ynh_backup_before_upgrade
@ -46,7 +46,7 @@ ynh_clean_setup () {
# Remove the new domain config file, the remove script won't do it as it doesn't know yet its location. # Remove the new domain config file, the remove script won't do it as it doesn't know yet its location.
ynh_secure_remove --file="/etc/nginx/conf.d/$new_domain.d/$app.conf" ynh_secure_remove --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
# restore it if the upgrade fails # Restore it if the upgrade fails
ynh_restore_upgradebackup ynh_restore_upgradebackup
} }
# Exit if an error occurs during the execution of the script # Exit if an error occurs during the execution of the script
@ -73,22 +73,23 @@ fi
#================================================= #=================================================
# MODIFY URL IN NGINX CONF # 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 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 ] if [ $change_path -eq 1 ]
then 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" 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" domain="$old_domain"
path_url="$new_path" path_url="$new_path"
# Create a dedicated nginx config # Create a dedicated NGINX config
ynh_add_nginx_config ynh_add_nginx_config
fi fi
# Change the domain for nginx # Change the domain for NGINX
if [ $change_domain -eq 1 ] if [ $change_domain -eq 1 ]
then then
# Delete file checksum for the old conf file location # Delete file checksum for the old conf file location
@ -101,15 +102,20 @@ fi
#================================================= #=================================================
# SPECIFIC MODIFICATIONS # SPECIFIC MODIFICATIONS
#================================================= #=================================================
# ...
#=================================================
# Run monica update # Run monica update
cd $final_path && sudo /usr/bin/php7.2 artisan monica:update --force pushd "$final_path"
/usr/bin/php$phpversion artisan monica:update --force
popd
#================================================= #=================================================
# GENERIC FINALISATION # GENERIC FINALISATION
#================================================= #=================================================
# RELOAD NGINX # 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 ynh_systemd_action --service_name=nginx --action=reload

View file

@ -7,7 +7,6 @@
#================================================= #=================================================
source _common.sh source _common.sh
source ynh_composer__2
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
#================================================= #=================================================
@ -50,7 +49,6 @@ ynh_script_progression --message="Storing installation settings..."
ynh_app_setting_set --app=$app --key=domain --value=$domain ynh_app_setting_set --app=$app --key=domain --value=$domain
ynh_app_setting_set --app=$app --key=path --value=$path_url ynh_app_setting_set --app=$app --key=path --value=$path_url
ynh_app_setting_set --app=$app --key=admin --value=$admin ynh_app_setting_set --app=$app --key=admin --value=$admin
ynh_app_setting_set --app=$app --key=is_public --value=$is_public
ynh_app_setting_set --app=$app --key=language --value=$language ynh_app_setting_set --app=$app --key=language --value=$language
ynh_app_setting_set --app=$app --key=random_key --value=$random_key ynh_app_setting_set --app=$app --key=random_key --value=$random_key
@ -63,6 +61,14 @@ ynh_script_progression --message="Installing dependencies..."
ynh_install_app_dependencies $pkg_dependencies ynh_install_app_dependencies $pkg_dependencies
#=================================================
# CREATE DEDICATED USER
#=================================================
ynh_script_progression --message="Configuring system user..."
# Create a system user
ynh_system_user_create --username=$app --home_dir=$final_path
#================================================= #=================================================
# CREATE A MYSQL DATABASE # CREATE A MYSQL DATABASE
#================================================= #=================================================
@ -82,28 +88,24 @@ ynh_app_setting_set --app=$app --key=final_path --value=$final_path
# Download, check integrity, uncompress and patch the source from app.src # Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$final_path" ynh_setup_source --dest_dir="$final_path"
chmod 750 "$final_path"
chmod -R o-rwx "$final_path"
chown -R $app:www-data "$final_path"
#================================================= #=================================================
# NGINX CONFIGURATION # 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 ynh_add_nginx_config
#=================================================
# CREATE DEDICATED USER
#=================================================
ynh_script_progression --message="Configuring system user..."
# Create a system user
ynh_system_user_create --username=$app
#================================================= #=================================================
# PHP-FPM CONFIGURATION # 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" ynh_add_fpm_config --usage=low --footprint=low --package="$extra_php_dependencies"
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
@ -117,21 +119,20 @@ ynh_script_progression --message="Installing composer dependencies..."
ynh_exec_warn_less ynh_install_composer --phpversion="$phpversion" --workdir="$final_path" ynh_exec_warn_less ynh_install_composer --phpversion="$phpversion" --workdir="$final_path"
#================================================= #=================================================
# MODIFY A CONFIG FILE # ADD A CONFIGURATION
#================================================= #=================================================
ynh_script_progression --message="Modifying a config file..." ynh_script_progression --message="Adding a configuration file..."
config="$final_path/.env" config="$final_path/.env"
cp ../conf/.env "$config" cp ../conf/.env "$config"
ynh_replace_string --match_string="__DOMAIN__" --replace_string="$domain" --target_file="$config" ynh_replace_string --match_string="__DOMAIN__" --replace_string="$domain" --target_file="$config"
ynh_replace_string --match_string="random_key" --replace_string="$random_key" --target_file="$config" ynh_replace_string --match_string="__RANDOM_KEY__" --replace_string="$random_key" --target_file="$config"
ynh_replace_string --match_string="yunouser" --replace_string="$db_name" --target_file="$config" ynh_replace_string --match_string="__DB_USER__" --replace_string="$db_name" --target_file="$config"
ynh_replace_string --match_string="yunopass" --replace_string="$db_pwd" --target_file="$config" ynh_replace_string --match_string="__DB_PWD__" --replace_string="$db_pwd" --target_file="$config"
ynh_replace_string --match_string="yunobase" --replace_string="$db_name" --target_file="$config" ynh_replace_string --match_string="__DB_NAME__" --replace_string="$db_name" --target_file="$config"
ynh_replace_string --match_string="yunomail" --replace_string="$email" --target_file="$config" ynh_replace_string --match_string="__EMAIL__" --replace_string="$email" --target_file="$config"
ynh_replace_string --match_string="yunodomain" --replace_string="$domain" --target_file="$config" ynh_replace_string --match_string="__LANGUAGE__" --replace_string="$language" --target_file="$config"
ynh_replace_string --match_string="language" --replace_string="$language" --target_file="$config"
#================================================= #=================================================
# DEPLOY # DEPLOY
@ -144,55 +145,46 @@ pushd "$final_path"
php$phpversion artisan passport:client --password -n > key.txt php$phpversion artisan passport:client --password -n > key.txt
mobile_id=$( cd $final_path && tail -2 key.txt | head -1 | cut -c 12- ) 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- ) mobile_key=$( cd $final_path && tail -1 key.txt | cut -c 16- )
ynh_replace_string --match_string="__IDENTITY__" --replace_string="$mobile_id" --target_file="$config" ynh_replace_string --match_string="__MOBILE_ID__" --replace_string="$mobile_id" --target_file="$config"
ynh_replace_string --match_string="__KEY__" --replace_string="$mobile_key" --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_id --value=$mobile_id
ynh_app_setting_set --app=$app --key=mobile_key --value=$mobile_key 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 popd
#=================================================
# 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 # Calculate and store the config file checksum into the app settings
ynh_store_file_checksum --file="$config" ynh_store_file_checksum --file="$config"
chmod 400 "$config"
chown $app:$app "$config"
#================================================= #=================================================
# INSTALL THE CRON FILE # INSTALL THE CRON FILE
#================================================= #=================================================
ynh_script_progression --message="Installing the cron file..." ynh_script_progression --message="Installing the cron file..."
echo "* * * * * -u $app /usr/bin/php7.2 $final_path/artisan schedule:run" > /tmp/cron$app echo "* * * * * -u $app /usr/bin/php$phpversion $final_path/artisan schedule:run" > /tmp/cron$app
mv /tmp/cron$app /etc/cron.d/$app mv /tmp/cron$app /etc/cron.d/$app
#================================================= #=================================================
# GENERIC FINALIZATION # GENERIC FINALIZATION
#=================================================
# SECURE FILES AND DIRECTORIES
#=================================================
ynh_script_progression --message="Securing files and directories..."
# Set permissions to app files
chown -R $app: $final_path
#================================================= #=================================================
# SETUP SSOWAT # SETUP SSOWAT
#================================================= #=================================================
ynh_script_progression --message="Configuring SSOwat..." ynh_script_progression --message="Configuring permissions..."
# Make app public if necessary # Make app public if necessary
if [ $is_public -eq 1 ] if [ $is_public -eq 1 ]
then then
# unprotected_uris allows SSO credentials to be passed anyway. # Everyone can access the app.
ynh_app_setting_set --app=$app --key=unprotected_uris --value="/" # The "main" permission is automatically created before the install script.
ynh_permission_update --permission="main" --add="visitors"
fi fi
#================================================= #=================================================
# RELOAD NGINX # 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 ynh_systemd_action --service_name=nginx --action=reload
@ -200,4 +192,4 @@ ynh_systemd_action --service_name=nginx --action=reload
# END OF SCRIPT # END OF SCRIPT
#================================================= #=================================================
ynh_script_progression --message="Installation of $app completed" --last ynh_script_progression --message="Installation of $app completed"

View file

@ -31,14 +31,6 @@ ynh_script_progression --message="Removing the MySQL database..."
# Remove a database if it exists, along with the associated user # Remove a database if it exists, along with the associated user
ynh_mysql_remove_db --db_user=$db_user --db_name=$db_name ynh_mysql_remove_db --db_user=$db_user --db_name=$db_name
#=================================================
# REMOVE DEPENDENCIES
#=================================================
ynh_script_progression --message="Removing dependencies..."
# Remove metapackage and its dependencies
ynh_remove_app_dependencies
#================================================= #=================================================
# REMOVE APP MAIN DIR # REMOVE APP MAIN DIR
#================================================= #=================================================
@ -50,25 +42,33 @@ ynh_secure_remove --file="$final_path"
#================================================= #=================================================
# REMOVE NGINX CONFIGURATION # 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 ynh_remove_nginx_config
#================================================= #=================================================
# REMOVE PHP-FPM CONFIGURATION # 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 ynh_remove_fpm_config
#=================================================
# REMOVE DEPENDENCIES
#=================================================
ynh_script_progression --message="Removing dependencies..."
# Remove metapackage and its dependencies
ynh_remove_app_dependencies
#================================================= #=================================================
# SPECIFIC REMOVE # SPECIFIC REMOVE
#================================================= #=================================================
# REMOVE THE CRON FILE # REMOVE VARIOUS FILES
#================================================= #=================================================
ynh_script_progression --message="Removing the cron file..." ynh_script_progression --message="Removing various files..."
# Remove a cron file # Remove a cron file
ynh_secure_remove --file="/etc/cron.d/$app" ynh_secure_remove --file="/etc/cron.d/$app"

View file

@ -23,7 +23,7 @@ ynh_abort_if_errors
#================================================= #=================================================
# LOAD SETTINGS # LOAD SETTINGS
#================================================= #=================================================
ynh_script_progression --message="Loading settings..." ynh_script_progression --message="Loading installation settings..."
app=$YNH_APP_INSTANCE_NAME app=$YNH_APP_INSTANCE_NAME
@ -39,8 +39,6 @@ phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
#================================================= #=================================================
ynh_script_progression --message="Validating restoration parameters..." ynh_script_progression --message="Validating restoration parameters..."
ynh_webpath_available --domain=$domain --path_url=$path_url \
|| ynh_die --message="Path not available: ${domain}${path_url}"
test ! -d $final_path \ test ! -d $final_path \
|| ynh_die --message="There is already a directory: $final_path " || ynh_die --message="There is already a directory: $final_path "
@ -49,10 +47,18 @@ test ! -d $final_path \
#================================================= #=================================================
# RESTORE THE NGINX CONFIGURATION # RESTORE THE NGINX CONFIGURATION
#================================================= #=================================================
ynh_script_progression --message="Restoring the nginx configuration..." ynh_script_progression --message="Restoring the NGINX web server configuration..."
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf" ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
# RECREATE THE DEDICATED USER
#=================================================
ynh_script_progression --message="Recreating the dedicated system user..."
# Create the dedicated user (if not existing)
ynh_system_user_create --username=$app --home_dir=$final_path
#================================================= #=================================================
# RESTORE THE APP MAIN DIR # RESTORE THE APP MAIN DIR
#================================================= #=================================================
@ -60,26 +66,18 @@ ynh_script_progression --message="Restoring the app main directory..."
ynh_restore_file --origin_path="$final_path" ynh_restore_file --origin_path="$final_path"
#================================================= chmod 750 "$final_path"
# RECREATE THE DEDICATED USER chmod -R o-rwx "$final_path"
#================================================= chown -R $app:www-data "$final_path"
ynh_script_progression --message="Recreating the dedicated system user..."
# Create the dedicated user (if not existing) config="$final_path/.env"
ynh_system_user_create --username=$app chmod 400 "$config"
chown $app:$app "$config"
#=================================================
# RESTORE USER RIGHTS
#=================================================
ynh_script_progression --message="Restoring user rights..."
# Restore permissions on app files
chown -R $app: $final_path
#================================================= #=================================================
# RESTORE THE PHP-FPM CONFIGURATION # RESTORE THE PHP-FPM CONFIGURATION
#================================================= #=================================================
ynh_script_progression --message="Restoring PHP-FPM configuration..." ynh_script_progression --message="Restoring the PHP-FPM configuration..."
ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf" ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
@ -106,9 +104,9 @@ ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd
ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql
#================================================= #=================================================
# RESTORE THE CRON FILE # RESTORE VARIOUS FILES
#================================================= #=================================================
ynh_script_progression --message="Restoring the cron file..." ynh_script_progression --message="Restoring various files..."
ynh_restore_file --origin_path="/etc/cron.d/$app" ynh_restore_file --origin_path="/etc/cron.d/$app"
@ -117,7 +115,7 @@ ynh_restore_file --origin_path="/etc/cron.d/$app"
#================================================= #=================================================
# RELOAD NGINX AND PHP-FPM # 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=php$phpversion-fpm --action=reload
ynh_systemd_action --service_name=nginx --action=reload ynh_systemd_action --service_name=nginx --action=reload

View file

@ -7,7 +7,6 @@
#================================================= #=================================================
source _common.sh source _common.sh
source ynh_composer__2
source ynh_package_version source ynh_package_version
source /usr/share/yunohost/helpers source /usr/share/yunohost/helpers
@ -21,10 +20,10 @@ app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get --app=$app --key=domain) domain=$(ynh_app_setting_get --app=$app --key=domain)
path_url=$(ynh_app_setting_get --app=$app --key=path) path_url=$(ynh_app_setting_get --app=$app --key=path)
admin=$(ynh_app_setting_get --app=$app --key=admin) admin=$(ynh_app_setting_get --app=$app --key=admin)
is_public=$(ynh_app_setting_get --app=$app --key=is_public)
final_path=$(ynh_app_setting_get --app=$app --key=final_path) final_path=$(ynh_app_setting_get --app=$app --key=final_path)
language=$(ynh_app_setting_get --app=$app --key=language) language=$(ynh_app_setting_get --app=$app --key=language)
db_name=$(ynh_app_setting_get --app=$app --key=db_name) db_name=$(ynh_app_setting_get --app=$app --key=db_name)
db_user=$db_name
db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd) db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
random_key=$(ynh_app_setting_get --app=$app --key=random_key) random_key=$(ynh_app_setting_get --app=$app --key=random_key)
email=$(ynh_user_get_info --username=$admin --key=mail) email=$(ynh_user_get_info --username=$admin --key=mail)
@ -36,32 +35,6 @@ ynh_script_progression --message="Checking version..."
upgrade_type=$(ynh_check_app_version_changed) upgrade_type=$(ynh_check_app_version_changed)
#=================================================
# ENSURE DOWNWARD COMPATIBILITY
#=================================================
ynh_script_progression --message="Ensuring downward compatibility..."
# Fix is_public as a boolean value
if [ "$is_public" = "Yes" ]; then
ynh_app_setting_set --app=$app --key=is_public --value=1
is_public=1
elif [ "$is_public" = "No" ]; then
ynh_app_setting_set --app=$app --key=is_public --value=0
is_public=0
fi
# If db_name doesn't exist, create it
if [ -z "$db_name" ]; then
db_name=$(ynh_sanitize_dbid --db_name=$app)
ynh_app_setting_set --app=$app --key=db_name --value=$db_name
fi
# If final_path doesn't exist, create it
if [ -z "$final_path" ]; then
final_path=/var/www/$app
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
fi
#================================================= #=================================================
# CHECK VERSION NUMBER # CHECK VERSION NUMBER
#================================================= #=================================================
@ -78,21 +51,34 @@ ynh_script_progression --message="Backing up the app before upgrading (may take
# Backup the current version of the app # Backup the current version of the app
ynh_backup_before_upgrade ynh_backup_before_upgrade
ynh_clean_setup () { ynh_clean_setup () {
# restore it if the upgrade fails # Restore it if the upgrade fails
ynh_restore_upgradebackup ynh_restore_upgradebackup
} }
# Exit if an error occurs during the execution of the script # Exit if an error occurs during the execution of the script
ynh_abort_if_errors ynh_abort_if_errors
#=================================================
# CHECK THE PATH
#=================================================
# Normalize the URL path syntax
path_url=$(ynh_normalize_url_path --path_url=$path_url)
#================================================= #=================================================
# STANDARD UPGRADE STEPS # STANDARD UPGRADE STEPS
#=================================================
# ENSURE DOWNWARD COMPATIBILITY
#=================================================
ynh_script_progression --message="Ensuring downward compatibility..."
# Cleaning legacy permissions
if ynh_legacy_permissions_exists; then
ynh_legacy_permissions_delete_all
ynh_app_setting_delete --app=$app --key=is_public
fi
#=================================================
# CREATE DEDICATED USER
#=================================================
ynh_script_progression --message="Making sure dedicated system user exists..."
# Create a dedicated user (if not existing)
ynh_system_user_create --username=$app --home_dir=$final_path
#================================================= #=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE # DOWNLOAD, CHECK AND UNPACK SOURCE
#================================================= #=================================================
@ -105,12 +91,16 @@ then
ynh_setup_source --dest_dir="$final_path" ynh_setup_source --dest_dir="$final_path"
fi fi
chmod 750 "$final_path"
chmod -R o-rwx "$final_path"
chown -R $app:www-data "$final_path"
#================================================= #=================================================
# NGINX CONFIGURATION # 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 ynh_add_nginx_config
#================================================= #=================================================
@ -120,20 +110,12 @@ ynh_script_progression --message="Upgrading dependencies..."
ynh_install_app_dependencies $pkg_dependencies ynh_install_app_dependencies $pkg_dependencies
#=================================================
# CREATE DEDICATED USER
#=================================================
ynh_script_progression --message="Making sure dedicated system user exists..."
# Create a dedicated user (if not existing)
ynh_system_user_create --username=$app
#================================================= #=================================================
# PHP-FPM CONFIGURATION # 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" ynh_add_fpm_config --usage=low --footprint=low --package="$extra_php_dependencies"
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
@ -144,27 +126,24 @@ phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
#================================================= #=================================================
ynh_script_progression --message="Updating php dependencies..." ynh_script_progression --message="Updating php dependencies..."
chown -R "$app": "$final_path"
ynh_exec_warn_less ynh_composer_exec --phpversion="$phpversion" --workdir="$final_path" --commands="update" ynh_exec_warn_less ynh_composer_exec --phpversion="$phpversion" --workdir="$final_path" --commands="update"
#================================================= #=================================================
# MODIFY A CONFIG FILE # UPDATE A CONFIG FILE
#================================================= #=================================================
ynh_script_progression --message="Modifying a config file..." ynh_script_progression --message="Updating a configuration file..."
config="$final_path/.env" config="$final_path/.env"
ynh_backup_if_checksum_is_different --file="$config" ynh_backup_if_checksum_is_different --file="$config"
cp ../conf/.env "$config" cp ../conf/.env "$config"
ynh_replace_string --match_string="random_key" --replace_string="$random_key" --target_file="$config"
ynh_replace_string --match_string="yunouser" --replace_string="$db_name" --target_file="$config"
ynh_replace_string --match_string="yunopass" --replace_string="$db_pwd" --target_file="$config"
ynh_replace_string --match_string="yunobase" --replace_string="$db_name" --target_file="$config"
ynh_replace_string --match_string="yunomail" --replace_string="$email" --target_file="$config"
ynh_replace_string --match_string="yunodomain" --replace_string="$domain" --target_file="$config"
ynh_replace_string --match_string="language" --replace_string="$language" --target_file="$config"
ynh_replace_string --match_string="__DOMAIN__" --replace_string="$domain" --target_file="$config" ynh_replace_string --match_string="__DOMAIN__" --replace_string="$domain" --target_file="$config"
ynh_replace_string --match_string="__RANDOM_KEY__" --replace_string="$random_key" --target_file="$config"
ynh_replace_string --match_string="__DB_USER__" --replace_string="$db_name" --target_file="$config"
ynh_replace_string --match_string="__DB_PWD__" --replace_string="$db_pwd" --target_file="$config"
ynh_replace_string --match_string="__DB_NAME__" --replace_string="$db_name" --target_file="$config"
ynh_replace_string --match_string="__EMAIL__" --replace_string="$email" --target_file="$config"
ynh_replace_string --match_string="__LANGUAGE__" --replace_string="$language" --target_file="$config"
#================================================= #=================================================
# DEPLOYMENT # DEPLOYMENT
@ -178,16 +157,16 @@ popd
if [ -f $final_path/storage/oauth-private.key ]; then if [ -f $final_path/storage/oauth-private.key ]; then
mobile_id=$(ynh_app_setting_get --app=$app --key=mobile_id) mobile_id=$(ynh_app_setting_get --app=$app --key=mobile_id)
mobile_key=$(ynh_app_setting_get --app=$app --key=mobile_key) mobile_key=$(ynh_app_setting_get --app=$app --key=mobile_key)
ynh_replace_string --match_string="__IDENTITY__" --replace_string="$mobile_id" --target_file="$config" ynh_replace_string --match_string="__MOBILE_ID__" --replace_string="$mobile_id" --target_file="$config"
ynh_replace_string --match_string="__KEY__" --replace_string="$mobile_key" --target_file="$config" ynh_replace_string --match_string="__MOBILE_KEY__" --replace_string="$mobile_key" --target_file="$config"
else else
pushd "$final_path" pushd "$final_path"
php$phpversion artisan passport:keys php$phpversion artisan passport:keys
php$phpversion artisan passport:client --password -n > key.txt php$phpversion artisan passport:client --password -n > key.txt
mobile_id=$( tail -2 key.txt | head -1 | cut -c 12- ) mobile_id=$( tail -2 key.txt | head -1 | cut -c 12- )
mobile_key=$( tail -1 key.txt | cut -c 16- ) mobile_key=$( tail -1 key.txt | cut -c 16- )
ynh_replace_string --match_string="__IDENTITY__" --replace_string="$mobile_id" --target_file="$config" ynh_replace_string --match_string="__MOBILE_ID__" --replace_string="$mobile_id" --target_file="$config"
ynh_replace_string --match_string="__KEY__" --replace_string="$mobile_key" --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_id --value=$mobile_id
ynh_app_setting_set --app=$app --key=mobile_key --value=$mobile_key ynh_app_setting_set --app=$app --key=mobile_key --value=$mobile_key
rm -f key.txt rm -f key.txt
@ -209,32 +188,15 @@ ynh_script_progression --message="Storing the config file checksum..."
# Calculate and store the config file checksum into the app settings # Calculate and store the config file checksum into the app settings
ynh_store_file_checksum --file="$config" ynh_store_file_checksum --file="$config"
chmod 400 "$config"
chown $app:$app "$config"
#================================================= #=================================================
# GENERIC FINALIZATION # GENERIC FINALIZATION
#=================================================
# SECURE FILES AND DIRECTORIES
#=================================================
ynh_script_progression --message="Securing files and directories..."
# Set permissions on app files
chown -R $app: $final_path
#=================================================
# SETUP SSOWAT
#=================================================
ynh_script_progression --message="Upgrading SSOwat configuration..."
# Make app public if necessary
if [ $is_public -eq 1 ]
then
# unprotected_uris allows SSO credentials to be passed anyway
ynh_app_setting_set --app=$app --key=unprotected_uris --value="/"
fi
#================================================= #=================================================
# RELOAD NGINX # 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 ynh_systemd_action --service_name=nginx --action=reload

View file

@ -1,53 +0,0 @@
#!/bin/bash
# Execute a command with Composer
#
# 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}"
COMPOSER_HOME="$workdir/.composer" \
php${phpversion} "$workdir/composer.phar" $commands \
-d "$workdir" --no-interaction
}
# Install and initialize Composer in the given directory
#
# usage: ynh_install_composer [--phpversion=phpversion] [--workdir=$final_path] [--install_args="--optimize-autoloader"]
# | 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=)
local phpversion
local workdir
local install_args
# Manage arguments with getopts
ynh_handle_getopts_args "$@"
workdir="${workdir:-$final_path}"
phpversion="${phpversion:-$YNH_PHP_VERSION}"
install_args="${install_args:-}"
curl -sS https://getcomposer.org/installer \
| COMPOSER_HOME="$workdir/.composer" \
php${phpversion} -- --install-dir="$workdir" \
|| ynh_die "Unable to install Composer."
# 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."
}