diff --git a/conf/nginx.conf b/conf/nginx.conf index 869d122..2f14fba 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -1,5 +1,7 @@ #sub_path_only rewrite ^__PATH__$ __PATH__/ permanent; + location __PATH__/ { + alias __FINALPATH__/; if ($scheme = http) { @@ -10,9 +12,9 @@ location __PATH__/ { try_files $uri $uri/ /index.php; location ~ [^/]\.php(/|$) { - if ($request_uri ~ "\/movim\/\?infos") { - return 403; - } + #if ($request_uri ~ "\/movim\/\?infos") { + # return 403; + #} fastcgi_split_path_info ^(.+?\.php)(/.*)$; fastcgi_pass unix:/var/run/php__PHPVERSION__-fpm-__NAME__.sock; @@ -39,22 +41,7 @@ location __PATH__/ { proxy_send_timeout 14400s; # (14400s is 4h) } + # Include SSOWAT user panel. include conf.d/yunohost_panel.conf.inc; } - -location ~ /\.ht { - deny all; -} - -location ^~ /movim/log/ { - return 403; -} - -location ^~ /movim/config/ { - return 403; -} - -location ^~ /movim/?infos { - return 403; -} \ No newline at end of file diff --git a/conf/systemd.service b/conf/systemd.service index a9e5e42..9b95633 100644 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -7,9 +7,12 @@ Type=simple User=__APP__ Group=__APP__ WorkingDirectory=__FINALPATH__ -ExecStart=/usr/bin/php daemon.php start --url=https://__DOMAIN__/__PATH__ --port=__PORT__ +ExecStart=/usr/bin/php __FINALPATH__/daemon.php start --url=https://__DOMAIN__/__PATH__ --port=__PORT__ StandardOutput=syslog SyslogIdentifier=__APP__ PIDFile=/run/movim.pid Restart=on-failure RestartSec=10 + +[Install] +WantedBy=multi-user.target diff --git a/scripts/install b/scripts/install index 2761c5c..ba3e1af 100644 --- a/scripts/install +++ b/scripts/install @@ -61,13 +61,13 @@ ynh_app_setting_set --app=$app --key=ssoenabled --value=$ssoenabled ynh_script_progression --message="Configuring firewall..." --weight=2 # Find a free port -port=$(ynh_find_port 9537) +port=$(ynh_find_port --port=9537) ynh_app_setting_set --app=$app --key=port --value=$port #================================================= # INSTALL DEPENDENCIES #================================================= -ynh_script_progression --message="Installing dependencies..." --time --weight=1 +ynh_script_progression --message="Installing dependencies..." --weight=1 # Install packages ynh_install_app_dependencies $pkg_dependencies @@ -93,7 +93,7 @@ ynh_psql_execute_as_root --sql="CREATE EXTENSION IF NOT EXISTS pg_trgm;" --datab #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= -ynh_script_progression --message="Setting up source files..." --time --weight=1 +ynh_script_progression --message="Setting up source files..." --weight=4 ynh_app_setting_set --app=$app --key=final_path --value=$final_path # Download, check integrity, uncompress and patch the source from app.src @@ -103,7 +103,7 @@ git clone https://github.com/movim/movim.git "$final_path" --quiet #================================================= # NGINX CONFIGURATION #================================================= -ynh_script_progression --message="Configuring nginx web server..." --time --weight=1 +ynh_script_progression --message="Configuring NGINX web server..." --weight=11 # Create a dedicated nginx config ynh_add_nginx_config @@ -111,7 +111,7 @@ ynh_add_nginx_config #================================================= # CREATE DEDICATED USER #================================================= -ynh_script_progression --message="Configuring system user..." --time --weight=1 +ynh_script_progression --message="Configuring system user..." --weight=3 # Create a system user ynh_system_user_create --username=$app @@ -119,7 +119,7 @@ ynh_system_user_create --username=$app #================================================= # PHP-FPM CONFIGURATION #================================================= -ynh_script_progression --message="Configuring php-fpm..." --time --weight=1 +ynh_script_progression --message="Configuring PHP-FPM..." --weight=1 # Create a dedicated php-fpm config #ynh_replace_string --match_string="YHTZ" --replace_string="$timezone" --target_file=../conf/php-fpm.conf @@ -130,7 +130,7 @@ ynh_add_fpm_config --package="$extra_php_dependencies" #================================================= # SET CONFIGURATION FILE #================================================= -ynh_script_progression --message="Modifying a config file..." +ynh_script_progression --message="Modifying a config file..." --weight=1 cp ../conf/db.example.inc.php $final_path/config/db.inc.php @@ -204,12 +204,14 @@ ynh_add_systemd_config # find "${final_path}/" -type d -print0 | xargs -0 chmod 0755 # chmod 400 "${final_path}/config/db.inc.php" -chown www-data $final_path && chown www-data $final_path/public && chmod u+rwx $final_path +chown www-data $final_path +chown www-data $final_path/public +chmod u+rwx $final_path #================================================= # INTEGRATE SERVICE IN YUNOHOST #================================================= -ynh_script_progression --message="Integrating service in YunoHost..." +ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 yunohost service add $app --description "Collaborative Markdown notes" --log="/var/log/$app/$app.log" @@ -238,7 +240,7 @@ fi #================================================= # RELOAD NGINX #================================================= -ynh_script_progression --message="Reloading nginx web server..." --time --weight=1 +ynh_script_progression --message="Reloading NGINX web server..." --weight=1 ynh_systemd_action --service_name=nginx --action=reload @@ -246,4 +248,4 @@ ynh_systemd_action --service_name=nginx --action=reload # END OF SCRIPT #================================================= -ynh_script_progression --message="Installation of $app completed" --time --last +ynh_script_progression --message="Installation of $app completed" --last diff --git a/scripts/restore b/scripts/restore index 43d079f..56a9291 100644 --- a/scripts/restore +++ b/scripts/restore @@ -79,7 +79,7 @@ chown -R root: $final_path # RESTORE THE PHP-FPM CONFIGURATION #================================================= -ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf" +ynh_restore_file --origin_path="/etc/php/${phpversion}/fpm/pool.d/$app.conf" #================================================= # SPECIFIC RESTORATION @@ -126,9 +126,9 @@ ynh_systemd_action --service_name=$app --action="start" #--log_path="/var/log/$a #================================================= # RELOAD NGINX AND PHP-FPM #================================================= -ynh_script_progression --message="Reloading nginx web server and php-fpm..." --time --weight=1 +ynh_script_progression --message="Reloading nginx web server and PHP-FPM..." --time --weight=1 -ynh_systemd_action --service_name=php$phpversion-fpm --action=reload +ynh_systemd_action --service_name=php${phpversion}-fpm --action=reload ynh_systemd_action --service_name=nginx --action=reload #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 243f021..ba4c4a7 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -204,7 +204,7 @@ fi # Create a dedicated systemd config -ynh_replace_string --match_string="__URL__" --replace_string="${domain}${path_url}" --target_file=../conf/systemd.service +# ynh_replace_string --match_string="__URL__" --replace_string="${domain}${path_url}" --target_file=../conf/systemd.service ynh_replace_string --match_string="__PORT__" --replace_string="$port" --target_file=../conf/systemd.service ynh_add_systemd_config