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

Cleaning up

This commit is contained in:
ericgaspar 2021-06-04 09:15:08 +02:00
parent 6bb42aee0d
commit 339e50d9d2
No known key found for this signature in database
GPG key ID: 574F281483054D44
5 changed files with 48 additions and 120 deletions

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
@ -18,7 +15,6 @@
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

@ -15,47 +15,31 @@
"url": "https://datamol.org"
},
"requirements": {
"yunohost": ">= 4.1.0"
"yunohost": ">= 4.2.0"
},
"multi_instance": true,
"services": ["nginx", "php7.0-fpm", "mysql"],
"services": ["nginx", "php7.4-fpm", "mysql"],
"arguments": {
"install": [
{
"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

@ -70,6 +70,14 @@ 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=$appp --home_dir="$final_path"
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
@ -87,14 +95,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
#=================================================
@ -118,36 +118,12 @@ 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"
random_key="$random_key"
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 purpose.Uncomment them once app gets support for LDAP. Put them directly in .env
ynh_add_config --template="../conf/.env" --destination="$final_path/.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
@ -176,11 +152,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

@ -82,6 +82,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=$appp --home_dir="$final_path"
#=================================================
# STANDARD UPGRADE STEPS
#=================================================
@ -157,14 +165,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
#=================================================
@ -190,32 +190,12 @@ 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"
random_key="$random_key"
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_add_config --template="../conf/.env" --destination="$final_path/.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
@ -255,11 +235,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