mirror of
https://github.com/YunoHost-Apps/firefly-iii_ynh.git
synced 2024-09-03 18:36:13 +02:00
Merge pull request #1 from YunoHost-Apps/testing
Genrate random string by Yunohost command for .env
This commit is contained in:
commit
55103c1b24
3 changed files with 27 additions and 19 deletions
|
@ -11,7 +11,7 @@ SITE_OWNER=yunomail
|
||||||
# The encryption key for your database and sessions. Keep this very secure.
|
# The encryption key for your database and sessions. Keep this very secure.
|
||||||
# If you generate a new one all existing data must be considered LOST.
|
# If you generate a new one all existing data must be considered LOST.
|
||||||
# Change it to a string of exactly 32 chars or use command `php artisan key:generate` to generate it
|
# Change it to a string of exactly 32 chars or use command `php artisan key:generate` to generate it
|
||||||
APP_KEY=SomeRandomStringOf32CharsExactly
|
APP_KEY=random_key
|
||||||
|
|
||||||
# Change this value to your preferred time zone.
|
# Change this value to your preferred time zone.
|
||||||
# Example: Europe/Amsterdam
|
# Example: Europe/Amsterdam
|
||||||
|
|
|
@ -24,6 +24,7 @@ domain=$YNH_APP_ARG_DOMAIN
|
||||||
path_url="/"
|
path_url="/"
|
||||||
admin=$YNH_APP_ARG_ADMIN
|
admin=$YNH_APP_ARG_ADMIN
|
||||||
is_public=$YNH_APP_ARG_IS_PUBLIC
|
is_public=$YNH_APP_ARG_IS_PUBLIC
|
||||||
|
random_key=$(ynh_string_random 32)
|
||||||
|
|
||||||
# This is a multi-instance app, meaning it can be installed several times independently
|
# This is a multi-instance app, meaning it can be installed several times independently
|
||||||
# The id of the app as stated in the manifest is available as $YNH_APP_ID
|
# The id of the app as stated in the manifest is available as $YNH_APP_ID
|
||||||
|
@ -60,6 +61,7 @@ ynh_app_setting_set $app domain $domain
|
||||||
ynh_app_setting_set $app path $path_url
|
ynh_app_setting_set $app path $path_url
|
||||||
ynh_app_setting_set $app admin $admin
|
ynh_app_setting_set $app admin $admin
|
||||||
ynh_app_setting_set $app is_public $is_public
|
ynh_app_setting_set $app is_public $is_public
|
||||||
|
ynh_app_setting_set $app random_key $random_key
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# INSTALL DEPENDENCIES
|
# INSTALL DEPENDENCIES
|
||||||
|
@ -85,8 +87,6 @@ ynh_app_setting_set $app final_path $final_path
|
||||||
# Download, check integrity, uncompress and patch the source from app.src
|
# Download, check integrity, uncompress and patch the source from app.src
|
||||||
ynh_setup_source "$final_path"
|
ynh_setup_source "$final_path"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# NGINX CONFIGURATION
|
# NGINX CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -108,7 +108,6 @@ ynh_system_user_create $app
|
||||||
# Create a dedicated php-fpm7.1 config
|
# Create a dedicated php-fpm7.1 config
|
||||||
ynh_add_fpm7.1_config
|
ynh_add_fpm7.1_config
|
||||||
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SPECIFIC SETUP
|
# SPECIFIC SETUP
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -121,7 +120,7 @@ sudo cp ../conf/.env $final_path/.env
|
||||||
#=================================================
|
#=================================================
|
||||||
# MODIFY A CONFIG FILE
|
# MODIFY A CONFIG FILE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_replace_string "random_key" "$random_key" "$final_path/.env"
|
||||||
ynh_replace_string "yunouser" "$db_name" "$final_path/.env"
|
ynh_replace_string "yunouser" "$db_name" "$final_path/.env"
|
||||||
ynh_replace_string "yunopass" "$db_pwd" "$final_path/.env"
|
ynh_replace_string "yunopass" "$db_pwd" "$final_path/.env"
|
||||||
ynh_replace_string "yunobase" "$db_name" "$final_path/.env"
|
ynh_replace_string "yunobase" "$db_name" "$final_path/.env"
|
||||||
|
@ -129,7 +128,6 @@ ynh_replace_string "yunomail" "$email" "$final_path/.env"
|
||||||
ynh_replace_string "yunodomain" "$domain" "$final_path/.env"
|
ynh_replace_string "yunodomain" "$domain" "$final_path/.env"
|
||||||
|
|
||||||
init_composer $final_path
|
init_composer $final_path
|
||||||
cd $final_path && sudo /usr/bin/php7.1 artisan -n key:generate --force
|
|
||||||
cd $final_path && sudo /usr/bin/php7.1 artisan config:clear
|
cd $final_path && sudo /usr/bin/php7.1 artisan config:clear
|
||||||
|
|
||||||
db_name=$(ynh_sanitize_dbid $app)
|
db_name=$(ynh_sanitize_dbid $app)
|
||||||
|
@ -138,7 +136,6 @@ db_name=$(ynh_sanitize_dbid $app)
|
||||||
cd $final_path && sudo /usr/bin/php7.1 artisan -q :refresh --seed --force
|
cd $final_path && sudo /usr/bin/php7.1 artisan -q :refresh --seed --force
|
||||||
cd $final_path && sudo /usr/bin/php7.1 artisan passport:install --force
|
cd $final_path && sudo /usr/bin/php7.1 artisan passport:install --force
|
||||||
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SETUP APPLICATION PERMISSIONS
|
# SETUP APPLICATION PERMISSIONS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -21,6 +21,7 @@ admin=$(ynh_app_setting_get $app admin)
|
||||||
is_public=$(ynh_app_setting_get $app is_public)
|
is_public=$(ynh_app_setting_get $app is_public)
|
||||||
final_path=$(ynh_app_setting_get $app final_path)
|
final_path=$(ynh_app_setting_get $app final_path)
|
||||||
db_name=$(ynh_app_setting_get $app db_name)
|
db_name=$(ynh_app_setting_get $app db_name)
|
||||||
|
random_key=$(ynh_app_setting_get $app random_key)
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# ENSURE DOWNWARD COMPATIBILITY
|
# ENSURE DOWNWARD COMPATIBILITY
|
||||||
|
@ -41,8 +42,6 @@ if [ -z $db_name ]; then
|
||||||
ynh_app_setting_set $app db_name $db_name
|
ynh_app_setting_set $app db_name $db_name
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -76,7 +75,6 @@ mkdir -p "$tmpdir/storage/upload"
|
||||||
mkdir -p "$tmpdir/storage/export"
|
mkdir -p "$tmpdir/storage/export"
|
||||||
mkdir -p "$final_path/storage/upload/"
|
mkdir -p "$final_path/storage/upload/"
|
||||||
mkdir -p "$final_path/storage/export/"
|
mkdir -p "$final_path/storage/export/"
|
||||||
cp -a "$final_path/.env" "$tmpdir/.env"
|
|
||||||
cp -a "$final_path/storage/upload/" "$tmpdir/storage/upload/"
|
cp -a "$final_path/storage/upload/" "$tmpdir/storage/upload/"
|
||||||
cp -a "$final_path/storage/export/" "$tmpdir/storage/export/"
|
cp -a "$final_path/storage/export/" "$tmpdir/storage/export/"
|
||||||
|
|
||||||
|
@ -98,7 +96,6 @@ ynh_setup_source "$final_path"
|
||||||
|
|
||||||
|
|
||||||
rm -rf "$final_path/bootstrap/cache/*"
|
rm -rf "$final_path/bootstrap/cache/*"
|
||||||
cp -a "$tmpdir/.env" "$final_path/.env"
|
|
||||||
cp -a "$tmpdir/storage/upload/" "$final_path/storage/upload/"
|
cp -a "$tmpdir/storage/upload/" "$final_path/storage/upload/"
|
||||||
cp -a "$tmpdir/storage/export/" "$final_path/storage/export/"
|
cp -a "$tmpdir/storage/export/" "$final_path/storage/export/"
|
||||||
|
|
||||||
|
@ -119,8 +116,6 @@ ynh_add_nginx_config
|
||||||
# Create a system user
|
# Create a system user
|
||||||
ynh_system_user_create $app
|
ynh_system_user_create $app
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# PHP-FPM 7.1 CONFIGURATION
|
# PHP-FPM 7.1 CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -131,6 +126,22 @@ ynh_add_fpm7.1_config
|
||||||
#=================================================
|
#=================================================
|
||||||
# SPECIFIC UPGRADE
|
# SPECIFIC UPGRADE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
# Get the admin email
|
||||||
|
email=$(ynh_user_get_info $admin 'mail')
|
||||||
|
|
||||||
|
# setup application config
|
||||||
|
sudo cp ../conf/.env $final_path/.env
|
||||||
|
#=================================================
|
||||||
|
# MODIFY A CONFIG FILE
|
||||||
|
#=================================================
|
||||||
|
ynh_replace_string "random_key" "$random_key" "$final_path/.env"
|
||||||
|
ynh_replace_string "yunouser" "$db_name" "$final_path/.env"
|
||||||
|
ynh_replace_string "yunopass" "$db_pwd" "$final_path/.env"
|
||||||
|
ynh_replace_string "yunobase" "$db_name" "$final_path/.env"
|
||||||
|
ynh_replace_string "yunomail" "$email" "$final_path/.env"
|
||||||
|
ynh_replace_string "yunodomain" "$domain" "$final_path/.env"
|
||||||
|
|
||||||
|
|
||||||
init_composer $final_path
|
init_composer $final_path
|
||||||
cd $final_path && sudo /usr/bin/php7.1 artisan migrate --env=production --force
|
cd $final_path && sudo /usr/bin/php7.1 artisan migrate --env=production --force
|
||||||
cd $final_path && sudo /usr/bin/php7.1 artisan cache:clear
|
cd $final_path && sudo /usr/bin/php7.1 artisan cache:clear
|
||||||
|
|
Loading…
Reference in a new issue