1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/firefly-iii_ynh.git synced 2024-09-03 18:36:13 +02:00

Merge pull request #41 from YunoHost-Apps/patch

Patch
This commit is contained in:
Éric Gaspar 2021-06-05 08:33:52 +02:00 committed by GitHub
commit 7ebad1b316
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
19 changed files with 267 additions and 329 deletions

View file

@ -1,6 +1,6 @@
---
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.
---
@ -8,15 +8,17 @@ about: Create a report to help us debug, it would be nice to fill the template a
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!*
- *Otherwise, the issue may be due to Firefly III itself. Refer to its documentation or repository for help.*
- *If you have a doubt, post here, we will figure it out together.*
- *Otherwise, the issue may be due to the app itself. Refer to its documentation or repository for help.*
- *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.*
---
**Describe the bug**
### Describe the bug
*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 / ...*
- YunoHost version: x.x.x
- I have access to my server: *Through SSH | through the webadmin | direct access via keyboard / screen | ...*
@ -25,11 +27,11 @@ 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:
- If upgrading, current package version: *can be found in the admin, or with `yunohost app info $app_id`*
**To Reproduce**
*Steps to reproduce the behavior.*
### Steps to reproduce
- *If you performed a command from the CLI, the command itself is enough. For example:*
```sh
sudo yunohost app install firefly-iii
sudo yunohost app install the_app
```
- *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:*
@ -38,9 +40,16 @@ about: Create a report to help us debug, it would be nice to fill the template a
3. *Scroll down to '...'*
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.*
**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.*
### Logs
*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.*

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)

View file

@ -1,55 +1,37 @@
<!--
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.
-->
# Firefly III for YunoHost
[![Integration level](https://dash.yunohost.org/integration/firefly-iii.svg)](https://dash.yunohost.org/appci/app/firefly-iii) ![](https://ci-apps.yunohost.org/ci/badges/firefly-iii.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/firefly-iii.maintain.svg)
[![Install Firefly III with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=firefly-iii)
[![Install Firefly III with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=firefly-iii)
*[Lire ce readme en français.](./README_fr.md)*
> *This package allows you to install Firefly III 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.*
## Overview
"Firefly III" is a (self-hosted) manager for your personal finances. It can help you keep track of your expenses and income, so you can spend less and save more. Firefly III supports the use of budgets, categories and tags. It can import data from external sources and it has many neat financial reports available. You can [read all about it in the main repository](https://github.com/firefly-iii/firefly-iii) and in the [official documentation](https://docs.firefly-iii.org/).
**Shipped version:** 5.4.6
Self-hosted financial manager.
**Shipped version:** 5.5.11~ynh2
**Demo:** https://demo.firefly-iii.org/login
## Screenshots
![](index.png)
![](./doc/screenshots/budget.png)
## Demo
* [Demo 1](https://demo.firefly-iii.org/login)
* [Demo 2](http://www.softaculous.com/softaculous/demos/Firefly_III)
## Documentation
* Official documentation: https://docs.firefly-iii.org/
## YunoHost specific features
#### Multi-user support
- The admin user should be the first user to log into Firefly III
- SSO is not working yet
- You will probably be warned about missing locale from your system. Once you change the language to those corresponding to your system, the warning will desapear
#### Supported architectures
* x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/firefly-iii%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/firefly-iii/)
* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/firefly-iii%20%28Apps%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/firefly-iii/)
## Links
## Documentation and resources
* Official app website: https://firefly-iii.org/
* Official admin documentation: https://docs.firefly-iii.org/
* Upstream app code repository: https://github.com/firefly-iii/firefly-iii
* YunoHost documentation for this app: https://yunohost.org/app_firefly-iii
* Report a bug: https://github.com/YunoHost-Apps/firefly-iii_ynh/issues
* App website: https://firefly-iii.org/
* Upstream app repository: https://github.com/firefly-iii/firefly-iii
* YunoHost website: https://yunohost.org/
TODO
- [ ] Make Firefly III admin user dependant of the user choosen at installation
- [ ] Make SSO work
- [ ] Define default language according to system language
---
## Developer info
@ -61,3 +43,5 @@ sudo yunohost app install https://github.com/YunoHost-Apps/firefly-iii_ynh/tree/
or
sudo yunohost app upgrade firefly-iii -u https://github.com/YunoHost-Apps/firefly-iii_ynh/tree/testing --debug
```
**More info regarding app packaging:** https://yunohost.org/packaging_apps

43
README_fr.md Normal file
View file

@ -0,0 +1,43 @@
# Firefly III pour YunoHost
[![Niveau d'intégration](https://dash.yunohost.org/integration/firefly-iii.svg)](https://dash.yunohost.org/appci/app/firefly-iii) ![](https://ci-apps.yunohost.org/ci/badges/firefly-iii.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/firefly-iii.maintain.svg)
[![Installer Firefly III avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=firefly-iii)
*[Read this readme in english.](./README.md)*
*[Lire ce readme en français.](./README_fr.md)*
> *Ce package vous permet d'installer Firefly III 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
Gestionnaire de finances personnelles.
**Version incluse :** 5.5.11~ynh2
**Démo :** https://demo.firefly-iii.org/login
## Captures d'écran
![](./doc/screenshots/budget.png)
## Documentations et ressources
* Site officiel de l'app : https://firefly-iii.org/
* Documentation officielle de l'admin : https://docs.firefly-iii.org/
* Dépôt de code officiel de l'app : https://github.com/firefly-iii/firefly-iii
* Documentation YunoHost pour cette app : https://yunohost.org/app_firefly-iii
* Signaler un bug : https://github.com/YunoHost-Apps/firefly-iii_ynh/issues
## Informations pour les développeurs
Merci de faire vos pull request sur la [branche testing](https://github.com/YunoHost-Apps/firefly-iii_ynh/tree/testing).
Pour essayer la branche testing, procédez comme suit.
```
sudo yunohost app install https://github.com/YunoHost-Apps/firefly-iii_ynh/tree/testing --debug
ou
sudo yunohost app upgrade firefly-iii -u https://github.com/YunoHost-Apps/firefly-iii_ynh/tree/testing --debug
```
**Plus d'infos sur le packaging d'applications :** https://yunohost.org/packaging_apps

Binary file not shown.

Before

Width:  |  Height:  |  Size: 402 KiB

BIN
cata.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 40 KiB

View file

@ -1,12 +1,9 @@
# See here for more informations
# https://github.com/YunoHost/package_check#syntax-check_process-file
;; Test complet
; Manifest
domain="domain.tld" (DOMAIN)
path="/path" (PATH)
admin="john" (USER)
is_public=1 (PUBLIC|public=1|private=0)
domain="domain.tld"
path="/path"
admin="john"
is_public=1
; Checks
pkg_linter=1
setup_sub_dir=1
@ -15,10 +12,9 @@
setup_private=1
setup_public=1
upgrade=1
upgrade=1 from_commit=231c5e281e9cafabd35d4a6ef3c27fec6f3c470f
upgrade=1 from_commit=5ee628f58c4f9ea6b6fd48d843453c47ed3d34e4
backup_restore=1
multi_instance=1
port_already_use=0
change_url=0
;;; Options
Email=anmol@datamol.org

View file

@ -12,7 +12,7 @@ SITE_OWNER=mail@example.com
# The encryption key for your sessions. Keep this very secure.
# Change it to a string of exactly 32 chars or use something like `php artisan key:generate` to generate it.
# If you use Docker or similar, you can set this variable from a file by using APP_KEY_FILE
APP_KEY=SomeRandomStringOf32CharsExactly
APP_KEY=__RANDOM_KEY__
# Firefly III will launch using this language (for new users and unauthenticated visitors)
# For a list of available languages: https://github.com/firefly-iii/firefly-iii/tree/main/resources/lang
@ -59,11 +59,11 @@ APP_LOG_LEVEL=notice
# Use "mysql" for MySQL and MariaDB.
# Use "sqlite" for SQLite.
DB_CONNECTION=mysql
DB_HOST=fireflyiiidb
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=firefly
DB_USERNAME=firefly
DB_PASSWORD=secret_firefly_password
DB_DATABASE=__DB_NAME__
DB_USERNAME=__DB_NAME__
DB_PASSWORD=__DB_PWD__
# MySQL supports SSL. You can configure it here.
# If you use Docker or similar, you can set these variables from a file by appending them with _FILE
@ -117,10 +117,10 @@ COOKIE_SECURE=false
# If you want Firefly III to mail you, update these settings
# For instructions, see: https://docs.firefly-iii.org/advanced-installation/email
# If you use Docker or similar, you can set these variables from a file by appending them with _FILE
MAIL_MAILER=log
MAIL_HOST=null
MAIL_PORT=2525
MAIL_FROM=changeme@example.com
MAIL_MAILER=smtp
MAIL_HOST=127.0.0.1
MAIL_PORT=25
MAIL_FROM=__EMAIL__
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
@ -212,10 +212,10 @@ ADLDAP_AUTO_CONNECT=true
# LDAP connection settings
# You can set the following variables from a file by appending them with _FILE:
# ADLDAP_CONTROLLERS, ADLDAP_PORT, ADLDAP_BASEDN
ADLDAP_CONTROLLERS=
ADLDAP_CONTROLLERS=127.0.0.1
ADLDAP_PORT=389
ADLDAP_TIMEOUT=5
ADLDAP_BASEDN=""
ADLDAP_BASEDN="dc=yunohost,dc=org"
ADLDAP_FOLLOW_REFFERALS=false
# SSL/TLS settings
@ -233,15 +233,15 @@ ADLDAP_ADMIN_USERNAME=
ADLDAP_ADMIN_PASSWORD=
# You can set the following variables from a file by appending them with _FILE:
ADLDAP_ACCOUNT_PREFIX=
ADLDAP_ACCOUNT_SUFFIX=
ADLDAP_ACCOUNT_PREFIX="uid="
ADLDAP_ACCOUNT_SUFFIX=",dc=yunohost,dc=org"
# LDAP authentication settings.
ADLDAP_PASSWORD_SYNC=false
ADLDAP_LOGIN_FALLBACK=false
ADLDAP_DISCOVER_FIELD=distinguishedname
ADLDAP_AUTH_FIELD=distinguishedname
ADLDAP_DISCOVER_FIELD="uid"
ADLDAP_AUTH_FIELD="uid"
# field to sync as local username.
# You can set the following variable from a file by appending it with _FILE:
@ -326,4 +326,4 @@ FIREFLY_III_LAYOUT=v1
#
# If you're stuck I understand you get desperate but look SOMEWHERE ELSE.
#
APP_URL=http://localhost
APP_URL=http://__DOMAIN____PATH__

View file

@ -1,5 +1,5 @@
SOURCE_URL=https://github.com/firefly-iii/firefly-iii/archive/5.4.6.tar.gz
SOURCE_SUM=ff78e16c022662c0e0c29fa4092928257fedcf17d1801e0582191cfcd631e6a9
SOURCE_URL=https://github.com/firefly-iii/firefly-iii/archive/refs/tags/5.5.11.tar.gz
SOURCE_SUM=f98c28a8fa6800ce0f6a92e6de0ce4e58d363972590010fac736163fbf166983
SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=tar.gz
SOURCE_IN_SUBDIR=true

View file

Before

Width:  |  Height:  |  Size: 115 KiB

After

Width:  |  Height:  |  Size: 115 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

BIN
index.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 267 KiB

View file

@ -6,8 +6,15 @@
"en": "Self-hosted financial manager.",
"fr": "Gestionnaire de finances personnelles."
},
"version": "5.4.6~ynh2",
"version": "5.5.11~ynh2",
"url": "https://firefly-iii.org/",
"upstream": {
"license": "GPL-3.0-or-later",
"website": "https://firefly-iii.org/",
"demo": "https://demo.firefly-iii.org/login",
"admindoc": "https://docs.firefly-iii.org/",
"code": "https://github.com/firefly-iii/firefly-iii"
},
"license": "GPL-3.0-or-later",
"maintainer": {
"name": "Anmol Sharma",
@ -15,12 +22,12 @@
"url": "https://datamol.org"
},
"requirements": {
"yunohost": ">= 4.1.0"
"yunohost": ">= 4.2.0"
},
"multi_instance": true,
"services": [
"nginx",
"php7.0-fpm",
"php7.4-fpm",
"mysql"
],
"arguments": {
@ -28,38 +35,22 @@
{
"name": "domain",
"type": "domain",
"ask": {
"en": "Choose a domain for Firefly III",
"fr": "Choisissez un nom de domaine pour Firefly III"
},
"example": "example.com"
},
{
"name": "path",
"type": "path",
"ask": {
"en": "Choose a path for Firefly III",
"fr": "Choisissez un chemin pour Firefly III"
},
"example": "/example",
"default": "/firefly"
},
{
"name": "admin",
"type": "user",
"ask": {
"en": "Choose an admin user (should be a YunoHost registered user)",
"fr": "Choisissez ladministrateur (should be a YunoHost registered user)"
},
"example": "johndoe"
},
{
"name": "is_public",
"type": "boolean",
"ask": {
"en": "Is it a public application?",
"fr": "Est-ce une application publique ?"
},
"default": true
}
]

View file

@ -1,16 +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
---
* An automatic package_check will be launch at https://ci-apps-dev.yunohost.org/, when you add a specific comment to your Pull Request: "!testme", "!gogogadgetoci" or "By the power of systemd, I invoke The Great App CI to test this Pull Request!"*

View file

@ -5,12 +5,19 @@
#=================================================
# dependencies used by the app
latest_tag=$(curl -s https://api.github.com/repos/firefly-iii/firefly-iii/releases/latest | grep 'tag_name' | cut -d\" -f4)
tag="5.5.11"
pkg_dependencies="redis-server"
YNH_PHP_VERSION="7.4"
extra_php_dependencies="php${YNH_PHP_VERSION}-zip php${YNH_PHP_VERSION}-mysql php${YNH_PHP_VERSION}-xml php${YNH_PHP_VERSION}-intl php${YNH_PHP_VERSION}-mbstring php${YNH_PHP_VERSION}-gd php${YNH_PHP_VERSION}-curl php${YNH_PHP_VERSION}-bcmath php${YNH_PHP_VERSION}-opcache php${YNH_PHP_VERSION}-ldap"
# Composer version
YNH_COMPOSER_VERSION="2.0.13"
#=================================================
# PERSONAL HELPERS
#=================================================

View file

@ -7,7 +7,6 @@
#=================================================
source _common.sh
source ynh_composer__2
source /usr/share/yunohost/helpers
#=================================================
@ -27,7 +26,7 @@ admin=$YNH_APP_ARG_ADMIN
is_public=$YNH_APP_ARG_IS_PUBLIC
random_key=$(ynh_string_random --length=32)
email=$(ynh_user_get_info --username=$admin --key=mail)
update=1
app=$YNH_APP_INSTANCE_NAME
#=================================================
@ -51,6 +50,7 @@ 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=is_public --value=$is_public
ynh_app_setting_set --app=$app --key=random_key --value=$random_key
ynh_app_setting_set --app=$app --key=update --value=$update
#=================================================
# INSTALL DEPENDENCIES
@ -69,14 +69,22 @@ db_user=$db_name
ynh_app_setting_set --app=$app --key=db_name --value=$db_name
ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name
#=================================================
# CREATE DEDICATED USER
#=================================================
ynh_script_progression --message="Configuring system user..."
# Create a system user
ynh_system_user_create --username=$app --home_dir="$final_path"
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
ynh_script_progression --message="Setting up source files..."
ynh_script_progression --message="Cloning Firefly-iii..."
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$final_path"
git clone -b $tag --depth 1 https://github.com/firefly-iii/firefly-iii.git $final_path
#=================================================
# NGINX CONFIGURATION
@ -86,14 +94,6 @@ ynh_script_progression --message="Configuring NGINX web server..."
# Create a dedicated 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
#=================================================
@ -117,36 +117,10 @@ ynh_exec_warn_less ynh_install_composer --phpversion="$phpversion" --workdir="$f
#=================================================
ynh_script_progression --message="Modifying a config file..."
config="$final_path/.env"
cp -f ../conf/.env "$config"
ynh_add_config --template="../conf/.env" --destination="$final_path/.env"
ynh_replace_string --match_string="SomeRandomStringOf32CharsExactly" --replace_string="$random_key" --target_file="$config"
ynh_replace_string --match_string="fireflyiiidb" --replace_string="127.0.0.1" --target_file="$config"
ynh_replace_string --match_string="DB_DATABASE=firefly" --replace_string="DB_DATABASE=$db_name" --target_file="$config"
ynh_replace_string --match_string="DB_USERNAME=firefly" --replace_string="DB_USERNAME=$db_name" --target_file="$config"
ynh_replace_string --match_string="secret_firefly_password" --replace_string="$db_pwd" --target_file="$config"
ynh_replace_string --match_string="MAIL_MAILER=log" --replace_string="MAIL_MAILER=smtp" --target_file="$config"
ynh_replace_string --match_string="MAIL_HOST=null" --replace_string="MAIL_HOST=127.0.0.1" --target_file="$config"
ynh_replace_string --match_string="MAIL_PORT=2525" --replace_string="MAIL_PORT=25" --target_file="$config"
ynh_replace_string --match_string="mail@example.com" --replace_string="$email" --target_file="$config"
ynh_replace_string --match_string="changeme@example.com" --replace_string="$app@$domain" --target_file="$config"
# These helpers are for reference to impliment remove them once app gets support for LDAP. Put them directly in .env
# ynh_replace_string --match_string="ADLDAP_CONTROLLERS=" --replace_string="ADLDAP_CONTROLLERS=127.0.0.1" --target_file="$config"
# ynh_replace_string --match_string='ADLDAP_BASEDN=""' --replace_string='ADLDAP_BASEDN="dc=yunohost,dc=org"' --target_file="$config"
# ynh_replace_string --match_string="ADLDAP_ACCOUNT_PREFIX=" --replace_string='ADLDAP_ACCOUNT_PREFIX="uid="' --target_file="$config"
# ynh_replace_string --match_string="ADLDAP_ACCOUNT_SUFFIX=" --replace_string='ADLDAP_ACCOUNT_SUFFIX=",dc=yunohost,dc=org"' --target_file="$config"
# ynh_replace_string --match_string="distinguishedname" --replace_string="uid" --target_file="$config"
# ynh_replace_string --match_string="userprincipalname" --replace_string="uid" --target_file="$config"
ynh_replace_string --match_string="localhost" --replace_string="$domain$path_url" --target_file="$config"
#=================================================
# 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 "$final_path/.env"
chown $app:$app "$final_path/.env"
#=================================================
# DEPLOY
@ -175,11 +149,7 @@ chmod -R 775 $final_path/storage
#=================================================
ynh_script_progression --message="Setuping a cron..."
cp ../conf/cron /etc/cron.d/$app
ynh_replace_string --match_string="__FINALPATH__" --replace_string="$final_path" --target_file="/etc/cron.d/$app"
ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="/etc/cron.d/$app"
ynh_replace_string --match_string="__PHPVERSION__" --replace_string="$phpversion" --target_file="/etc/cron.d/$app"
ynh_add_config --template="../conf/cron" --destination="/etc/cron.d/$app"
#=================================================
# SETUP LOGROTATE

View file

@ -50,20 +50,20 @@ ynh_script_progression --message="Restoring the NGINX configuration..."
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
# RESTORE THE APP MAIN DIR
#=================================================
ynh_script_progression --message="Restoring the app main directory..."
ynh_restore_file --origin_path="$final_path"
#=================================================
# 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
ynh_system_user_create --username=$app --home_dir="$final_path"
#=================================================
# RESTORE THE APP MAIN DIR
#=================================================
ynh_script_progression --message="Restoring the app main directory..."
ynh_restore_file --origin_path="$final_path"
#=================================================
# RESTORE USER RIGHTS

View file

@ -7,7 +7,6 @@
#=================================================
source _common.sh
source ynh_composer__2
source /usr/share/yunohost/helpers
#=================================================
@ -26,6 +25,7 @@ db_name=$(ynh_app_setting_get --app=$app --key=db_name)
db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
random_key=$(ynh_app_setting_get --app=$app --key=random_key)
email=$(ynh_user_get_info --username=$admin --key=mail)
update=$(ynh_app_setting_get --app=$app --key=update)
#=================================================
# CHECK VERSION
@ -39,15 +39,6 @@ upgrade_type=$(ynh_check_app_version_changed)
#=================================================
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)
@ -81,6 +72,14 @@ ynh_clean_setup () {
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#=================================================
# 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"
#=================================================
# STANDARD UPGRADE STEPS
#=================================================
@ -89,8 +88,22 @@ ynh_abort_if_errors
if [ "$upgrade_type" == "UPGRADE_APP" ]
then
if [ `cd $final_path && git rev-parse --is-inside-work-tree` ];
then
pushd "$final_path"
if [ $update -eq 1 ]
then
git fetch origin tag $latest_tag --no-tags
git checkout $latest_tag
else
git fetch origin tag $tag --no-tags
git checkout $tag
fi
ynh_secure_remove bootstrap/cache/*
ynh_secure_remove vendor/
popd
else
ynh_script_progression --message="Upgrading source files..."
# Create a temporary directory
tmpdir="$(mktemp -d)"
@ -99,21 +112,33 @@ then
mkdir -p "$tmpdir/storage/export"
mkdir -p "$final_path/storage/upload/"
mkdir -p "$final_path/storage/export/"
cp -a "$final_path/storage/upload/" "$tmpdir/storage/upload/"
cp -aT "$final_path/storage/upload" "$tmpdir/storage/upload/$"
cp -a "$final_path/.env" "$tmpdir/.env"
cp -a "$final_path/storage/export/" "$tmpdir/storage/export/"
cp -aT "$final_path/storage/export" "$tmpdir/storage/export/"
ynh_secure_remove --file="$final_path"
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$final_path"
if [ $update -eq 1 ]
then
# Restore the config file
cp -a "$tmpdir/storage/upload/" "$final_path/storage/upload/"
cp -a "$tmpdir/storage/export/" "$final_path/storage/export/"
git clone -b $latest_tag --depth 1 https://github.com/firefly-iii/firefly-iii.git $final_path
else
git clone -b $tag --depth 1 https://github.com/firefly-iii/firefly-iii.git $final_path
fi
ynh_secure_remove bootstrap/cache/*
# Restore the config file and data
mkdir -p "$final_path/storage/upload/"
mkdir -p "$final_path/storage/export/"
cp -aT "$tmpdir/storage/upload" "$final_path/storage/upload"
cp -aT "$tmpdir/storage/export" "$final_path/storage/export"
cp -a "$tmpdir/.env" "$final_path/.env"
# Remove temporary directory
ynh_secure_remove --file="$tmpdir"
fi
fi
#=================================================
# NGINX CONFIGURATION
@ -130,14 +155,6 @@ ynh_script_progression --message="Upgrading 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
#=================================================
@ -163,32 +180,10 @@ ynh_exec_warn_less ynh_install_composer --phpversion="$phpversion" --workdir="$f
#=================================================
ynh_script_progression --message="Modifying a config file..."
config="$final_path/.env"
ynh_backup_if_checksum_is_different --file="$config"
cp ../conf/.env "$config"
ynh_add_config --template="../conf/.env" --destination="$final_path/.env"
ynh_replace_string --match_string="SomeRandomStringOf32CharsExactly" --replace_string="$random_key" --target_file="$config"
ynh_replace_string --match_string="fireflyiiidb" --replace_string="127.0.0.1" --target_file="$config"
ynh_replace_string --match_string="DB_DATABASE=firefly" --replace_string="DB_DATABASE=$db_name" --target_file="$config"
ynh_replace_string --match_string="DB_USERNAME=firefly" --replace_string="DB_USERNAME=$db_name" --target_file="$config"
ynh_replace_string --match_string="secret_firefly_password" --replace_string="$db_pwd" --target_file="$config"
ynh_replace_string --match_string="MAIL_MAILER=log" --replace_string="MAIL_MAILER=smtp" --target_file="$config"
ynh_replace_string --match_string="MAIL_HOST=null" --replace_string="MAIL_HOST=127.0.0.1" --target_file="$config"
ynh_replace_string --match_string="MAIL_PORT=2525" --replace_string="MAIL_PORT=25" --target_file="$config"
ynh_replace_string --match_string="mail@example.com" --replace_string="$email" --target_file="$config"
ynh_replace_string --match_string="changeme@example.com" --replace_string="$app@$domain" --target_file="$config"
# These helpers are for reference.Remove them once app gets support for LDAP. Put them directly in .env
# ynh_replace_string --match_string="ADLDAP_CONTROLLERS=" --replace_string="ADLDAP_CONTROLLERS=127.0.0.1" --target_file="$config"
# ynh_replace_string --match_string='ADLDAP_BASEDN=""' --replace_string='ADLDAP_BASEDN="dc=yunohost,dc=org"' --target_file="$config"
# ynh_replace_string --match_string="ADLDAP_ACCOUNT_PREFIX=" --replace_string='ADLDAP_ACCOUNT_PREFIX="uid="' --target_file="$config"
# ynh_replace_string --match_string="ADLDAP_ACCOUNT_SUFFIX=" --replace_string='ADLDAP_ACCOUNT_SUFFIX=",dc=yunohost,dc=org"' --target_file="$config"
# ynh_replace_string --match_string="distinguishedname" --replace_string="uid" --target_file="$config"
# ynh_replace_string --match_string="userprincipalname" --replace_string="uid" --target_file="$config"
ynh_replace_string --match_string="localhost" --replace_string="$domain$path_url" --target_file="$config"
# Recalculate and store the checksum of the file for the next upgrade.
ynh_store_file_checksum --file="$config"
chmod 400 "$final_path/.env"
chown $app:$app "$final_path/.env"
#=================================================
# DEPLOYMENT
@ -228,11 +223,7 @@ chmod -R 775 $final_path/storage
#=================================================
ynh_script_progression --message="Setuping a cron..."
cp ../conf/cron /etc/cron.d/$app
ynh_replace_string --match_string="__FINALPATH__" --replace_string="$final_path" --target_file="/etc/cron.d/$app"
ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="/etc/cron.d/$app"
ynh_replace_string --match_string="__PHPVERSION__" --replace_string="$phpversion" --target_file="/etc/cron.d/$app"
ynh_add_config --template="../conf/cron" --destination="/etc/cron.d/$app"
#=================================================
# RELOAD NGINX

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."
}