1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/aeneria_ynh.git synced 2024-09-03 18:06:15 +02:00

Merge pull request #27 from YunoHost-Apps/example

Apply last example_ynh
This commit is contained in:
yalh76 2022-01-28 20:25:42 +01:00 committed by GitHub
commit 82bacd2127
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 182 additions and 94 deletions

View file

@ -1,22 +1,35 @@
<!--
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.
-->
# æneria for YunoHost
[![Integration level](https://dash.yunohost.org/integration/aeneria.svg)](https://dash.yunohost.org/appci/app/aeneria) ![](https://ci-apps.yunohost.org/ci/badges/aeneria.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/aeneria.maintain.svg)
[![Integration level](https://dash.yunohost.org/integration/aeneria.svg)](https://dash.yunohost.org/appci/app/aeneria) ![](https://ci-apps.yunohost.org/ci/badges/aeneria.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/aeneria.maintain.svg)
[![Install æneria with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=aeneria)
> *This package allows you to install æeneria quickly and simply on a YunoHost server.
*[Lire ce readme en français.](./README_fr.md)*
> *This package allows you to install æneria 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
The idea of [æneria](https://aeneria.com) is to display energy consumption and weather data on a little dashboard that allow the user to:
* Better understand our own energy consumption
* Analyse energy consumption throw weather data
**Shipped version:** 1.1.6
**Shipped version:** 1.1.6~ynh2
## Screenshots
![æneria startup screen](https://gitlab.com/aeneria/aeneria-app/-/raw/master/docs/img/dash_accueil.png)
![](./doc/screenshots/screenshot1.png)
## Disclaimers / important information
## Configuration
@ -25,10 +38,6 @@ The idea of [æneria](https://aeneria.com) is to display energy consumption and
* After that, install æneria to your Yunohost instance, visit it and just follow instructions
* That's it, now wait a bit to see data appear !
## Documentation
More information can be found on [æneria documentation](https://docs.aeneria.com).
## Comming from Pilea
æneria is the new name of Pilea. This new name came whith a brand new version.
@ -37,24 +46,13 @@ This new version introduced some breaking changes in data structure: migration f
But don't worry, you can easilly transfer your data from Pilea to æneria following [this documentation](https://docs.aeneria.com/fr/latest/administrateur/pilea_migration.html).
## YunoHost specific features
## Documentation and resources
* Integrate with YunoHost users and SSO
* Allow one user to be the administrator (set at the installation)
* Allow multiple instances of this application
#### Supported architectures
* x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/aeneria%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/aeneria/)
* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/aeneria%20%28Apps%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/aeneria/)
## Links
* æneria website: https://aeneria.com/
* æneria repo: https://gitlab.com/aeneria/aeneria-app
* YunoHost website: https://yunohost.org/
---
* Official app website: https://aeneria.com
* Official admin documentation: https://docs.aeneria.com
* Upstream app code repository: https://gitlab.com/aeneria/aeneria-app
* YunoHost documentation for this app: https://yunohost.org/app_aeneria
* Report a bug: https://github.com/YunoHost-Apps/aeneria_ynh/issues
## Developer info
@ -66,3 +64,5 @@ sudo yunohost app install https://github.com/YunoHost-Apps/aeneria_ynh/tree/test
or
sudo yunohost app upgrade aeneria -u https://github.com/YunoHost-Apps/aeneria_ynh/tree/testing --debug
```
**More info regarding app packaging:** https://yunohost.org/packaging_apps

64
README_fr.md Normal file
View file

@ -0,0 +1,64 @@
# æneria pour YunoHost
[![Niveau d'intégration](https://dash.yunohost.org/integration/aeneria.svg)](https://dash.yunohost.org/appci/app/aeneria) ![](https://ci-apps.yunohost.org/ci/badges/aeneria.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/aeneria.maintain.svg)
[![Installer æneria avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=aeneria)
*[Read this readme in english.](./README.md)*
*[Lire ce readme en français.](./README_fr.md)*
> *Ce package vous permet d'installer æneria 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
The idea of [æneria](https://aeneria.com) is to display energy consumption and weather data on a little dashboard that allow the user to:
* Better understand our own energy consumption
* Analyse energy consumption throw weather data
**Version incluse :** 1.1.6~ynh2
## Captures d'écran
![](./doc/screenshots/screenshot1.png)
## Avertissements / informations importantes
## Configuration
* First of all, you'll need a Linky and an [Enedis account](https://mon-compte-client.enedis.fr/)
* In your Enedis space, go to ["Gérer l'accès à mes données"](https://mon-compte-particulier.enedis.fr/donnees/) tab, and allow Enedis to collect and store your hourly consumption
* After that, install æneria to your Yunohost instance, visit it and just follow instructions
* That's it, now wait a bit to see data appear !
## Comming from Pilea
æneria is the new name of Pilea. This new name came whith a brand new version.
This new version introduced some breaking changes in data structure: migration from Pilea can't be done automaticly.
But don't worry, you can easilly transfer your data from Pilea to æneria following [this documentation](https://docs.aeneria.com/fr/latest/administrateur/pilea_migration.html).
## Documentations et ressources
* Site officiel de l'app : https://aeneria.com
* Documentation officielle de l'admin : https://docs.aeneria.com
* Dépôt de code officiel de l'app : https://gitlab.com/aeneria/aeneria-app
* Documentation YunoHost pour cette app : https://yunohost.org/app_aeneria
* Signaler un bug : https://github.com/YunoHost-Apps/aeneria_ynh/issues
## Informations pour les développeurs
Merci de faire vos pull request sur la [branche testing](https://github.com/YunoHost-Apps/aeneria_ynh/tree/testing).
Pour essayer la branche testing, procédez comme suit.
```
sudo yunohost app install https://github.com/YunoHost-Apps/aeneria_ynh/tree/testing --debug
ou
sudo yunohost app upgrade aeneria -u https://github.com/YunoHost-Apps/aeneria_ynh/tree/testing --debug
```
**Plus d'infos sur le packaging d'applications :** https://yunohost.org/packaging_apps

View file

@ -17,8 +17,8 @@ location __PATH__/ {
fastcgi_pass unix:/var/run/php/php__PHPVERSION__-fpm-__NAME__.sock;
include fastcgi_params;
fastcgi_param REMOTE_USER $remote_user;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param REMOTE_USER $remote_user;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param SCRIPT_FILENAME $request_filename;
fastcgi_intercept_errors on;
}

0
doc/.gitkeep Normal file
View file

4
doc/DESCRIPTION.md Normal file
View file

@ -0,0 +1,4 @@
The idea of [æneria](https://aeneria.com) is to display energy consumption and weather data on a little dashboard that allow the user to:
* Better understand our own energy consumption
* Analyse energy consumption throw weather data

14
doc/DISCLAIMER.md Normal file
View file

@ -0,0 +1,14 @@
## Configuration
* First of all, you'll need a Linky and an [Enedis account](https://mon-compte-client.enedis.fr/)
* In your Enedis space, go to ["Gérer l'accès à mes données"](https://mon-compte-particulier.enedis.fr/donnees/) tab, and allow Enedis to collect and store your hourly consumption
* After that, install æneria to your Yunohost instance, visit it and just follow instructions
* That's it, now wait a bit to see data appear !
## Comming from Pilea
æneria is the new name of Pilea. This new name came whith a brand new version.
This new version introduced some breaking changes in data structure: migration from Pilea can't be done automaticly.
But don't worry, you can easilly transfer your data from Pilea to æneria following [this documentation](https://docs.aeneria.com/fr/latest/administrateur/pilea_migration.html).

0
doc/screenshots/.gitkeep Normal file
View file

Binary file not shown.

After

Width:  |  Height:  |  Size: 71 KiB

View file

@ -8,6 +8,12 @@
},
"version": "1.1.6~ynh2",
"url": "https://gitlab.com/aeneria/aeneria-app",
"upstream": {
"license": "AGPL-3.0-or-later",
"website": "https://aeneria.com",
"admindoc": "https://docs.aeneria.com",
"code": "https://gitlab.com/aeneria/aeneria-app"
},
"license": "AGPL-3.0-or-later",
"maintainer": {
"name": "Simon Mellerin",
@ -23,7 +29,7 @@
"psql"
],
"arguments": {
"install" : [
"install": [
{
"name": "domain",
"type": "domain"
@ -34,6 +40,10 @@
"example": "/aeneria",
"default": "/aeneria"
},
{
"name": "admin",
"type": "user"
},
{
"name": "is_public",
"type": "boolean",
@ -42,10 +52,6 @@
"fr": "Choisissez si l'application doit être accessible uniquement pour vos utilisateurs yunohost ou pour tout le monde."
},
"default": false
},
{
"name": "admin",
"type": "user"
}
]
}

View file

@ -6,7 +6,7 @@
# IMPORT GENERIC HELPERS
#=================================================
#Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers
@ -55,7 +55,7 @@ ynh_backup --src_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
#=================================================
# SPECIFIC BACKUP
#=================================================
# BACKUP A CRON FILE
# BACKUP VARIOUS FILES
#=================================================
ynh_backup --src_path="/etc/cron.d/$app"

View file

@ -30,7 +30,7 @@ ynh_script_progression --message="Loading installation settings..." --weight=1
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
#=================================================
# 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)..." --weight=1

View file

@ -96,7 +96,7 @@ chown -R $app:www-data "$final_path"
#=================================================
ynh_script_progression --message="Configuring NGINX web server..." --weight=1
# Create a dedicated nginx config
# Create a dedicated NGINX config
ynh_add_nginx_config
#=================================================
@ -104,7 +104,7 @@ ynh_add_nginx_config
#=================================================
ynh_script_progression --message="Configuring PHP-FPM..." --weight=1
# Create a dedicated php-fpm config
# Create a dedicated PHP-FPM config
ynh_add_fpm_config --usage=low --footprint=low
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
@ -129,19 +129,19 @@ ynh_script_progression --message="Installing aeneria..." --weight=1
# Install aeneria
pushd $final_path
ynh_exec_as $app php$phpversion bin/console aeneria:install "$app" -n
ynh_exec_as $app php$phpversion bin/console aeneria:install "$app" -n
# Create aeneria's user
for username in $(ynh_user_list)
do
mail=$(ynh_user_get_info --username=$username --key='mail')
user_pass=$(ynh_string_random)
ynh_exec_as $app php$phpversion bin/console aeneria:user:add "$mail" "$user_pass"
done
# Create aeneria's user
for username in $(ynh_user_list)
do
mail=$(ynh_user_get_info --username=$username --key='mail')
user_pass=$(ynh_string_random)
ynh_exec_as $app php$phpversion bin/console aeneria:user:add "$mail" "$user_pass"
done
# Set admin user
mail=$(ynh_user_get_info --username=$admin --key='mail')
ynh_exec_as $app php$phpversion bin/console aeneria:user:grant "$mail"
# Set admin user
mail=$(ynh_user_get_info --username=$admin --key='mail')
ynh_exec_as $app php$phpversion bin/console aeneria:user:grant "$mail"
popd
#=================================================
@ -169,7 +169,7 @@ ynh_script_progression --message="Configuring permissions..." --weight=1
# Make app public if necessary
if [ $is_public -eq 1 ]
then
ynh_permission_update --permission="main" --add="visitors"
ynh_permission_update --permission="main" --add="visitors"
fi
#=================================================

View file

@ -31,14 +31,6 @@ ynh_script_progression --message="Removing the PSQL database..." --weight=1
# Remove a database if it exists, along with the associated user
ynh_psql_remove_db --db_user=$db_user --db_name=$db_name
#=================================================
# REMOVE DEPENDENCIES
#=================================================
ynh_script_progression --message="Removing dependencies..." --weight=1
# Remove metapackage and its dependencies
ynh_remove_app_dependencies
#=================================================
# REMOVE APP MAIN DIR
#=================================================
@ -52,7 +44,7 @@ ynh_secure_remove --file="$final_path"
#=================================================
ynh_script_progression --message="Removing NGINX web server configuration..." --weight=1
# Remove the dedicated nginx config
# Remove the dedicated NGINX config
ynh_remove_nginx_config
#=================================================
@ -60,15 +52,23 @@ ynh_remove_nginx_config
#=================================================
ynh_script_progression --message="Removing PHP-FPM configuration..." --weight=1
# Remove the dedicated php-fpm config
# Remove the dedicated PHP-FPM config
ynh_remove_fpm_config
#=================================================
# REMOVE DEPENDENCIES
#=================================================
ynh_script_progression --message="Removing dependencies..." --weight=1
# Remove metapackage and its dependencies
ynh_remove_app_dependencies
#=================================================
# SPECIFIC REMOVE
#=================================================
# REMOVE THE CRON FILE
# REMOVE VARIOUS FILES
#=================================================
ynh_script_progression --message="Removing the cron file..." --weight=1
ynh_script_progression --message="Removing various files..." --weight=1
# Remove a cron file
ynh_secure_remove --file="/etc/cron.d/$app"

View file

@ -6,7 +6,7 @@
# IMPORT GENERIC HELPERS
#=================================================
#Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
source ../settings/scripts/_common.sh
source /usr/share/yunohost/helpers
@ -20,7 +20,7 @@ ynh_abort_if_errors
#=================================================
# LOAD SETTINGS
#=================================================
ynh_script_progression --message="Loading settings..." --weight=1
ynh_script_progression --message="Loading installation settings..." --weight=1
app=$YNH_APP_INSTANCE_NAME
@ -44,7 +44,7 @@ test ! -d $final_path \
#=================================================
# RESTORE THE NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Restoring the nginx configuration..." --weight=1
ynh_script_progression --message="Restoring the NGINX web server configuration..." --weight=1
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
@ -70,7 +70,7 @@ chown -R $app:www-data "$final_path"
#=================================================
# RESTORE THE PHP-FPM CONFIGURATION
#=================================================
ynh_script_progression --message="Restoring PHP-FPM configuration..." --weight=1
ynh_script_progression --message="Restoring the PHP-FPM configuration..." --weight=1
# Restore the file first, so it can have a backup if different
ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
@ -100,9 +100,9 @@ ynh_psql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd
ynh_psql_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"
@ -111,7 +111,7 @@ ynh_restore_file --origin_path="/etc/cron.d/$app"
#=================================================
# RELOAD NGINX AND PHP-FPM
#=================================================
ynh_script_progression --message="Reloading nginx web server and php-fpm..." --weight=1
ynh_script_progression --message="Reloading NGINX web server and PHP-FPM..." --weight=1
ynh_systemd_action --service_name=php$phpversion-fpm --action=reload
ynh_systemd_action --service_name=nginx --action=reload

View file

@ -1,7 +1,7 @@
#!/bin/bash
#=================================================
# GENERIC STARTING
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
@ -41,12 +41,14 @@ ynh_script_progression --message="Backing up the app before upgrading (may take
# Backup the current version of the app
ynh_backup_before_upgrade
ynh_clean_setup () {
# restore it if the upgrade fails
# Restore it if the upgrade fails
ynh_restore_upgradebackup
}
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#=================================================
# STANDARD UPGRADE STEPS
#=================================================
# ENSURE DOWNWARD COMPATIBILITY
#=================================================
@ -66,9 +68,9 @@ fi
# Cleaning legacy permissions
if ynh_legacy_permissions_exists; then
ynh_legacy_permissions_delete_all
ynh_legacy_permissions_delete_all
ynh_app_setting_delete --app=$app --key=is_public
ynh_app_setting_delete --app=$app --key=is_public
fi
#=================================================
@ -79,8 +81,6 @@ 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
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
@ -116,7 +116,7 @@ chown -R $app:www-data "$final_path"
#=================================================
ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=1
# Create a dedicated nginx config
# Create a dedicated NGINX config
ynh_add_nginx_config
#=================================================
@ -131,7 +131,7 @@ ynh_exec_warn_less ynh_install_app_dependencies "$pkg_dependencies"
#=================================================
ynh_script_progression --message="Upgrading PHP-FPM configuration..." --weight=2
# Create a dedicated php-fpm config
# Create a dedicated PHP-FPM config
ynh_add_fpm_config --usage=low --footprint=low
#=================================================
@ -155,27 +155,27 @@ ynh_script_progression --message="Upgrading aeneria..." --weight=1
# Install dependencies and aeneria
pushd $final_path
ynh_exec_as $app php$phpversion bin/console cache:clear -n
ynh_exec_as $app php$phpversion bin/console doctrine:migrations:migrate -n
ynh_exec_as $app php$phpversion bin/console cache:clear -n
ynh_exec_as $app php$phpversion bin/console doctrine:migrations:migrate -n
# Create aeneria's user
for username in $(ynh_user_list)
do
mail=$(ynh_user_get_info --username=$username --key='mail')
user_exists=$(ynh_exec_as $app php$phpversion bin/console aeneria:user:exist "$mail")
if [ $user_exists -eq 0 ]
then
user_pass=$(ynh_string_random)
ynh_exec_as $app php$phpversion bin/console aeneria:user:add "$mail" "$user_pass" -n
fi
done
# Create aeneria's user
for username in $(ynh_user_list)
do
mail=$(ynh_user_get_info --username=$username --key='mail')
user_exists=$(ynh_exec_as $app php$phpversion bin/console aeneria:user:exist "$mail")
if [ $user_exists -eq 0 ]
then
user_pass=$(ynh_string_random)
ynh_exec_as $app php$phpversion bin/console aeneria:user:add "$mail" "$user_pass" -n
fi
done
# Set admin user
mail=$(ynh_user_get_info --username=$admin --key='mail')
ynh_exec_as $app php$phpversion bin/console aeneria:user:grant "$mail" -n
# Set admin user
mail=$(ynh_user_get_info --username=$admin --key='mail')
ynh_exec_as $app php$phpversion bin/console aeneria:user:grant "$mail" -n
# Regenerate RSA keys
ynh_exec_as $app php$phpversion bin/console aeneria:generate-key --force -n
# Regenerate RSA keys
ynh_exec_as $app php$phpversion bin/console aeneria:generate-key --force -n
popd
#=================================================