1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/snserver_ynh.git synced 2024-09-03 20:26:22 +02:00

Preperation for extentions

This commit is contained in:
Fabian Wilkens 2021-01-08 19:44:37 +01:00
parent e755357f83
commit 8c1e5d1e8f
4 changed files with 40 additions and 7 deletions

View file

@ -61,3 +61,6 @@ REVISIONS_FREQUENCY=300
# Sub-URI # Sub-URI
RAILS_RELATIVE_URL_ROOT=/ RAILS_RELATIVE_URL_ROOT=/
# Enable public file server
RAILS_SERVE_STATIC_FILES=false

View file

@ -13,7 +13,5 @@ location __PATH__/ {
proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header X-Forwarded-Proto $scheme;
proxy_buffering off; proxy_buffering off;
# Include SSOWAT user panel. more_set_headers "X-Frame-Options" : "allow-from __ACCESS_DOMAIN__"
include conf.d/yunohost_panel.conf.inc;
more_clear_input_headers 'Accept-Encoding';
} }

View file

@ -28,6 +28,13 @@ domain=$YNH_APP_ARG_DOMAIN
path_url=$YNH_APP_ARG_PATH path_url=$YNH_APP_ARG_PATH
is_public=$YNH_APP_ARG_IS_PUBLIC is_public=$YNH_APP_ARG_IS_PUBLIC
app=$YNH_APP_INSTANCE_NAME app=$YNH_APP_INSTANCE_NAME
install_extensions=$YNH_APP_ARG_INSTALL_EXTENSIONS
if [ $install_extensions -eq 0 ]
then
access_domain=$domain
else
access_domain=$YNH_APP_ARG_ACCESS_DOMAIN
fi
#================================================= #=================================================
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS # CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
@ -46,6 +53,8 @@ ynh_script_progression --message="Storing installation settings..." --weight=3
ynh_app_setting_set --app=$app --key=domain --value=$domain ynh_app_setting_set --app=$app --key=domain --value=$domain
ynh_app_setting_set --app=$app --key=path --value=$path_url ynh_app_setting_set --app=$app --key=path --value=$path_url
ynh_app_setting_set --app=$app --key=is_public --value=$is_public ynh_app_setting_set --app=$app --key=is_public --value=$is_public
ynh_app_setting_set --app=$app --key=install_extensions --value=$install_extensions
ynh_app_setting_set --app=$app --key=access_domain --value=$access_domain
#================================================= #=================================================
# STANDARD MODIFICATIONS # STANDARD MODIFICATIONS
@ -92,7 +101,7 @@ ynh_setup_source --dest_dir="$final_path/live"
ynh_script_progression --message="Configuring nginx web server..." --weight=3 ynh_script_progression --message="Configuring nginx web server..." --weight=3
# Create a dedicated nginx config # Create a dedicated nginx config
ynh_add_nginx_config "port" ynh_add_nginx_config "port access_domain"
#================================================= #=================================================
# CREATE DEDICATED USER # CREATE DEDICATED USER
@ -145,8 +154,19 @@ pushd "$final_path/live"
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
popd popd
#=================================================
# INSTALLING Standard Notes - Extensions
#=================================================
if [ $install_extensions ]
then
ynh_script_progression --message="Installing Standard Notes - Extensions..." --weight=1
ynh_replace_string --match_string="RAILS_SERVE_STATIC_FILES=false" --replace_string="RAILS_SERVE_STATIC_FILES=$install_extensions" --target_file="$config_file"
fi
#================================================= #=================================================
# SETUP SYSTEMD # SETUP SYSTEMD
#================================================= #=================================================
@ -210,9 +230,9 @@ ynh_script_progression --message="Configuring fail2ban..." --weight=1
# Create a dedicated fail2ban config # Create a dedicated fail2ban config
touch "/var/log/$app/$app.log" touch "/var/log/$app/$app.log"
ynh_add_fail2ban_config --use_template --others_var="\ ynh_add_fail2ban_config --use_template --others_var="\
domain \ domain \
path_url \ path_url \
" "
#================================================= #=================================================
# SETUP SSOWAT # SETUP SSOWAT

View file

@ -25,6 +25,7 @@ db_name=$(ynh_app_setting_get --app=$app --key=db_name)
db_user=$db_name db_user=$db_name
db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd) db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
port=$(ynh_app_setting_get --app=$app --key=port) port=$(ynh_app_setting_get --app=$app --key=port)
access_domain=(ynh_app_setting_get --app=$app --key=access_domain)
#================================================= #=================================================
# CHECK VERSION # CHECK VERSION
@ -179,9 +180,20 @@ 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
popd popd
fi fi
#=================================================
# INSTALLING Standard Notes - Extensions
#=================================================
if [ $install_extensions ]
then
ynh_script_progression --message="Installing 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"
fi
#================================================= #=================================================
# SETUP SYSTEMD # SETUP SYSTEMD
#================================================= #=================================================