diff --git a/README.md b/README.md index 70594c13..ec4f80df 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,7 @@ -# YunoHost App for Hubzilla Hub +# Hubzilla Hub for YunoHost + +[![Install Hubzilla with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=hubzilla) + ## Hubzilla [Hubzilla](http://hubzilla.org) is a powerful platform for creating interconnected websites featuring a decentralized identity, commuhubzilla_test1nications, and permissions framework built using common webserver technology. @@ -6,8 +9,18 @@ Current snapshot in *sources*: -* https://github.com/redmatrix/hubzilla: 2.4.2 (commit 8896ebf7cbf20c242399c3821be5881e6068175a) -* https://github.com/redmatrix/hubzilla-addons: 2.4.2 (commit 30f3104ebe2121a433d174bb3bcb703bb9787bd3) +* https://github.com/redmatrix/hubzilla: 2.6.2 (commit 0ee2378cec6902c037b7cb28f290374f595f4d3b) +* https://github.com/redmatrix/hubzilla-addons: 2.6.2 (commit 8252952611ac03dd4c74430af69a8b10d7cdbbd0) + +## To-Do's +- [X] Installation and remove script. +- [X] Ldap integration. +- [X] Upgrade script. +- [X] Backup and restore script(Need to be tested,but hopefully will work). +- [X] Remove the admin email,path and is_public form installation form. +- [X] Stop modification of php.ini : exec(). +- [X] Make changes to nginx configuration accouding to Hubzilla official guide. +- [ ] Force redirection to https by default. ## Important Notes @@ -27,7 +40,7 @@ Before installing, read the [Hubzilla installation instructions](https://github. ## Installation ### Register a new domain and add it to YunoHost -Hubzilla requires a dedicated domain, so obtain one and add it using the [YunoHost admin](https://reticu.li/yunohost/admin) panel. **Domains -> Add domain**. As Hubzilla uses the full domain and is installed on the root, you can create a subdomain such as hubzilla.domain.tld. Don't forget to update your DNS if you manage them manually. +Hubzilla requires a dedicated domain, so obtain one and add it using the YunoHost admin panel. **Domains -> Add domain**. As Hubzilla uses the full domain and is installed on the root, you can create a subdomain such as hubzilla.domain.tld. Don't forget to update your DNS if you manage them manually. Hubzilla requires browser-approved SSL certificates. If you have certificates not issued by [Let's Encrypt](https://letsencrypt.org/), install them manually as usual. @@ -57,12 +70,12 @@ For older versions of YunoHost, once you have added the new domain, SSH into you service nginx start ### Install the Hubzilla application -Use the [YunoHost admin](https://reticu.li/yunohost/admin) panel to install Hubzilla by entering the GitHub repo address in the custom app URL +Use the YunoHost admin panel to install Hubzilla by entering the GitHub repo address in the custom app URL https://github.com/YunoHost-Apps/hubzilla_ynh Make sure to select your domain from the previous section as the application domain. Also set the application to Public. -When installation is complete, you will need to visit your new hub and register a new account using the email address you specified in the app installation form. You should then be able to log in and create your first channel. -If above method do not work for you then you have give an account administrator access through phpMYAdmin by -adding 4096 to the account_roles for that account in the database. +When installation is complete, you will need to visit your new hub and login with the admin account you specified in the app installation form. You should then be able create your first channel and have the admin rights to the hub. +For normal YunoHost users:You can login through Ldap authentication and create the channel accourding to the hub settings. +For admin:If you don't see the admin rights in your nav bar drop down menu or want to grant admin rights for any other user on the hub then you have to manually add 4096 to the account_roles for that account in the database through phpMYAdmin. diff --git a/check_process b/check_process index d4e9a722..cf6d106e 100644 --- a/check_process +++ b/check_process @@ -3,23 +3,33 @@ ; Manifest domain="domain.tld" (DOMAIN) admin="john" (USER) - path="/" (PATH) - email="johndoe@example.com" upload="256M" - ; Checks - pkg_linter=1 - setup_sub_dir=0 - setup_root=1 - setup_nourl=0 - setup_private=0 - setup_public=1 - upgrade=1 - backup_restore=1 - multi_instance=0 - wrong_user=0 - wrong_path=0 - incorrect_path=0 - corrupt_source=0 - fail_download_source=0 - port_already_use=0 - final_path_already_use=0 + ; Checks + pkg_linter=1 + setup_sub_dir=0 + setup_root=1 + setup_nourl=0 + setup_private=0 + setup_public=1 + upgrade=1 + backup_restore=1 + multi_instance=0 + incorrect_path=1 + port_already_use=0 + change_url=0 + ;;; Levels + Level 1=auto + Level 2=auto + Level 3=auto + # Level 4: + Level 4=0 + # Level 5: + Level 5=auto + Level 6=auto + Level 7=auto + Level 8=0 + Level 9=0 + Level 10=0 + ;;; Options + Email=anmol@datamol.in + Notification=none diff --git a/conf/nginx.conf b/conf/nginx.conf index d59813a4..992141ea 100644 --- a/conf/nginx.conf +++ b/conf/nginx.conf @@ -5,7 +5,7 @@ location YNH_WWW_PATH { # Force https if ($scheme = http) { - rewrite ^ https://$server_name$request_uri? permanent; + rewrite ^ https://$server_name$request_uri? permanent; } # Example PHP configuration @@ -19,25 +19,46 @@ location YNH_WWW_PATH { fastcgi_param REMOTE_USER $remote_user; fastcgi_param PATH_INFO $fastcgi_path_info; fastcgi_param SCRIPT_FILENAME $request_filename; - - # Set max upload size - client_max_body_size UPLOADTOCHANGE; - fastcgi_buffers 64 4K; + # Set max upload size + client_max_body_size UPLOADTOCHANGE; + fastcgi_buffers 64 4K; } - + # .htaccess file from Hubzilla converted using http://winginx.com/en/htaccess - location ~ "(^|/)\.git" { return 403; } - location ~ "(^|/)store" { return 403; } - autoindex off; - location / { - # Removing the .well-known rewrite below rule seems to work... - #rewrite ^/\.well\-known/.* /index.php?q=$1; - if (!-e $request_filename){ - rewrite ^(.*)$ /index.php?q=$1; - } + location ~ "(^|/)\.git" { return 403; } + location ~ "(^|/)store" { return 403; } + autoindex off; + location / + { + # Removing the .well-known rewrite below rule seems to work... + # rewrite ^/\.well\-known/.* /index.php?q=$1; + if (!-e $request_filename) + { + rewrite ^(.*)$ /index.php?q=$1; + } } - + # statically serve these file types when possible + # otherwise fall back to front controller + # allow browser to cache them + # added .htm for advanced source code editor library + location ~* \.(jpg|jpeg|gif|png|ico|css|js|htm|html|map|ttf|woff|woff2|svg)$ + { + expires 30d; + try_files $uri /index.php?q=$uri&$args; + } + # block these file types + location ~* \.(tpl|md|tgz|log|out)$ + { + deny all; + } + + # deny access to all dot files + location ~ /\. + { + deny all; + } + # Include SSOWAT user panel. # include conf.d/yunohost_panel.conf.inc; } diff --git a/manifest.json b/manifest.json index c3ac1a4d..946de185 100644 --- a/manifest.json +++ b/manifest.json @@ -32,16 +32,6 @@ "fr": "Indiquez un domain pour Hubzilla. Hubzilla doit être installé à la racine du domaine. Cela implique qu'aucune autre app ne pourra être installée ou accessible sur ce domain. Nous conseillons un sous-domaine dédié par exemple hubzilla.domain.tld." } }, - { - "name": "path", - "type": "path", - "ask": { - "en": "No choice, Hubzilla must be installed on the ROOT domain, so be careful", - "fr": "Pas de choix, Hubzilla doit etre installe a la racine, soyez prudent" - }, - "choices": ["/"], - "default": "/" - }, { "name": "admin", "type": "user", @@ -50,15 +40,6 @@ "fr": "Choisissez l'administrateur de Hubzilla (doit être un utilisateur YunoHost existant)" } }, - { - "name": "email", - "ask": { - "en": "Email address for the Hubzilla hub admin", - "fr": "Adresse email pour l'admin du hub Hubzilla" - }, - "example": "peter@example.com", - "optional": false - }, { "name": "upload", "ask": { @@ -68,24 +49,6 @@ "choices": ["64M", "128M", "256M", "512M", "1024M"], "default": "256M", "optional": false - }, - { - "name": "is_public", - "ask": { - "en": "Is it a public website ?", - "fr": "Est-ce un site publique ?" - }, - "choices": ["Yes", "No"], - "default": "Yes" - }, - { - "name": "run_exec", - "ask": { - "en": "Do you agree to modify php.ini to allow exec() function to be used by hubzilla ?", - "fr": "Acceptez-vous de modifier php.ini pour autoriser exec() à être utilisée par hubzilla ?" - }, - "choices": ["Yes", "No"], - "default": "No" } ] } diff --git a/scripts/install b/scripts/install index 143b5781..fa44c7a7 100755 --- a/scripts/install +++ b/scripts/install @@ -8,12 +8,10 @@ TRAP_ON # Active trap pour arrêter le script si une erreur est détectée. app=$YNH_APP_INSTANCE_NAME domain=$YNH_APP_ARG_DOMAIN -path=$YNH_APP_ARG_PATH +path="/" admin=$YNH_APP_ARG_ADMIN -email=$YNH_APP_ARG_EMAIL +email=$(sudo yunohost user info $admin | grep "mail:" | cut -d' ' -f2) upload=$YNH_APP_ARG_UPLOAD -is_public=$YNH_APP_ARG_IS_PUBLIC -run_exec=$YNH_APP_ARG_RUN_EXEC # Source app helpers source /usr/share/yunohost/helpers @@ -37,7 +35,6 @@ ynh_app_setting_set $app path $path ynh_app_setting_set $app admin $admin ynh_app_setting_set $app email $email ynh_app_setting_set $app upload $upload -ynh_app_setting_set $app is_public $is_public # Install dependencies sudo apt-get update @@ -101,13 +98,6 @@ sudo cp ../conf/nginx.conf $nginxconf sudo chown root: $nginxconf sudo chmod 600 $nginxconf -# Modify php.ini to allow exec() function and increase the upload size limits -if [ "$run_exec" = "Yes" ]; -then - sudo sed -i 's/pcntl_exec//g' /etc/php5/fpm/php.ini -else - echo "no modification of php.ini" -fi # Dedicated php-fpm sed -i "s@UPLOADTOCHANGE@$upload@g" ../conf/php-fpm.conf sed -i "s@NAMETOCHANGE@$app@g" ../conf/php-fpm.conf @@ -120,13 +110,9 @@ sudo chmod 644 $phpfpmconf sed -i "s@YNH_WWW_PATH@$final_path@g" ../conf/poller-cron sudo cp ../conf/poller-cron /etc/cron.d/$app -# Make app public if necessary -if [ "$is_public" = "Yes" ]; -then - ynh_app_setting_set $app skipped_uris "/" -else - ynh_app_setting_set $app protected_uris "/" -fi +# Make app public +ynh_app_setting_set $app skipped_uris "/" + # Reload services diff --git a/scripts/remove b/scripts/remove index 911e96a5..2a367e53 100755 --- a/scripts/remove +++ b/scripts/remove @@ -10,7 +10,6 @@ source /usr/share/yunohost/helpers domain=$(ynh_app_setting_get $app domain) db_user=$(ynh_app_setting_get $app db_user) -run_exec=$(ynh_app_setting_get $app run_exec) REMOVE_BDD $db_user # Suppression de la base de donnée et de l'utilisateur associé. @@ -23,13 +22,6 @@ REMOVE_FPM_CONF # Suppression de la configuration du pool php-fpm # Remove poller cron job sudo rm -f /etc/cron.d/$app -# Restore php.ini as it was before installing hubzilla -if [ "$run_exec" = "Yes" ]; -then - sudo sed -i 's/,,/,pcntl_exec,/g' /etc/php5/fpm/php.ini -else - echo "no modification of php.ini" -fi # Reload services after cleaning sudo service php5-fpm reload diff --git a/scripts/restore b/scripts/restore index 386203ee..c381b7b5 100644 --- a/scripts/restore +++ b/scripts/restore @@ -8,12 +8,10 @@ app=$YNH_APP_INSTANCE_NAME domain=$(ynh_app_setting_get $app domain) path=$(ynh_app_setting_get $app path) -is_public=$(ynh_app_setting_get $app is_public) admin=$(ynh_app_setting_get $app admin) final_path=$(ynh_app_setting_get $app final_path) db_user=$(ynh_app_setting_get $app db_user) db_pwd=$(ynh_app_setting_get $app db_pwd) -run_exec=$(ynh_app_setting_get $app run_exec) if [ -d $final_path ]; then echo "There is already a directory: $final_path " >&2 @@ -38,30 +36,19 @@ sudo cp -a ./sources/. $final_path/ ynh_mysql_create_db $db_user $db_user $db_pwd mysql --debug-check -u $db_user -p$db_pwd $db_user < ./backupdb.sql -# Modify php.ini to allow exec() function and increase the upload size limits -if [ "$run_exec" = "Yes" ]; -then - sudo sed -i 's/pcntl_exec//g' /etc/php5/fpm/php.ini -else - echo "no modification of php.ini" -fi + # Copy dedicated php-fpm process from backup folder to the right location sudo cp -a ./php-fpm.conf /etc/php5/fpm/pool.d/$app.conf -# Backup cron job +# Restore cron job sudo cp -a ./cron.job /etc/cron.d/$app -# Make app public if necessary -if [ "$is_public" = "Yes" ]; -then - ynh_app_setting_set $app skipped_uris "/" -else - ynh_app_setting_set $app protected_uris "/" -fi +# Make app public +ynh_app_setting_set $app skipped_uris "/" + # And Reload services sudo service php5-fpm reload sudo service nginx reload sudo yunohost app ssowatconf - diff --git a/scripts/upgrade b/scripts/upgrade index 98a24899..1b8bf77e 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -10,14 +10,8 @@ source /usr/share/yunohost/helpers domain=$(ynh_app_setting_get $app domain) path=$(ynh_app_setting_get $app path) -is_public=$(ynh_app_setting_get $app is_public) -admin=$(ynh_app_setting_get $app admin) final_path=$(ynh_app_setting_get $app final_path) -db_pwd=$(ynh_app_setting_get $app db_pwd) -db_user=$(ynh_app_setting_get $app db_user) -email=$(ynh_app_setting_get $app email) upload=$(ynh_app_setting_get $app upload) -run_exec=$(ynh_app_setting_get $app run_exec) CHECK_PATH # Vérifie et corrige la syntaxe du path. @@ -62,13 +56,6 @@ sudo cp ../conf/nginx.conf $nginxconf sudo chown root: $nginxconf sudo chmod 600 $nginxconf -# Modify php.ini to allow exec() function and increase the upload size limits -if [ "$run_exec" = "Yes" ]; -then - sudo sed -i 's/pcntl_exec//g' /etc/php5/fpm/php.ini -else - echo "no modification of php.ini" -fi # Dedicated php-fpm sed -i "s@UPLOADTOCHANGE@$upload@g" ../conf/php-fpm.conf sed -i "s@NAMETOCHANGE@$app@g" ../conf/php-fpm.conf @@ -80,13 +67,8 @@ sudo chown root: $phpfpmconf sed -i "s@YNH_WWW_PATH@$final_path@g" ../conf/poller-cron sudo cp ../conf/poller-cron /etc/cron.d/$app -# Make app public if necessary -if [ "$is_public" = "Yes" ]; -then - ynh_app_setting_set $app skipped_uris "/" -else - ynh_app_setting_set $app protected_uris "/" -fi +# Make app public +ynh_app_setting_set $app skipped_uris "/" # Reload services sudo service php5-fpm reload || true diff --git a/sources/hubzilla-addons/source_file b/sources/hubzilla-addons/source_file index 23752f9f..bf22055a 100644 --- a/sources/hubzilla-addons/source_file +++ b/sources/hubzilla-addons/source_file @@ -1 +1 @@ -hubzilla-addons-2.4.2 +hubzilla-addons-2.6.2 diff --git a/sources/hubzilla-addons/source_md5 b/sources/hubzilla-addons/source_md5 index 0eb78dad..2ba95f21 100644 --- a/sources/hubzilla-addons/source_md5 +++ b/sources/hubzilla-addons/source_md5 @@ -1 +1 @@ -24cde04ec71c61864e0ce904a27ad432 hubzilla-addons-2.4.2.zip +2aceb976651b02e4b096c16aea431aec hubzilla-addons-2.6.2.zip diff --git a/sources/hubzilla-addons/source_url b/sources/hubzilla-addons/source_url index 8b6bf9e7..ecf1a787 100644 --- a/sources/hubzilla-addons/source_url +++ b/sources/hubzilla-addons/source_url @@ -1 +1 @@ -https://github.com/redmatrix/hubzilla-addons/archive/2.4.2.zip +https://github.com/redmatrix/hubzilla-addons/archive/2.6.2.zip diff --git a/sources/hubzilla/source_file b/sources/hubzilla/source_file index 5e314aa8..33898158 100644 --- a/sources/hubzilla/source_file +++ b/sources/hubzilla/source_file @@ -1 +1 @@ -hubzilla-2.4.2 +hubzilla-2.6.2 diff --git a/sources/hubzilla/source_md5 b/sources/hubzilla/source_md5 index e00d8623..7a6877a3 100644 --- a/sources/hubzilla/source_md5 +++ b/sources/hubzilla/source_md5 @@ -1 +1 @@ -779d29162c3e7635bc1c93707c3da67f hubzilla-2.4.2.zip +b821f19d489b839191e2bb280cc527fc hubzilla-2.6.2.zip diff --git a/sources/hubzilla/source_url b/sources/hubzilla/source_url index 26bf4c60..d33fda3c 100644 --- a/sources/hubzilla/source_url +++ b/sources/hubzilla/source_url @@ -1 +1 @@ -https://github.com/redmatrix/hubzilla/archive/2.4.2.zip +https://github.com/redmatrix/hubzilla/archive/2.6.2.zip