Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

æneria v2 #44

Merged
merged 34 commits into from
Jan 10, 2024
Merged
Show file tree
Hide file tree
Changes from 14 commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
b003562
Apapt for aeneria v2
SimonMellerin Dec 22, 2023
9e4a991
Auto-update README
yunohost-bot Dec 22, 2023
a2d777d
Fix install relative path
SimonMellerin Dec 22, 2023
ed3d213
Update nginx conf
SimonMellerin Dec 24, 2023
55db04d
Add upgrade warning: aeneria should be now install on a dedicated domain
SimonMellerin Jan 5, 2024
14f56ad
Auto-update README
yunohost-bot Jan 5, 2024
5b6b7df
test
SimonMellerin Jan 5, 2024
f8d933e
Add upgrade warning: aeneria should be now install on a dedicated domain
SimonMellerin Jan 5, 2024
b7e491b
Readd change_url script
SimonMellerin Jan 5, 2024
c3af24f
Fix pre upgrade doc filename
SimonMellerin Jan 5, 2024
06b167f
Fix upgrade script
SimonMellerin Jan 5, 2024
469d3f5
Fix upgrade script
SimonMellerin Jan 5, 2024
647a0dc
Update upstream app
SimonMellerin Jan 5, 2024
04d4edd
Auto-update README
yunohost-bot Jan 5, 2024
4b73677
Fix ldap patch
SimonMellerin Jan 7, 2024
b086c0c
remove useless hooks
SimonMellerin Jan 7, 2024
9bd6bef
Fix ldap patch
SimonMellerin Jan 7, 2024
0589491
fix upgrade script
SimonMellerin Jan 7, 2024
3e0304f
upadte ldap patch
SimonMellerin Jan 7, 2024
2147310
Update upstream app
SimonMellerin Jan 8, 2024
dbc4a80
Fix patch
SimonMellerin Jan 8, 2024
04b3c03
Keep private dir when upgrading
SimonMellerin Jan 8, 2024
5341c84
Fix typos
ericgaspar Jan 8, 2024
3f69864
Merge branch 'aeneria-v2' of https://github.com/YunoHost-Apps/aeneria…
ericgaspar Jan 8, 2024
d979002
Do not test install.subdir
SimonMellerin Jan 8, 2024
78de50e
Update upstream app
SimonMellerin Jan 8, 2024
20f4a5c
Update upstream app
SimonMellerin Jan 8, 2024
0b51702
Fix patch
SimonMellerin Jan 9, 2024
0dfeb79
fix manifest.toml
SimonMellerin Jan 9, 2024
adc2a72
fix ldap patch
SimonMellerin Jan 9, 2024
e3e1f62
Add php8.2-ldap dependency
SimonMellerin Jan 9, 2024
e4f5c7b
Update upstream app
SimonMellerin Jan 9, 2024
cf34229
Update manifest.toml
SimonMellerin Jan 9, 2024
2a88b0d
Auto-update README
yunohost-bot Jan 9, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,15 @@ The idea of [æneria](https://aeneria.com) is to display energy consumption and
* Analyse energy consumption throw weather data


**Shipped version:** 1.1.6~ynh5
**Shipped version:** 2.0.3~ynh1

**Demo:** https://demo.aeneria.com

## Screenshots

![Screenshot of æneria](./doc/screenshots/screenshot1.png)
![Screenshot of æneria](./doc/screenshots/preview-2.png)
![Screenshot of æneria](./doc/screenshots/preview-3.png)
![Screenshot of æneria](./doc/screenshots/preview-1.png)

## Documentation and resources

Expand Down
8 changes: 6 additions & 2 deletions README_fr.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,15 @@ L'idée de [æneria](https://aeneria.com) est d'afficher la consommation d'éner
* Mieux comprendre sa propre consommation d'énergie
* Analyser la consommation d'énergie et les données météorologiques

**Version incluse :** 1.1.6~ynh5
**Version incluse :** 2.0.3~ynh1

**Démo :** https://demo.aeneria.com

## Captures d’écran

![Capture d’écran de æneria](./doc/screenshots/screenshot1.png)
![Capture d’écran de æneria](./doc/screenshots/preview-2.png)
![Capture d’écran de æneria](./doc/screenshots/preview-3.png)
![Capture d’écran de æneria](./doc/screenshots/preview-1.png)

## Documentations et ressources

Expand Down
21 changes: 17 additions & 4 deletions conf/.env
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,23 @@ AENERIA_DEMO_MODE=0
# Welcome message
AENERIA_WELCOME_MESSAGE='<h1>Bienvenue sur æneria</h1>'

### Enedis Data Hub ###
# æneria proxy URL (no trailing slash !)
AENERIA_PROXY_URL=https://proxy.aeneria.com
# should the app use æneria proxy (1 for yes, 0 for no)
AENERIA_PROXY_FOR_ENEDIS=1
AENERIA_PROXY_FOR_GRDF=1

# Enedis Data Hub
ENEDIS_CLIENT_ID=noneed
ENEDIS_CLIENT_SECRET=noneed
ENEDIS_REDIRECT_URI=noneed
ENEDIS_ENDPOINT_AUTH=https://proxy.aeneria.com/enedis-data-connect
ENEDIS_ENDPOINT_TOKEN=https://proxy.aeneria.com/enedis-data-connect
ENEDIS_ENDPOINT_DATA=https://gw.prd.api.enedis.fr
ENEDIS_ENDPOINT_AUTH=noneed
ENEDIS_ENDPOINT_TOKEN=noneed
ENEDIS_ENDPOINT_DATA=noneed

# Grdf adict
GRDF_CLIENT_ID=noneed
GRDF_CLIENT_SECRET=noneed
GRDF_REDIRECT_URI=noneed
GRDF_ENDPOINT_AUTH=noneed
GRDF_ENDPOINT_DATA=noneed
19 changes: 6 additions & 13 deletions conf/nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,17 @@ location __PATH__/ {
client_body_timeout 60m;
proxy_read_timeout 60m;
fastcgi_read_timeout 60m;

# Common parameter to increase upload size limit in conjunction with dedicated php-fpm file
#client_max_body_size 50M;
client_max_body_size 50M;

try_files $uri @__NAME__;
location ~ ^__PATH__/index\.php(/|$) {
fastcgi_split_path_info ^(.+\.php)(/.*)$;
fastcgi_pass unix:/var/run/php/php__PHPVERSION__-fpm-__NAME__.sock;

location ~ ^__PATH__/index\.php(/|$) {
include fastcgi_params;
fastcgi_param REMOTE_USER $remote_user;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_split_path_info ^(.+\.php)(/.*)$;
fastcgi_param SCRIPT_FILENAME $request_filename;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param REMOTE_USER $remote_user;
fastcgi_pass unix:/var/run/php/php__PHPVERSION__-fpm-__NAME__.sock;
fastcgi_intercept_errors on;
}

Expand All @@ -36,8 +34,3 @@ location __PATH__/ {
location @__NAME__ {
rewrite ^ __PATH__/index.php/$is_args$args;
}

#for-subdir location __PATH__ {
#for-subdir return 301 __PATH__/;
#for-subdir }

6 changes: 6 additions & 0 deletions doc/PRE_UPGRADE.d/2.0.0~ynh1.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Since version 2, æneria must be installed under its own domain.

If æneria is currently installed under a path, before upgrading, change æneria URL:

* delete the path
* switch to a new dedicated domain (if needed)
Binary file added doc/screenshots/preview-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/screenshots/preview-2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/screenshots/preview-3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed doc/screenshots/screenshot1.png
Binary file not shown.
27 changes: 10 additions & 17 deletions manifest.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ packaging_format = 2

id = "aeneria"
name = "æneria"
description.en = "Dashboard to analyse your energy consumption data from Linky & weather"
description.fr = "Tableau de bord pour analyser votre consomation d'énergie à partir des données d'un Linky et de la météo"
description.en = "Dashboard to analyse your energy consumption data from Linky, Gazpar & weather"
description.fr = "Tableau de bord pour analyser votre consomation d'énergie à partir des données d'un compteur Linky et/ou Gazpar et de la météo"

version = "1.1.6~ynh5"
version = "2.0.3~ynh1"
SimonMellerin marked this conversation as resolved.
Show resolved Hide resolved

maintainers = ["Simon Mellerin"]

Expand All @@ -14,16 +14,14 @@ license = "AGPL-3.0-or-later"
website = "https://aeneria.com"
admindoc = "https://docs.aeneria.com"
code = "https://gitlab.com/aeneria/aeneria-app"
demo = "https://demo.aeneria.com"

[integration]
yunohost = ">= 11.2"
architectures = "all"
multi_instance = true

ldap = false

sso = false

ldap = true
sso = true
disk = "50M"
ram.build = "50M"
ram.runtime = "50M"
Expand All @@ -32,10 +30,6 @@ ram.runtime = "50M"
[install.domain]
type = "domain"

[install.path]
type = "path"
default = "/aeneria"
Comment on lines -35 to -37

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Weird, we can still change the path after the upgrade.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep, I saw that too, but if you try to put a path, I think it fails


[install.admin]
type = "user"

Expand All @@ -46,10 +40,9 @@ ram.runtime = "50M"
default = false

[resources]
[resources.sources.main]
url = "https://statics.aeneria.com/aeneria-app-1.1.6.tar.gz"
sha256 = "2923c3aee79a02154c2168537a18250abe6a3a84fd7b4a5f0309bd7ad604a98b"

[resources.sources.main]
url = "https://statics.aeneria.com/aeneria-app-2.0.3.tar.gz"
sha256 = "98322ac8074df007328e66cb9a5561e7e9bbbd8fefba5ef6a14cff54507e85c6"

[resources.system_user]

Expand All @@ -59,7 +52,7 @@ ram.runtime = "50M"
main.url = "/"

[resources.apt]
packages = "postgresql, apt-transport-https, postgresql-contrib, php7.4-zip, php7.4-pgsql, php7.4-xml, php7.4-intl, php7.4-mbstring, php7.4-gd, php7.4-curl, php7.4-bcmath, php7.4-opcache"
packages = "postgresql, apt-transport-https, postgresql-contrib, php8.2-zip, php8.2-pgsql, php8.2-xml, php8.2-intl, php8.2-gd, php8.2-curl, php8.2-bcmath, php8.2-opcache"

[resources.database]
type = "postgresql"
8 changes: 4 additions & 4 deletions scripts/_common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@
# hour: random value between 0 and 2
# These two variables are used in conf/aeneria.cron so that it runs every 3 hours starting at 00:MM, 01:MM, or 02:MM.
generate_random_minutes_hour () {
minutes="$(ynh_string_random --length=1 --filter=0-5)$(ynh_string_random --length=1 --filter=0-9)"
hour="$(ynh_string_random --length=1 --filter=0-2)"
ynh_app_setting_set --app=$app --key=minutes --value=$minutes
ynh_app_setting_set --app=$app --key=hour --value=$hour
minutes="$(ynh_string_random --length=1 --filter=0-5)$(ynh_string_random --length=1 --filter=0-9)"
hour="$(ynh_string_random --length=1 --filter=0-2)"
ynh_app_setting_set --app=$app --key=minutes --value=$minutes
ynh_app_setting_set --app=$app --key=hour --value=$hour
}

#=================================================
Expand Down
16 changes: 15 additions & 1 deletion scripts/change_url
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,20 @@
source _common.sh
source /usr/share/yunohost/helpers

#=================================================
# ENSURE DOWNWARD COMPATIBILITY
#=================================================

# Before version 2.x æneria could be installed under a path,
# this functionnality has been deprecated since version 2.0.0 and æneria
# now need to be installed under its own domain.
# If the app is currently installed under a path, we warn the admin
# that he should move the app under its own domain
if [ "$path" != "/" ]; then
ynh_die --message="Since version 2.0.0, $app need to be installed under its own domain. \
Before upgrading, change $app URL: delete the path and switch to a new domain if needed."
fi

#=================================================
# STANDARD MODIFICATIONS
#=================================================
Expand All @@ -22,4 +36,4 @@ ynh_change_url_nginx_config
# END OF SCRIPT
#=================================================

ynh_script_progression --message="Change of URL completed for $app" --last
ynh_script_progression --message="Change of URL completed for $app" --last
12 changes: 6 additions & 6 deletions scripts/install
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ ynh_script_progression --message="Setting up source files..." --weight=1
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$install_dir"

chmod -R o-rwx "$install_dir"
chown -R $app:www-data "$install_dir"
chmod -R 750 "$install_dir"

#=================================================
# SYSTEM CONFIGURATION
Expand Down Expand Up @@ -57,11 +57,11 @@ ynh_script_progression --message="Installing aeneria..." --weight=1

# Install aeneria
pushd $install_dir
ynh_exec_as $app php$phpversion bin/console aeneria:install "$app" -n
# Create admin user
mail=$(ynh_user_get_info --username="$admin" --key='mail')
ynh_exec_as $app php$phpversion bin/console aeneria:user:add "$mail" "$(ynh_string_random)" -n
ynh_exec_as $app php$phpversion bin/console aeneria:user:grant "$mail"
ynh_exec_as $app php$phpversion bin/console aeneria:install "$app" -n
# Create admin user
mail=$(ynh_user_get_info --username="$admin" --key='mail')
ynh_exec_as $app php$phpversion bin/console aeneria:user:add "$mail" "$(ynh_string_random)" -n
ynh_exec_as $app php$phpversion bin/console aeneria:user:grant "$mail"
popd

#=================================================
Expand Down
72 changes: 41 additions & 31 deletions scripts/upgrade
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,18 @@ ynh_script_progression --message="Ensuring downward compatibility..."

# If minutes or hour do not exist, create them
if [ -z "${minutes:-}" ] || [ -z "${hour:-}" ]; then
# Generate random running schedule, and save $hour and $minutes as app parameters
generate_random_minutes_hour
# Generate random running schedule, and save $hour and $minutes as app parameters
generate_random_minutes_hour
fi

# Before version 2.x æneria could be installed under a path,
# this functionnality has been deprecated since version 2.0.0 and æneria
# now need to be installed under its own domain.
# If the app is currently installed under a path, we warn the admin
# that he should move the app under its own domain
if [ "$path" != "/" ]; then
ynh_die --message="Since version 2.0.0, $app need to be installed under its own domain. \
Before upgrading, change $app URL: delete the path and switch to a new domain if needed."
fi

#=================================================
Expand All @@ -34,28 +44,28 @@ fi

if [ "$upgrade_type" == "UPGRADE_APP" ]
then
ynh_script_progression --message="Upgrading source files..."
ynh_script_progression --message="Upgrading source files..."

# For aeneria source update, we use a temporary directory because
# without it, patches can't be apply correctly:
# In 'app-00-ldap-auth.patch' we create a new file, if we try
# to apply the patch a second time while the file already exists, it
# throws a warning leading to an upgrade fail.
# For aeneria source update, we use a temporary directory because
# without it, patches can't be apply correctly:
# In 'app-00-ldap-auth.patch' we create a new file, if we try
# to apply the patch a second time while the file already exists, it
# throws a warning leading to an upgrade fail.

# Create tmpdir for new sources
tmpdir="$(ynh_smart_mktemp min_size=300)"
# Create tmpdir for new sources
tmpdir="$(ynh_smart_mktemp min_size=300)"

# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$tmpdir"
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$tmpdir"

# Replace the old aeneria by the new one
ynh_secure_remove --file="$install_dir"
mv "$tmpdir" "$install_dir"
ynh_secure_remove --file="$tmpdir"
# Replace the old aeneria by the new one
ynh_secure_remove --file="$install_dir"
mv "$tmpdir" "$install_dir"
ynh_secure_remove --file="$tmpdir"
fi

chmod -R o-rwx "$install_dir"
chown -R $app:www-data "$install_dir"
chmod -R 750 "$install_dir"

#=================================================
# REAPPLY SYSTEM CONFIGURATIONS
Expand Down Expand Up @@ -91,20 +101,20 @@ ynh_script_progression --message="Upgrading $app..." --weight=1

# Install dependencies and aeneria
pushd $install_dir
ynh_exec_as $app php$phpversion bin/console cache:clear -n
ynh_exec_as $app php$phpversion bin/console doctrine:migrations:migrate -n

# Set admin user
mail=$(ynh_user_get_info --username="$admin" --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

# Regenerate RSA keys
ynh_exec_as $app php$phpversion bin/console aeneria:generate-key --force -n
ynh_exec_as $app php$phpversion bin/console cache:clear -n
ynh_exec_as $app php$phpversion bin/console doctrine:migrations:migrate -n

# Set admin user
mail=$(ynh_user_get_info --username="$admin" --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

# Regenerate RSA keys
ynh_exec_as $app php$phpversion bin/console aeneria:generate-key -n
popd

#=================================================
Expand Down
Loading