first attempt at preseeding the app with user credentials

This commit is contained in:
Boudewijn 2025-03-02 22:19:18 +01:00
parent 418c941db9
commit adb5d3b94c
2 changed files with 16 additions and 26 deletions

View file

@ -4,7 +4,7 @@ packaging_format = 2
id = "my_idlers"
name = "My Idlers"
description.en = "A self-hosted web app for displaying, organizing and storing information about your servers (VPS/Dedi), shared & reseller hosting, seedboxes, domains, DNS and misc services."
description.en = "A self-hosted web app for displaying, organizing and storing information about your servers (VPS/Dedi), shared & reseller hosting, seedboxes, domains, DNS and misc services. Are you the person in your family, group of friends or at work who keeps an eye on everyones Yunohosts, then this is the app to help you."
description.fr = "Une application Web auto-hébergée pour afficher, organiser et stocker des informations sur vos serveurs (VPS/Dedi), votre hébergement partagé et revendeur, vos seedboxes, vos domaines, vos DNS et divers services."
version = "3.0~ynh1"
@ -46,12 +46,16 @@ ram.runtime = "100M"
default = "all_users"
# for now no credentials configured, make it install first
# [install.admin]
# type = "user"
# [install.password]
# help.en = "Use the help field to add an information for the admin about this question."
# help.fr = "Utilisez le champ aide pour ajouter une information à l'intention de l'administrateur à propos de cette question."
# type = "password"
[install.name]
help.en = "The name of the user"
type = "text"
[install.email]
help.en = "The email address used for logging in to the application"
type = "email"
[install.password]
help.en = "Use the help field to add an information for the admin about this question."
help.fr = "Utilisez le champ aide pour ajouter une information à l'intention de l'administrateur à propos de cette question."
type = "password"
[resources]
# See the packaging documentation for the full set

View file

@ -44,6 +44,9 @@ ynh_config_add --template=.env --destination="$install_dir/.env"
chmod 640 "$install_dir/.env"
chown "$app:www-data" "$install_dir/.env"
# Inject CreateUser.php into app/Console/Commands/ to extend the upstream version with this functionality
# Using this, we can create the user with the credentials provided
ynh_config_add --template=CreateUser.php --destination="$install_dir/app/Console/Commands/CreateUser.php"
#=================================================
# SYSTEM CONFIGURATION
@ -97,7 +100,7 @@ pushd "$install_dir"
"php$php_version" artisan migrate:fresh --seed -n --force
"php$php_version" artisan config:clear -n
"php$php_version" artisan config:cache -n
#"php$php_version" artisan lychee:create_user "$admin" "$password"
"php$php_version" artisan app:create-user "$name" "$email" "$password"
popd
@ -122,24 +125,7 @@ chmod -R 2775 "$install_dir/storage" "$install_dir/app" "$install_dir/public" "$
# Installation with curl
ynh_script_progression "Finalizing installation..."
#ynh_local_curl "/INSTALL_PATH" "key1=value1" "key2=value2" "key3=value3"
#=================================================
# START SYSTEMD SERVICE
#=================================================
ynh_script_progression "Starting $app's systemd service..."
### `ynh_systemctl` is used to start a systemd service for an app.
### Only needed if you have configure a systemd service
### If you're not using these lines:
### - Remove the section "STOP SYSTEMD SERVICE" and "START SYSTEMD SERVICE" in the backup script
### - As well as the section "START SYSTEMD SERVICE" in the restore script
### - As well as the section"STOP SYSTEMD SERVICE" and "START SYSTEMD SERVICE" in the upgrade script
### - And the section "STOP SYSTEMD SERVICE" and "START SYSTEMD SERVICE" in the change_url script
# Start a systemd service
ynh_systemctl --service="nginx" --action="reload"
ynh_systemctl --service="php$php_version-fpm" --action="reload"
#ynh_local_curl "/INSTALL_PATH" "key1=$name" "key2=$email" "key3=$password" "key4=$password"
#=================================================
# END OF SCRIPT