1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/hubzilla_ynh.git synced 2024-09-03 19:26:21 +02:00
This commit is contained in:
ericgaspar 2021-07-20 23:37:55 +02:00
parent 334daa1307
commit d2405f711c
No known key found for this signature in database
GPG key ID: 574F281483054D44
7 changed files with 122 additions and 30 deletions

View file

@ -1,5 +1,5 @@
SOURCE_URL=https://framagit.org/hubzilla/core/-/archive/5.6/core-5.6.tar.gz SOURCE_URL=https://framagit.org/hubzilla/core/-/archive/6.0/core-6.0.tar.gz
SOURCE_SUM=2c01d4ccbc9db590090f6b2bfc7878726380d2da81b085d28e720c73c8b69cb7 SOURCE_SUM=d1982e69694c4b296f04a6fb7b029190964d28abb2d7964a985e55fcf711cce2
SOURCE_SUM_PRG=sha256sum SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=tar.gz SOURCE_FORMAT=tar.gz
SOURCE_IN_SUBDIR= SOURCE_IN_SUBDIR=

View file

@ -1,5 +1,5 @@
SOURCE_URL=https://framagit.org/hubzilla/addons/-/archive/5.6/addons-5.6.tar.gz SOURCE_URL=https://framagit.org/hubzilla/addons/-/archive/6.0/addons-6.0.tar.gz
SOURCE_SUM=3a78bc901bc49bb9afca0422418dfcc2f5c6eb04daef6686ea4e95e71e0ee9af SOURCE_SUM=e728d832c2993c5cd2bb66f5151919fb948338336205dbd865af0b94bb06c53e
SOURCE_SUM_PRG=sha256sum SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=tar.gz SOURCE_FORMAT=tar.gz
SOURCE_IN_SUBDIR= SOURCE_IN_SUBDIR=

94
conf/htconfig.sample.php Normal file
View file

@ -0,0 +1,94 @@
<?php
// If automatic system installation fails:
// Copy or rename this file to .htconfig.php in the top level
// Hubzilla directory
// Why .htconfig.php? Because it contains sensitive information which could
// give somebody complete control of your database. Apache's default
// configuration denies access to and refuses to serve any file beginning
// with .ht
// Then set the following for your MySQL installation
$db_host = 'localhost'; // Use 'localhost' or ':/path/to/socket.file' if you aren't using a remote server
$db_port = 0; // leave 0 for default or set your port
$db_user = '__DB_NAME__';
$db_pass = '__DB_PWD';
$db_data = '__DB_NAME__';
$db_type = 0; // use 1 for postgres, 0 for mysql
/*
* Notice: Many of the following settings will be available in the admin panel
* after a successful site install. Once they are set in the admin panel, they
* are stored in the DB - and the DB setting will over-ride any corresponding
* setting in this file
*
* The command-line tool util/config is able to query and set the DB items
* directly if for some reason the admin panel is not available and a system
* setting requires modification.
*
*/
// Choose a legal default timezone. If you are unsure, use "America/Los_Angeles".
// It can be changed later and only applies to timestamps for anonymous viewers.
App::$config['system']['timezone'] = 'America/Los_Angeles';
// What is your site name? DO NOT ADD A TRAILING SLASH!
App::$config['system']['baseurl'] = 'https://mysite.example';
App::$config['system']['sitename'] = "Hubzilla";
App::$config['system']['location_hash'] = 'if the auto install failed, put a unique random string here';
// These lines set additional security headers to be sent with all responses
// You may wish to set transport_security_header to 0 if your server already sends
// this header. content_security_policy may need to be disabled if you wish to
// run the piwik analytics plugin or include other offsite resources on a page
App::$config['system']['transport_security_header'] = 1;
App::$config['system']['content_security_policy'] = 1;
App::$config['system']['ssl_cookie_protection'] = 1;
// Your choices are REGISTER_OPEN, REGISTER_APPROVE, or REGISTER_CLOSED.
// Be certain to create your own personal account before setting
// REGISTER_CLOSED. 'register_text' (if set) will be displayed prominently on
// the registration page. REGISTER_APPROVE requires you set 'admin_email'
// to the email address of an already registered person who can authorise
// and/or approve/deny the request.
// In order to perform system administration via the admin panel, admin_email
// must precisely match the email address of the person logged in.
App::$config['system']['register_policy'] = REGISTER_OPEN;
App::$config['system']['register_text'] = '';
App::$config['system']['admin_email'] = '';
// Location of PHP command line processor
App::$config['system']['php_path'] = 'php';
// Configure how we communicate with directory servers.
// DIRECTORY_MODE_NORMAL = directory client, we will find a directory (all of your member's queries will be directed elsewhere)
// DIRECTORY_MODE_SECONDARY = caching directory or mirror (keeps in sync with realm primary [adds significant cron execution time])
// DIRECTORY_MODE_PRIMARY = main directory server (you do not want this unless you are operating your own realm. one per realm.)
// DIRECTORY_MODE_STANDALONE = "off the grid" or private directory services (only local site members in directory)
App::$config['system']['directory_mode'] = DIRECTORY_MODE_NORMAL;
// PHP error logging setup
// Before doing this ensure that the webserver has permission
// to create and write to php.out in the top level Red directory,
// or change the name (below) to a file/path where this is allowed.
// Uncomment the following 4 lines to turn on PHP error logging.
//error_reporting(E_ERROR | E_WARNING | E_PARSE );
//ini_set('error_log','php.out');
//ini_set('log_errors','1');
//ini_set('display_errors', '0');

View file

@ -1,18 +1,14 @@
#sub_path_only rewrite ^__PATH__$ __PATH__/ permanent; #sub_path_only rewrite ^__PATH__$ __PATH__/ permanent;
location __PATH__/ { location __PATH__/ {
alias __FINALPATH__/; alias __FINALPATH__/;
# Force https
if ($scheme = http)
{ # Force https
if ($scheme = http) {
rewrite ^ https://$server_name$request_uri? permanent; rewrite ^ https://$server_name$request_uri? permanent;
} }
if (!-e $request_filename) if (!-e $request_filename) {
{
rewrite ^(.*)$ /index.php?q=$1; rewrite ^(.*)$ /index.php?q=$1;
} }
@ -21,10 +17,9 @@ location __PATH__/ {
# Default indexes and catch-all # Default indexes and catch-all
index index.php; index index.php;
charset utf-8; charset utf-8;
# Example PHP configuration
location ~* \.php$ location ~* \.php$
{ {
try_files $uri =404; try_files $uri =404;
@ -36,11 +31,9 @@ location __PATH__/ {
# make sure webfinger and other well known services aren't blocked # make sure webfinger and other well known services aren't blocked
# by denying dot files and rewrite request to the front controller # by denying dot files and rewrite request to the front controller
location ^~ /.well-known/ location ^~ /.well-known/ {
{
allow all; allow all;
if (!-e $request_filename) if (!-e $request_filename) {
{
rewrite ^(.*)$ /index.php?q=$1; rewrite ^(.*)$ /index.php?q=$1;
} }
} }
@ -55,20 +48,17 @@ location __PATH__/ {
# } # }
# block these file types # block these file types
location ~* \.(tpl|md|tgz|log|out)$ location ~* \.(tpl|md|tgz|log|out)$ {
{
deny all; deny all;
} }
# deny access to all dot files # deny access to all dot files
location ~ /\. location ~ /\. {
{
deny all; deny all;
} }
#deny access to store #deny access to store
location ~ /store location ~ /store {
{
deny all; deny all;
} }
@ -76,5 +66,4 @@ location __PATH__/ {
location ~ /util { location ~ /util {
deny all; deny all;
} }
} }

View file

@ -1,2 +1,2 @@
# Run poller periodically to update Hubzilla # Run poller periodically to update Hubzilla
*/10 * * * * __USER__ cd __FINALPATH__; /usr/bin/php__PHPVERSION__ Zotlabs/Daemon/Master.php Cron > /dev/null 2>&1 */10 * * * * __APP__ /usr/bin/php__PHPVERSION__ -f __FINALPATH__/Zotlabs/Daemon/Master.php Cron > /dev/null 2>&1

View file

@ -6,7 +6,7 @@
"en": "Decentralized publication platform and social network.", "en": "Decentralized publication platform and social network.",
"fr": "Plateforme de publication décentralisée et un réseau social." "fr": "Plateforme de publication décentralisée et un réseau social."
}, },
"version": "5.6~ynh1", "version": "6.0~ynh1",
"url": "https://zotlabs.org/page/hubzilla/hubzilla-project", "url": "https://zotlabs.org/page/hubzilla/hubzilla-project",
"upstream": { "upstream": {
"license": "MIT", "license": "MIT",

View file

@ -27,7 +27,7 @@ ynh_abort_if_errors
domain=$YNH_APP_ARG_DOMAIN domain=$YNH_APP_ARG_DOMAIN
path_url="/" path_url="/"
admin=$YNH_APP_ARG_ADMIN admin=$YNH_APP_ARG_ADMIN
email=$(ynh_user_get_info $admin 'mail') email=$(ynh_user_get_info --username=$admin --key=mail)
upload="256M" upload="256M"
random_string="$(ynh_string_random)$(ynh_string_random)$(ynh_string_random)" random_string="$(ynh_string_random)$(ynh_string_random)$(ynh_string_random)"
database=`expr $YNH_APP_ARG_DATABASE` database=`expr $YNH_APP_ARG_DATABASE`
@ -84,7 +84,7 @@ fi
# 1 - Hubzilla # 1 - Hubzilla
ynh_script_progression --message="Setting up Hubzilla source files..." ynh_script_progression --message="Setting up Hubzilla source files..."
git clone https://framagit.org/hubzilla/core.git "$final_path" git clone --quiet https://framagit.org/hubzilla/core.git "$final_path"
ynh_app_setting_set --app=$app --key=final_path --value=$final_path ynh_app_setting_set --app=$app --key=final_path --value=$final_path
# Download, check integrity, uncompress and patch the source from app.src # Download, check integrity, uncompress and patch the source from app.src
@ -102,7 +102,7 @@ ynh_script_progression --message="Create addon directory inside Hubzilla root fo
pushd "$final_path" pushd "$final_path"
mkdir -p extend/addon/hzaddons mkdir -p extend/addon/hzaddons
mkdir addon mkdir addon
git clone https://framagit.org/hubzilla/addons.git $final_path/extend/addon/hzaddons git clone --quiet https://framagit.org/hubzilla/addons.git $final_path/extend/addon/hzaddons
filelist=(`ls extend/addon/hzaddons`) filelist=(`ls extend/addon/hzaddons`)
cd addon cd addon
for a in "${filelist[@]}" ; do for a in "${filelist[@]}" ; do
@ -135,6 +135,7 @@ chmod -R 775 $final_path/store
# Copy the template install/htconfig.sample.php to .htconfig.php # Copy the template install/htconfig.sample.php to .htconfig.php
ynh_script_progression --message="Moving .htconfig.php to root of Hubzilla ..." ynh_script_progression --message="Moving .htconfig.php to root of Hubzilla ..."
config="$final_path/.htconfig.php" config="$final_path/.htconfig.php"
cp $final_path/install/htconfig.sample.php $config cp $final_path/install/htconfig.sample.php $config
@ -156,6 +157,7 @@ if [ $database -eq 1 ]; then
db_user=$db_name db_user=$db_name
ynh_app_setting_set --app=$app --key=db_name --value=$db_name ynh_app_setting_set --app=$app --key=db_name --value=$db_name
ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name
ynh_script_progression --message="Importing database..." ynh_script_progression --message="Importing database..."
ynh_mysql_connect_as --user="$db_name" --password="$db_pwd" --database="$db_name" < $final_path/install/schema_mysql.sql ynh_mysql_connect_as --user="$db_name" --password="$db_pwd" --database="$db_name" < $final_path/install/schema_mysql.sql
elif [ $database -eq 2 ]; then elif [ $database -eq 2 ]; then
@ -178,6 +180,7 @@ fi
#================================================= #=================================================
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion) phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
ynh_replace_string --match_string="your.mysqlhost.com" --replace_string="localhost" --target_file="$config" ynh_replace_string --match_string="your.mysqlhost.com" --replace_string="localhost" --target_file="$config"
ynh_replace_string --match_string= "mysqlpassword" --replace_string="$db_pwd" --target_file="$config" ynh_replace_string --match_string= "mysqlpassword" --replace_string="$db_pwd" --target_file="$config"
ynh_replace_string --match_string="mysqlusername" --replace_string="$db_name" --target_file="$config" ynh_replace_string --match_string="mysqlusername" --replace_string="$db_name" --target_file="$config"
@ -191,6 +194,10 @@ ynh_replace_string --match_string= "//ini_set('log_errors','1');" --replace_stri
ynh_replace_string --match_string= "//ini_set('display_errors', '0');" --replace_string="ini_set('display_errors', '0');" --target_file="$config" ynh_replace_string --match_string= "//ini_set('display_errors', '0');" --replace_string="ini_set('display_errors', '0');" --target_file="$config"
sed -i "s/\['php_path'\] = 'php';/\['php_path'\] = 'php$phpversion';/g" "$config" sed -i "s/\['php_path'\] = 'php';/\['php_path'\] = 'php$phpversion';/g" "$config"
ynh_add_config --template="../conf/local-sample.config.php" --destination="$final_path/config/local.config.php"
# addon ldap config # addon ldap config
ynh_script_progression --message="Push LDAP configuration to .htconfig.php..." ynh_script_progression --message="Push LDAP configuration to .htconfig.php..."
@ -214,6 +221,8 @@ ynh_add_fpm_config --package="$extra_php_dependencies"
# Set up cron job # Set up cron job
ynh_add_config --template="../conf/poller-cron" --destination="/etc/cron.d/$app" ynh_add_config --template="../conf/poller-cron" --destination="/etc/cron.d/$app"
chown root: "/etc/cron.d/$app"
chmod 644 "/etc/cron.d/$app"
#================================================= #=================================================
# SETUP LOGROTATE # SETUP LOGROTATE
@ -234,7 +243,7 @@ ynh_add_fail2ban_config --logpath="$final_path/php.log" --failregex="^.*auth\.ph
# SETUP SSOWAT # SETUP SSOWAT
#================================================= #=================================================
# As Hubzilla is social network and have its own permission there is no need to keep Hubzilla behind SSO # As Hubzilla is social network and have its own permission there is no need to keep Hubzilla behind SSO
ynh_script_progression --message="Configuring SSOwat..." ynh_script_progression --message="Configuring permissions..."
ynh_permission_update --permission="main" --add="visitors" ynh_permission_update --permission="main" --add="visitors"