mirror of
https://github.com/YunoHost-Apps/snserver_ynh.git
synced 2024-09-03 20:26:22 +02:00
Update scripts - Install extensions
This commit is contained in:
parent
872e7574af
commit
dc7dfe69a9
4 changed files with 50 additions and 8 deletions
|
@ -62,5 +62,7 @@ REVISIONS_FREQUENCY=300
|
||||||
# Sub-URI
|
# Sub-URI
|
||||||
RAILS_RELATIVE_URL_ROOT=/
|
RAILS_RELATIVE_URL_ROOT=/
|
||||||
|
|
||||||
# Enable public file server
|
# Public file server
|
||||||
|
# Empty is disabled
|
||||||
|
# Any value is enabled
|
||||||
RAILS_SERVE_STATIC_FILES=
|
RAILS_SERVE_STATIC_FILES=
|
||||||
|
|
|
@ -29,6 +29,8 @@ ynh_script_progression --message="Loading installation settings..." --weight=1
|
||||||
# Needed for helper "ynh_add_nginx_config"
|
# Needed for helper "ynh_add_nginx_config"
|
||||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||||
port=$(ynh_app_setting_get --app=$app --key=port)
|
port=$(ynh_app_setting_get --app=$app --key=port)
|
||||||
|
install_extensions=$(ynh_app_setting_get --app=$app --key=install_extensions)
|
||||||
|
access_domain=$(ynh_app_setting_get --app=$app --key=access_domain)
|
||||||
|
|
||||||
# Add settings here as needed by your application
|
# Add settings here as needed by your application
|
||||||
#db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
#db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||||
|
@ -93,7 +95,7 @@ then
|
||||||
domain="$old_domain"
|
domain="$old_domain"
|
||||||
path_url="$new_path"
|
path_url="$new_path"
|
||||||
# Create a dedicated nginx config
|
# Create a dedicated nginx config
|
||||||
ynh_add_nginx_config "port"
|
ynh_add_nginx_config "port access_domain"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Change the domain for nginx
|
# Change the domain for nginx
|
||||||
|
@ -114,6 +116,26 @@ ynh_script_progression --message="Modifying a config file..." --weight=1
|
||||||
config_file="$final_path/live/.env"
|
config_file="$final_path/live/.env"
|
||||||
ynh_replace_string --match_string="RAILS_RELATIVE_URL_ROOT=$old_path" --replace_string="RAILS_RELATIVE_URL_ROOT=$new_path" --target_file="$config_file"
|
ynh_replace_string --match_string="RAILS_RELATIVE_URL_ROOT=$old_path" --replace_string="RAILS_RELATIVE_URL_ROOT=$new_path" --target_file="$config_file"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# Modify Standard Notes - Extensions
|
||||||
|
#=================================================
|
||||||
|
if [ $install_extensions ]
|
||||||
|
then
|
||||||
|
ynh_script_progression --message="Modify Standard Notes - Extensions..." --weight=1
|
||||||
|
|
||||||
|
if [ $new_path = "/" ]
|
||||||
|
then
|
||||||
|
path=""
|
||||||
|
else
|
||||||
|
path=$new_path
|
||||||
|
fi
|
||||||
|
|
||||||
|
find "$final_path/live/public/extensions/src/" -name "*.json" -print0 | while read -d $'\0' file
|
||||||
|
do
|
||||||
|
ynh_replace_string --match_string='"url": "https://.*/extensions/src/' --replace_string='"url": "https://$domain$path/extensions/src/' --target_file="$file"
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SETUP FAIL2BAN
|
# SETUP FAIL2BAN
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -164,7 +164,7 @@ if [ $install_extensions ]
|
||||||
then
|
then
|
||||||
ynh_script_progression --message="Installing Standard Notes - Extensions..." --weight=1
|
ynh_script_progression --message="Installing Standard Notes - Extensions..." --weight=1
|
||||||
|
|
||||||
ynh_replace_string --match_string="RAILS_SERVE_STATIC_FILES=" --replace_string="RAILS_SERVE_STATIC_FILES=true" --target_file="$config_file"
|
ynh_replace_string --match_string="^RAILS_SERVE_STATIC_FILES=.*$" --replace_string="RAILS_SERVE_STATIC_FILES=true" --target_file="$config_file"
|
||||||
|
|
||||||
if [ $path_url = "/" ]
|
if [ $path_url = "/" ]
|
||||||
then
|
then
|
||||||
|
|
|
@ -180,7 +180,7 @@ then
|
||||||
exec_as "$app" env PATH=$PATH /opt/rbenv/versions/$RUBY_VERSION/bin/bundle config set with 'development'
|
exec_as "$app" env PATH=$PATH /opt/rbenv/versions/$RUBY_VERSION/bin/bundle config set with 'development'
|
||||||
exec_as "$app" env PATH=$PATH /opt/rbenv/versions/$RUBY_VERSION/bin/bundle install
|
exec_as "$app" env PATH=$PATH /opt/rbenv/versions/$RUBY_VERSION/bin/bundle install
|
||||||
exec_as "$app" env PATH=$PATH RAILS_ENV=production /opt/rbenv/versions/$RUBY_VERSION/bin/bundle exec rails db:create db:migrate --quiet
|
exec_as "$app" env PATH=$PATH RAILS_ENV=production /opt/rbenv/versions/$RUBY_VERSION/bin/bundle exec rails db:create db:migrate --quiet
|
||||||
exec_as "$app" env PATH=$PATH RAILS_ENV=production /opt/rbenv/versions/$RUBY_VERSION/bin/bundle exec rails assets:precompile --quiet
|
# exec_as "$app" env PATH=$PATH RAILS_ENV=production /opt/rbenv/versions/$RUBY_VERSION/bin/bundle exec rails assets:precompile --quiet
|
||||||
popd
|
popd
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -189,9 +189,27 @@ fi
|
||||||
#=================================================
|
#=================================================
|
||||||
if [ $install_extensions ]
|
if [ $install_extensions ]
|
||||||
then
|
then
|
||||||
ynh_script_progression --message="Installing Standard Notes - Extensions..." --weight=1
|
ynh_script_progression --message="Reinstalling Standard Notes - Extensions..." --weight=1
|
||||||
|
|
||||||
ynh_replace_string --match_string="RAILS_SERVE_STATIC_FILES=false" --replace_string="RAILS_SERVE_STATIC_FILES=true" --target_file="$config_file"
|
ynh_replace_string --match_string="^RAILS_SERVE_STATIC_FILES=.*$" --replace_string="RAILS_SERVE_STATIC_FILES=true" --target_file="$config_file"
|
||||||
|
|
||||||
|
if [ $path_url = "/" ]
|
||||||
|
then
|
||||||
|
path=""
|
||||||
|
else
|
||||||
|
path=$path_url
|
||||||
|
fi
|
||||||
|
|
||||||
|
find "$final_path/live/public/extensions/src/" -name "*.json" -print0 | while read -d $'\0' file
|
||||||
|
do
|
||||||
|
ynh_replace_string --match_string="__DOMAIN__PATH__" --replace_string="$domain$path" --target_file="$file"
|
||||||
|
done
|
||||||
|
|
||||||
|
find "../conf/" -name "ext_*.src" -print0 | while read -d $'\0' file
|
||||||
|
do
|
||||||
|
basename=$(basename -as .src $file)
|
||||||
|
ynh_setup_source --dest_dir="$final_path/live/public/extensions/src/${basename#'ext_'}" --source_id="$basename"
|
||||||
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
Loading…
Reference in a new issue