mirror of
https://github.com/YunoHost-Apps/aeneria_ynh.git
synced 2024-09-03 18:06:15 +02:00
commit
82d3e74618
11 changed files with 34 additions and 84 deletions
|
@ -56,8 +56,7 @@ But don't worry, you can easilly transfer your data from Pilea to æneria follow
|
|||
|
||||
---
|
||||
|
||||
Developer info
|
||||
----------------
|
||||
## Developer info
|
||||
|
||||
Please send your pull request to the [testing branch](https://github.com/YunoHost-Apps/aeneria_ynh/tree/testing).
|
||||
|
||||
|
|
|
@ -19,8 +19,6 @@
|
|||
incorrect_path=1
|
||||
port_already_use=0
|
||||
change_url=1
|
||||
;;; Levels
|
||||
Level 5=auto
|
||||
;;; Options
|
||||
Email=
|
||||
Notification=change
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
###> symfony/framework-bundle ###
|
||||
APP_ENV=prod
|
||||
APP_SECRET=app_secret
|
||||
APP_SECRET=__DESKEY__
|
||||
#TRUSTED_PROXIES=127.0.0.1,127.0.0.2
|
||||
#TRUSTED_HOSTS='^localhost|example\.com$'
|
||||
###< symfony/framework-bundle ###
|
||||
|
@ -11,7 +11,7 @@ APP_SECRET=app_secret
|
|||
# For MySQL database use: "mysql://[database_user]:[database_password]@127.0.0.1:3306/[database_name]
|
||||
# For an SQLite database, use: "sqlite:///%kernel.project_dir%/var/data.db"
|
||||
# Configure your db driver and server_version in config/packages/doctrine.yaml
|
||||
DATABASE_URL=pgsql://database_user:database_password@localhost:5432/database_name
|
||||
DATABASE_URL=pgsql://__DB_NAME__:__DB_PWD__@localhost:5432/__DB_NAME__
|
||||
###< doctrine/doctrine-bundle ###
|
||||
|
||||
### aeneria features ###
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
SOURCE_URL=https://statics.aeneria.com/aeneria-app-1.1.3.tar.gz
|
||||
SOURCE_SUM=50194f003c1fcbf605875464a25f27ed1a439ce09fd0404ce400ae96e8e76d9f
|
||||
SOURCE_SUM=1fcf26a7ceedc9acad0e9fc8302706f09e234949b148629875e827b151cd3d1b
|
||||
SOURCE_SUM_PRG=sha256sum
|
||||
SOURCE_FORMAT=tar.gz
|
||||
SOURCE_IN_SUBDIR=true
|
||||
|
|
|
@ -3,7 +3,7 @@ app=APPNAMETOCHANGE
|
|||
|
||||
# Source YunoHost helpers
|
||||
source /usr/share/yunohost/helpers
|
||||
source /etc/yunohost/apps/$app/scripts/ynh_exec_as
|
||||
source /etc/yunohost/apps/$app/scripts/_common.sh
|
||||
|
||||
# Retrieve arguments
|
||||
username=$1
|
||||
|
|
|
@ -3,7 +3,7 @@ app=APPNAMETOCHANGE
|
|||
|
||||
# Source YunoHost helpers
|
||||
source /usr/share/yunohost/helpers
|
||||
source /etc/yunohost/apps/$app/scripts/ynh_exec_as
|
||||
source /etc/yunohost/apps/$app/scripts/_common.sh
|
||||
|
||||
# Retrieve arguments
|
||||
username=$1
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
"id": "aeneria",
|
||||
"packaging_format": 1,
|
||||
"description": {
|
||||
"en": "A little dashboard to analyse your energy consumption data from Linky & weather",
|
||||
"fr": "Un petit tableau de bord pour analyser votre consomation d'énergie à partir des données d'un Linky et de la météo"
|
||||
"en": "Dashboard to analyse your energy consumption data from Linky & weather",
|
||||
"fr": "Tableau de bord pour analyser votre consomation d'énergie à partir des données d'un Linky et de la météo"
|
||||
},
|
||||
"version": "1.1.3~ynh1",
|
||||
"url": "https://gitlab.com/aeneria/aeneria-app",
|
||||
|
@ -14,12 +14,12 @@
|
|||
"email": "bonjour@aeneria.com"
|
||||
},
|
||||
"requirements": {
|
||||
"yunohost": ">= 3.7"
|
||||
"yunohost": ">= 4.1.7"
|
||||
},
|
||||
"multi_instance": true,
|
||||
"services": [
|
||||
"nginx",
|
||||
"php7.0-fpm",
|
||||
"php7.3-fpm",
|
||||
"psql"
|
||||
],
|
||||
"arguments": {
|
||||
|
@ -27,29 +27,17 @@
|
|||
{
|
||||
"name": "domain",
|
||||
"type": "domain",
|
||||
"ask": {
|
||||
"en": "Choose a domain for aeneria",
|
||||
"fr": "Choisissez un domaine pour aeneria"
|
||||
},
|
||||
"example": "domain.org"
|
||||
},
|
||||
{
|
||||
"name": "path",
|
||||
"type": "path",
|
||||
"ask": {
|
||||
"en": "Choose a path for aeneria",
|
||||
"fr": "Choisissez un chemin pour aeneria"
|
||||
},
|
||||
"example": "/aeneria",
|
||||
"default": "/aeneria"
|
||||
},
|
||||
{
|
||||
"name": "is_public",
|
||||
"type": "boolean",
|
||||
"ask": {
|
||||
"en": "Is it a public website?",
|
||||
"fr": "Est-ce un site public ?"
|
||||
},
|
||||
"help": {
|
||||
"en": "Choose whether the app should be accessible only for your yunohost users or for everyone.",
|
||||
"fr": "Choisissez si l'application doit être accessible uniquement pour vos utilisateurs yunohost ou pour tout le monde."
|
||||
|
@ -59,10 +47,6 @@
|
|||
{
|
||||
"name": "admin",
|
||||
"type": "user",
|
||||
"ask": {
|
||||
"en": "Choose the aeneria administrator",
|
||||
"fr": "Choisissez l'administrateur de aeneria"
|
||||
},
|
||||
"example": "homer"
|
||||
}
|
||||
]
|
||||
|
|
|
@ -24,20 +24,15 @@ app=$YNH_APP_INSTANCE_NAME
|
|||
#=================================================
|
||||
# LOAD SETTINGS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Loading installation settings..." --time --weight=1
|
||||
ynh_script_progression --message="Loading installation settings..." --weight=1
|
||||
|
||||
# Needed for helper "ynh_add_nginx_config"
|
||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||
|
||||
# Add settings here as needed by your application
|
||||
#db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||
#db_user=$db_name
|
||||
#db_pwd=$(ynh_app_setting_get --app=$app --key=db_pwd)
|
||||
|
||||
#=================================================
|
||||
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
||||
#=================================================
|
||||
ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..." --time --weight=1
|
||||
ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..." --weight=1
|
||||
|
||||
# Backup the current version of the app
|
||||
ynh_backup_before_upgrade
|
||||
|
@ -72,7 +67,7 @@ fi
|
|||
#=================================================
|
||||
# MODIFY URL IN NGINX CONF
|
||||
#=================================================
|
||||
ynh_script_progression --message="Updating NGINX web server configuration..." --time --weight=1
|
||||
ynh_script_progression --message="Updating NGINX web server configuration..." --weight=3
|
||||
|
||||
nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf
|
||||
|
||||
|
@ -103,7 +98,7 @@ fi
|
|||
#=================================================
|
||||
# RELOAD NGINX
|
||||
#=================================================
|
||||
ynh_script_progression --message="Reloading NGINX web server..." --time --weight=1
|
||||
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
|
||||
|
||||
ynh_systemd_action --service_name=nginx --action=reload
|
||||
|
||||
|
@ -111,4 +106,4 @@ ynh_systemd_action --service_name=nginx --action=reload
|
|||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Change of URL completed for $app" --time --last
|
||||
ynh_script_progression --message="Change of URL completed for $app" --last
|
||||
|
|
|
@ -46,11 +46,9 @@ ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url
|
|||
ynh_script_progression --message="Storing installation settings..." --weight=1
|
||||
|
||||
ynh_app_setting_set --app=$app --key=domain --value=$domain
|
||||
ynh_app_setting_set --app=$app --key=path_url --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=is_public --value=$is_public
|
||||
ynh_app_setting_set --app=$app --key=deskey --value=$deskey
|
||||
ynh_app_setting_set --app=$app --key=phpversion --value=$YNH_PHP_VERSION
|
||||
|
||||
#=================================================
|
||||
# STANDARD MODIFICATIONS
|
||||
|
@ -85,7 +83,7 @@ ynh_setup_source --dest_dir="$final_path"
|
|||
#=================================================
|
||||
# NGINX CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring nginx web server..." --weight=1
|
||||
ynh_script_progression --message="Configuring NGINX web server..." --weight=1
|
||||
|
||||
# Create a dedicated nginx config
|
||||
ynh_add_nginx_config
|
||||
|
@ -101,7 +99,7 @@ ynh_system_user_create --username=$app
|
|||
#=================================================
|
||||
# PHP-FPM CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring php-fpm..." --weight=1
|
||||
ynh_script_progression --message="Configuring PHP-FPM..." --weight=1
|
||||
|
||||
# Create a dedicated php-fpm config
|
||||
ynh_add_fpm_config --usage=low --footprint=low --package="$extra_php_dependencies"
|
||||
|
@ -115,12 +113,8 @@ phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
|
|||
ynh_script_progression --message="Configuring aeneria..." --weight=1
|
||||
|
||||
aeneria_conf="$final_path/.env"
|
||||
cp ../conf/.env $aeneria_conf
|
||||
|
||||
ynh_replace_string --match_string="database_name" --replace_string="${db_name}" --target_file="$aeneria_conf"
|
||||
ynh_replace_string --match_string="database_user" --replace_string="${db_user}" --target_file="$aeneria_conf"
|
||||
ynh_replace_string --match_string="database_password" --replace_string="${db_pwd}" --target_file="$aeneria_conf"
|
||||
ynh_replace_string --match_string="app_secret" --replace_string="${deskey}" --target_file="$aeneria_conf"
|
||||
ynh_add_config --template="../conf/.env" --destination="$aeneria_conf"
|
||||
|
||||
# Restrict rights to aeneria user only
|
||||
chmod 600 "$aeneria_conf"
|
||||
|
@ -186,18 +180,18 @@ chmod 755 $final_path
|
|||
#=================================================
|
||||
# SETUP SSOWAT
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring SSOwat..." --weight=1
|
||||
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
|
||||
|
||||
#=================================================
|
||||
# RELOAD NGINX
|
||||
#=================================================
|
||||
ynh_script_progression --message="Reloading nginx web server..." --weight=1
|
||||
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
|
||||
|
||||
ynh_systemd_action --service_name=php$phpversion-fpm --action=reload
|
||||
ynh_systemd_action --service_name=nginx --action=reload
|
||||
|
|
|
@ -26,7 +26,6 @@ app=$YNH_APP_INSTANCE_NAME
|
|||
|
||||
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||
path_url=$(ynh_app_setting_get --app=$app --key=path)
|
||||
is_public=$(ynh_app_setting_get --app=$app --key=is_public)
|
||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||
db_user=$db_name
|
||||
|
|
|
@ -16,13 +16,9 @@ ynh_script_progression --message="Loading installation settings..." --weight=1
|
|||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
# Ensure php version is set
|
||||
ynh_app_setting_set --app=$app --key=phpversion --value=$YNH_PHP_VERSION
|
||||
|
||||
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||
path_url=$(ynh_app_setting_get --app=$app --key=path_url)
|
||||
path_url=$(ynh_app_setting_get --app=$app --key=path)
|
||||
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)
|
||||
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
|
||||
|
@ -42,12 +38,6 @@ upgrade_type=$(ynh_check_app_version_changed)
|
|||
#=================================================
|
||||
ynh_script_progression --message="Ensuring downward compatibility..."
|
||||
|
||||
# Compatibility with previous version
|
||||
if [ -z "$path_url" ] ; then
|
||||
path_url=$(ynh_app_setting_get --app="$app" --key=path)
|
||||
ynh_app_setting_set --app=$app --key=path_url --value="$path_url"
|
||||
fi
|
||||
|
||||
# If db_name doesn't exist, create it
|
||||
if [ -z "$db_name" ]; then
|
||||
db_name=$(ynh_sanitize_dbid --db_name=$app)
|
||||
|
@ -60,6 +50,13 @@ if [ -z "$final_path" ]; then
|
|||
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
|
||||
fi
|
||||
|
||||
# Cleaning legacy permissions
|
||||
if ynh_legacy_permissions_exists; then
|
||||
ynh_legacy_permissions_delete_all
|
||||
|
||||
ynh_app_setting_delete --app=$app --key=is_public
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
||||
#=================================================
|
||||
|
@ -105,7 +102,7 @@ fi
|
|||
#=================================================
|
||||
# NGINX CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Upgrading nginx web server configuration..." --weight=1
|
||||
ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=1
|
||||
|
||||
# Create a dedicated nginx config
|
||||
ynh_add_nginx_config
|
||||
|
@ -128,7 +125,7 @@ ynh_system_user_create --username=$app
|
|||
#=================================================
|
||||
# PHP-FPM CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Upgrading php-fpm configuration..." --weight=2
|
||||
ynh_script_progression --message="Upgrading PHP-FPM configuration..." --weight=2
|
||||
|
||||
# Create a dedicated php-fpm config
|
||||
ynh_add_fpm_config --usage=low --footprint=low --package="$extra_php_dependencies"
|
||||
|
@ -140,14 +137,9 @@ ynh_add_fpm_config --usage=low --footprint=low --package="$extra_php_dependencie
|
|||
#=================================================
|
||||
ynh_script_progression --message="Configuring aeneria..." --weight=1
|
||||
|
||||
# Copy and set aeneria dist configuration
|
||||
aeneria_conf="$final_path/.env"
|
||||
cp ../conf/.env $aeneria_conf
|
||||
|
||||
ynh_replace_string --match_string="database_name" --replace_string="${db_name}" --target_file="$aeneria_conf"
|
||||
ynh_replace_string --match_string="database_user" --replace_string="${db_user}" --target_file="$aeneria_conf"
|
||||
ynh_replace_string --match_string="database_password" --replace_string="${db_pwd}" --target_file="$aeneria_conf"
|
||||
ynh_replace_string --match_string="app_secret" --replace_string="${deskey}" --target_file="$aeneria_conf"
|
||||
ynh_add_config --template="../conf/.env" --destination="$aeneria_conf"
|
||||
|
||||
# Restrict rights to aeneria user only
|
||||
chmod 600 "$aeneria_conf"
|
||||
|
@ -217,21 +209,10 @@ ynh_script_progression --message="Securing files and directories..."
|
|||
chown -R $app: $final_path
|
||||
chmod 755 $final_path
|
||||
|
||||
#=================================================
|
||||
# SETUP SSOWAT
|
||||
#=================================================
|
||||
ynh_script_progression --message="Upgrading SSOwat configuration..."
|
||||
|
||||
# Make app public if necessary
|
||||
if [ $is_public -eq 1 ]
|
||||
then
|
||||
ynh_permission_update --permission "main" --add visitors
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# RELOAD NGINX
|
||||
#=================================================
|
||||
ynh_script_progression --message="Reloading nginx web server..." --weight=1
|
||||
ynh_script_progression --message="ReloadingNGINX web server..." --weight=1
|
||||
|
||||
ynh_systemd_action --service_name=nginx --action=reload
|
||||
|
||||
|
|
Loading…
Reference in a new issue