1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/friendica_ynh.git synced 2024-09-03 18:36:14 +02:00

Merge pull request #54 from YunoHost-Apps/patch

Patch
This commit is contained in:
Éric Gaspar 2021-07-18 00:05:12 +02:00 committed by GitHub
commit e24c6c38a5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
20 changed files with 370 additions and 383 deletions

View file

@ -1,36 +1,31 @@
<!--
N.B.: This README was automatically generated by https://github.com/YunoHost/apps/tree/master/tools/README-generator
It shall NOT be edited by hand.
-->
# Friendica for YunoHost
[![Integration level](https://dash.yunohost.org/integration/friendica.svg)](https://dash.yunohost.org/appci/app/friendica) ![](https://ci-apps.yunohost.org/ci/badges/friendica.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/friendica.maintain.svg)
[![Install Friendica with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=friendica)
[![Install Friendica with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=friendica)
*[Lire ce readme en français.](./README_fr.md)*
> *This package allow you to install Friendica quickly and simply on a YunoHost server.
If you don't have YunoHost, please see [here](https://yunohost.org/#/install) to learn how to install and enjoy it.*
> *This package allows you to install Friendica quickly and simply on a YunoHost server.
If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/install) to learn how to install it.*
## Overview
Friendica is a software to create a distributed social network. It is part of the federation of servers that are running with Friendica, Diaspora and Hubzilla which are compatible to each other.
**Version:** 2021.04
Social Communication Server
Current snapshot in *sources*:
**Shipped version:** 2021.07~ynh1
* https://github.com/friendica/friendica: 2021.04
* https://github.com/friendica/friendica-addons: 2021.04
**Demo:** https://demo.example.com
**Warning:** It's advised to use Barracuda as MySQL DB file format for your Friendica database.
## Screenshots
## Friendica
[Friendica](http://friendi.ca/) is a decentralised communications platform that integrates social communication. Our platform links to independent social projects and corporate services.
![](./doc/screenshots/friendica-vier-profile.png)
Friendica connects you effortlessly to a federated communications network of several thousand servers, with more than half a million user registrations. You can directly connect to anyone on **Friendica**, **Mastodon**, **Diaspora**, **GnuSocial**, **Pleroma**, or **Hubzilla**, regardless where each user profile is hosted.
![](https://raw.githubusercontent.com/friendica/friendica/develop/images/screenshots/friendica-frio-green-profle-1.png)
## This app claims following features:
- [ ] Ldap integration(Ldap is broken in the latest version.[See this](https://github.com/friendica/friendica/issues/4140#issuecomment-731579013))
- [X] Multi-instance
- [ ] Add php.log in the root folder for debugging php, with logrotate applied on it (can be accesssed by **admin->logs** and entering the **php.log**).
- [ ] Fail2Ban
## Disclaimers / important information
## Installation
@ -47,28 +42,23 @@ Use the YunoHost admin panel to install Friendica by entering the GitHub repo ad
https://github.com/YunoHost-Apps/friendica_ynh
## User with ldap admin rights
## User with LDAP admin rights
**For admin rights**: When installation is complete, you will need to visit your domain page and login with the **admin account username and password** which was entered at the time of installation process. You can then create your profile and access the admin panel.
**For normal YunoHost users :** Normal LDAP users can login through Ldap authentication and create there profiles.
#### Supported architectures
* x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/friendica%20%28Official%29.svg)](https://ci-apps.yunohost.org/ci/apps/friendica/)
* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/friendica%20%28Official%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/friendica/)
## Links
## Documentation and resources
* Official app website: http://friendi.ca
* Official user documentation: https://wiki.friendi.ca/
* Official admin documentation: https://github.com/friendica/friendica/wiki
* Upstream app code repository: https://github.com/friendica/friendica
* YunoHost documentation for this app: https://yunohost.org/app_friendica
* Report a bug: https://github.com/YunoHost-Apps/friendica_ynh/issues
* App website: http://friendi.ca/
* Upstream app repository: https://github.com/friendica/friendica
* YunoHost website: https://yunohost.org/
---
## Developer info
## Developers info
Please do your pull request to the [testing branch](https://github.com/YunoHost-Apps/friendica_ynh/tree/testing).
Please send your pull request to the [testing branch](https://github.com/YunoHost-Apps/friendica_ynh/tree/testing).
To try the testing branch, please proceed like that.
```
@ -76,3 +66,5 @@ sudo yunohost app install https://github.com/YunoHost-Apps/friendica_ynh/tree/te
or
sudo yunohost app upgrade friendica -u https://github.com/YunoHost-Apps/friendica_ynh/tree/testing --debug
```
**More info regarding app packaging:** https://yunohost.org/packaging_apps

66
README_fr.md Normal file
View file

@ -0,0 +1,66 @@
# Friendica pour YunoHost
[![Niveau d'intégration](https://dash.yunohost.org/integration/friendica.svg)](https://dash.yunohost.org/appci/app/friendica) ![](https://ci-apps.yunohost.org/ci/badges/friendica.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/friendica.maintain.svg)
[![Installer Friendica avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=friendica)
*[Read this readme in english.](./README.md)*
*[Lire ce readme en français.](./README_fr.md)*
> *Ce package vous permet d'installer Friendica rapidement et simplement sur un serveur YunoHost.
Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour savoir comment l'installer et en profiter.*
## Vue d'ensemble
Serveur de Communication Social
**Version incluse :** 2021.07~ynh1
**Démo :** https://demo.example.com
## Captures d'écran
![](./doc/screenshots/friendica-vier-profile.png)
## Avertissements / informations importantes
## Installation
### Enregistrez un nouveau domaine et ajoutez-le à YunoHost
Avant l'installation, lisez les [instructions d'installation de Friendica](https://github.com/friendica/friendica/blob/develop/doc/Install.md) pour obtenir des informations importantes sur l'installation.
- Domaine dédié (doit être installé sous la racine Web comme **https://friendica.example.com/** et non **https://example.com/friendica/** )
- Friendica nécessite des certificats SSL approuvés par le navigateur.
### Installer Friendica
Utilisez le panneau d'administration YunoHost pour installer Friendica en saisissant l'adresse du dépôt GitHub dans l'URL de l'application personnalisée :
https://github.com/YunoHost-Apps/friendica_ynh
## Utilisateur avec des droits d'administrateur LDAP
**Pour les droits d'administrateur** : une fois l'installation terminée, vous devrez visiter la page de votre domaine et vous connecter avec le **nom d'utilisateur et le mot de passe du compte administrateur** qui ont été saisis au moment du processus d'installation. Vous pouvez ensuite créer votre profil et accéder au panneau d'administration.
**Pour les utilisateurs normaux de YunoHost :** Les utilisateurs LDAP normaux peuvent se connecter via l'authentification LDAP et y créer des profils.
## Documentations et ressources
* Site officiel de l'app : http://friendi.ca
* Documentation officielle utilisateur : https://wiki.friendi.ca/
* Documentation officielle de l'admin : https://github.com/friendica/friendica/wiki
* Dépôt de code officiel de l'app : https://github.com/friendica/friendica
* Documentation YunoHost pour cette app : https://yunohost.org/app_friendica
* Signaler un bug : https://github.com/YunoHost-Apps/friendica_ynh/issues
## Informations pour les développeurs
Merci de faire vos pull request sur la [branche testing](https://github.com/YunoHost-Apps/friendica_ynh/tree/testing).
Pour essayer la branche testing, procédez comme suit.
```
sudo yunohost app install https://github.com/YunoHost-Apps/friendica_ynh/tree/testing --debug
ou
sudo yunohost app upgrade friendica -u https://github.com/YunoHost-Apps/friendica_ynh/tree/testing --debug
```
**Plus d'infos sur le packaging d'applications :** https://yunohost.org/packaging_apps

View file

@ -1,7 +1,7 @@
;; Test complet
; Manifest
domain="domain.tld" (DOMAIN)
admin="john" (USER)
domain="domain.tld"
admin="john"
; Checks
pkg_linter=1
setup_sub_dir=0
@ -10,11 +10,14 @@
setup_private=0
setup_public=1
upgrade=1
upgrade=1 from_commit=b3642c110f0e927ba36ee32e738a81e6afce958f7ackup_restore=1
upgrade=1 from_commit=41c39d47e4e398339b7d6a4167ca2198dae998e3
backup_restore=1
multi_instance=1
port_already_use=0
change_url=0
;;; Options
Email=""
Notification=change
Email=
Notification=none
;;; Upgrade options
; commit=41c39d47e4e398339b7d6a4167ca2198dae998e3
name=Merge pull request #50 from YunoHost-Apps/2021.04
manifest_arg=domain=DOMAIN&path=PATH&admin=USER&language=fr&is_public=1&password=pass&port=666&

View file

@ -1,8 +0,0 @@
$a->config['system']['addon'] = 'ldapauth';
$a->config['ldapauth']['ldap_server'] = 'localhost';
$a->config['ldapauth']['ldap_searchdn'] = 'ou=users,dc=yunohost,dc=org';
$a->config['ldapauth']['ldap_userattr'] = 'uid';
$a->config['ldapauth']['ldap_autocreateaccount'] = 'true';
$a->config['ldapauth']['ldap_autocreateaccount_emailattribute'] = 'mail';

2
conf/cron Normal file
View file

@ -0,0 +1,2 @@
# Run poller periodically to update Friendica
*/10 * * * * __APP__ cd __FINALPATH__; /usr/bin/php__PHPVERSION__ bin/worker.php

View file

@ -1,112 +0,0 @@
<?php
// If automatic system installation fails:
die('The configuration you did manually contains some mistakes. Please have a look at your .htconfig.php file.');
// If you are doing the configuration manually, please remove the line above
// Copy or rename this file to .htconfig.php
// 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 = 'your.mysqlhost.com';
$db_user = 'mysqlusername';
$db_pass = 'mysqlpassword';
$db_data = 'mysqldatabasename';
// Use environment variables for mysql if they are set beforehand
if (!empty(getenv('MYSQL_HOST'))
&& !empty(getenv('MYSQL_PORT'))
&& (!empty(getenv('MYSQL_USERNAME')) || !empty(getenv('MYSQL_USER')))
&& !empty(getenv('MYSQL_PASSWORD'))
&& !empty(getenv('MYSQL_DATABASE'))) {
$db_host = getenv('MYSQL_HOST') . ':' . getenv('MYSQL_PORT');
if (!empty(getenv('MYSQL_USERNAME'))) {
$db_user = getenv('MYSQL_USERNAME');
} elseif (!empty(getenv('MYSQL_USER'))) {
$db_user = getenv('MYSQL_USER');
}
$db_pass = getenv('MYSQL_PASSWORD');
$db_data = getenv('MYSQL_DATABASE');
}
// Set the database connection charset to full Unicode (utf8mb4).
// Changing this value will likely corrupt the special characters.
// You have been warned.
$a->config['system']['db_charset'] = "utf8mb4";
// 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.
$default_timezone = 'America/Los_Angeles';
// Default system language
$a->config['system']['language'] = 'en';
// What is your site name?
$a->config['sitename'] = "YunoHost Friendica Social Network";
// 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.
$a->config['register_policy'] = REGISTER_CLOSEDS;
$a->config['register_text'] = '';
$a->config['admin_email'] = '__ADMIN_EMAIL__';
// Maximum size of an imported message, 0 is unlimited
$a->config['max_import_size'] = 200000;
// maximum size of uploaded photos
$a->config['system']['maximagesize'] = 800000;
// Location of PHP command line processor
$a->config['php_path'] = 'php';
// Server-to-server private message encryption (RINO) is allowed by default.
// set to 0 to disable, 1 to enable
$a->config['system']['rino_encrypt'] = 1;
// allowed themes (change this from admin panel after installation)
$a->config['system']['allowed_themes'] = 'quattro,vier,duepuntozero,smoothly';
// default system theme
$a->config['system']['theme'] = 'vier';
// By default allow pseudonyms
$a->config['system']['no_regfullname'] = true;
//Deny public access to the local directory
//$a->config['system']['block_local_dir'] = false;
// Location of the global directory
$a->config['system']['directory'] = 'https://dir.friendica.social';
// Allowed protocols in link URLs; HTTP protocols always are accepted
$a->config['system']['allowed_link_protocols'] = ['ftp', 'ftps', 'mailto', 'cid', 'gopher'];
// Authentication cookie lifetime, in days
$a->config['system']['auth_cookie_lifetime'] = 7;

View file

@ -0,0 +1,44 @@
<?php
// Local configuration
/* If automatic system installation fails:
*
* Copy this file to local.config.php
*
* Why local.config.php? Because it contains sensitive information which could
* give somebody complete control of your database. Apache's default
* configuration will interpret any .php file as a script and won't show the values
*
* Then set the following for your MySQL installation
*
* If you're unsure about what any of the config keys below do, please check the static/defaults.config.php file for
* detailed documentation of their data type and behavior.
*/
return [
'database' => [
'hostname' => 'localhost',
'username' => '__DB_NAME__',
'password' => '__DB_PWD__',
'database' => '__DB_NAME__',
'charset' => 'utf8mb4',
],
// ****************************************************************
// The configuration below will be overruled by the admin panel.
// Changes made below will only have an effect if the database does
// not contain any configuration for the friendica system.
// ****************************************************************
'config' => [
'admin_email' => '__EMAIL__',
'sitename' => 'Friendica Social Network',
'register_policy' => \Friendica\Module\Register::OPEN,
'register_text' => '',
],
'system' => [
'default_timezone' => 'UTC',
'language' => 'en',
],
];

View file

@ -1,41 +0,0 @@
<?php return <<<INI
; If automatic system installation fails:
; Copy this file to local.ini.php
; Why local.ini.php? Because it contains sensitive information which could
; give somebody complete control of your database. Apache's default
; configuration will interpret any .php file as a script and won't show the values
; Then set the following for your MySQL installation
[database]
hostname = localhost
username = mysqlusername
password = mysqlpassword
database = mysqldatabasename
charset = utf8mb4
; ****************************************************************
; The configuration below will be overruled by the admin panel.
; Changes made below will only have an effect if the database does
; not contain any configuration for the friendica system.
; ****************************************************************
[config]
admin_email =
sitename = Friendica Social Network
register_policy = REGISTER_OPEN
register_text =
[system]
default_timezone = UTC
language = en
INI;
// Keep this line

View file

@ -1,36 +1,6 @@
##
# Friendica Nginx configuration
# by Olaf Conradi
#
# On Debian based distributions you can add this file to
# /etc/nginx/sites-available
#
# Then customize to your needs. To enable the configuration
# symlink it to /etc/nginx/sites-enabled and reload Nginx using
#
# service nginx reload
##
##
# You should look at the following URL's in order to grasp a solid understanding
# of Nginx configuration files in order to fully unleash the power of Nginx.
#
# http://wiki.nginx.org/Pitfalls
# http://wiki.nginx.org/QuickStart
# http://wiki.nginx.org/Configuration
##
##
# This configuration assumes your domain is example.net
# You have a separate subdomain friendica.example.net
# You want all Friendica traffic to be https
# You have an SSL certificate and key for your subdomain
# You have PHP FastCGI Process Manager (php5-fpm) running on localhost
# You have Friendica installed in /var/www/friendica
##
#sub_path_only rewrite ^__PATH__$ __PATH__/ permanent;
location __PATH__/ {
alias __FINALPATH__/;
if ($scheme = http) {
@ -41,17 +11,13 @@ location __PATH__/ {
rewrite ^(.*)$ /index.php?pagename=$1;
}
#allow uploads up to 20MB in size
client_max_body_size 20m;
client_body_buffer_size 128k;
#Default indexes and catch-all
index index.php;
# make sure webfinger and other well known services aren't blocked
# by denying dot files and rewrite request to the front controller
location ^~ /.well-known/ {
@ -68,7 +34,6 @@ location __PATH__/ {
deny all;
}
#Execute and serve PHP files
location ~* \.php$ {
fastcgi_split_path_info ^(.+?\.php)(/.*)$;

View file

@ -1,2 +0,0 @@
# Run poller periodically to update Friendica
*/10 * * * * __USER__ cd __YNH_WWW_PATH__; /usr/bin/php__PHP_VERSION__ bin/worker.php

19
doc/DISCLAIMER.md Normal file
View file

@ -0,0 +1,19 @@
## Installation
### Register a new domain and add it to YunoHost
Before installing, read the [Friendica installation instructions](https://github.com/friendica/friendica/blob/develop/doc/Install.md) for important information about installation.
- Dedicated domain (must install under web root like **https://friendica.example.com/** not **https://example.com/friendica/** )
- Friendica requires browser-approved SSL certificates.
### Install Friendica
Use the YunoHost admin panel to install Friendica by entering the GitHub repo address in the custom app URL:
https://github.com/YunoHost-Apps/friendica_ynh
## User with LDAP admin rights
**For admin rights**: When installation is complete, you will need to visit your domain page and login with the **admin account username and password** which was entered at the time of installation process. You can then create your profile and access the admin panel.
**For normal YunoHost users :** Normal LDAP users can login through Ldap authentication and create there profiles.

19
doc/DISCLAIMER_fr.md Normal file
View file

@ -0,0 +1,19 @@
## Installation
### Enregistrez un nouveau domaine et ajoutez-le à YunoHost
Avant l'installation, lisez les [instructions d'installation de Friendica](https://github.com/friendica/friendica/blob/develop/doc/Install.md) pour obtenir des informations importantes sur l'installation.
- Domaine dédié (doit être installé sous la racine Web comme **https://friendica.example.com/** et non **https://example.com/friendica/** )
- Friendica nécessite des certificats SSL approuvés par le navigateur.
### Installer Friendica
Utilisez le panneau d'administration YunoHost pour installer Friendica en saisissant l'adresse du dépôt GitHub dans l'URL de l'application personnalisée :
https://github.com/YunoHost-Apps/friendica_ynh
## Utilisateur avec des droits d'administrateur LDAP
**Pour les droits d'administrateur** : une fois l'installation terminée, vous devrez visiter la page de votre domaine et vous connecter avec le **nom d'utilisateur et le mot de passe du compte administrateur** qui ont été saisis au moment du processus d'installation. Vous pouvez ensuite créer votre profil et accéder au panneau d'administration.
**Pour les utilisateurs normaux de YunoHost :** Les utilisateurs LDAP normaux peuvent se connecter via l'authentification LDAP et y créer des profils.

Binary file not shown.

After

Width:  |  Height:  |  Size: 393 KiB

View file

@ -6,15 +6,23 @@
"en": "Social Communication Server",
"fr": "Serveur de Communication Social"
},
"version": "2021.07~ynh1",
"url": "http://friendi.ca",
"upstream": {
"license": "AGPL-3.0-only",
"website": "http://friendi.ca",
"demo": "https://demo.example.com",
"admindoc": "https://github.com/friendica/friendica/wiki",
"userdoc": "https://wiki.friendi.ca/",
"code": "https://github.com/friendica/friendica"
},
"license": "AGPL-3.0-only",
"version": "2021.04~ynh2",
"maintainer": {
"name": "Anmol Sharma",
"email": ""
},
"requirements": {
"yunohost": ">= 4.1.0"
"yunohost": ">= 4.2.0"
},
"previous_maintainers": {
"name": "aymhce",
@ -31,22 +39,13 @@
{
"name": "domain",
"type": "domain",
"ask": {
"en": "Choose a domain for Friendica. Friendica must be installed on the ROOT domain, so be careful!",
"fr": "Choisissez un domaine pour Friendica.Friendica doit etre installe a la racine, soyez prudent"
},
"example": "domain.org"
},
{
"name": "admin",
"type": "user",
"ask": {
"en": "Choose the Friendica administrator (must be an existing YunoHost user)",
"fr": "Choisissez l'administrateur pour Friendica (l'utilisateur YunoHost doit exister)"
},
"example": "homer"
"example": "johndoe"
}
]
}
}

View file

@ -13,31 +13,6 @@ extra_php_dependencies="php${YNH_PHP_VERSION}-mbstring php${YNH_PHP_VERSION}-cli
# EXPERIMENTAL HELPERS
#=================================================
ynh_smart_mktemp () {
local min_size="${1:-300}"
# Transform the minimum size from megabytes to kilobytes
min_size=$(( $min_size * 1024 ))
# Check if there's enough free space in a directory
is_there_enough_space () {
local free_space=$(df --output=avail "$1" | sed 1d)
test $free_space -ge $min_size
}
if is_there_enough_space /tmp; then
local tmpdir=/tmp
elif is_there_enough_space /var; then
local tmpdir=/var
elif is_there_enough_space /; then1
local tmpdir=/
elif is_there_enough_space /home; then
local tmpdir=/home
else
ynh_die "Insufficient free space to continue..."
fi
echo "$(mktemp --directory --tmpdir="$tmpdir")"
}
#=================================================
# FUTURE OFFICIAL HELPERS
#=================================================

105
scripts/change_url Normal file
View file

@ -0,0 +1,105 @@
#!/bin/bash
#=================================================
# GENERIC STARTING
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# RETRIEVE ARGUMENTS
#=================================================
old_domain=$YNH_APP_OLD_DOMAIN
old_path=$YNH_APP_OLD_PATH
new_domain=$YNH_APP_NEW_DOMAIN
new_path=$YNH_APP_NEW_PATH
app=$YNH_APP_INSTANCE_NAME
#=================================================
# LOAD SETTINGS
#=================================================
ynh_script_progression --message="Loading installation settings..." --weight=1
# Needed for helper "ynh_add_nginx_config"
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
#=================================================
# BACKUP BEFORE CHANGE URL THEN ACTIVE TRAP
#=================================================
ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..." --weight=1
# Backup the current version of the app
ynh_backup_before_upgrade
ynh_clean_setup () {
# Remove the new domain config file, the remove script won't do it as it doesn't know yet its location.
ynh_secure_remove --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
# Restore it if the upgrade fails
ynh_restore_upgradebackup
}
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#=================================================
# CHECK WHICH PARTS SHOULD BE CHANGED
#=================================================
change_domain=0
if [ "$old_domain" != "$new_domain" ]
then
change_domain=1
fi
change_path=0
if [ "$old_path" != "$new_path" ]
then
change_path=1
fi
#=================================================
# MODIFY URL IN NGINX CONF
#=================================================
ynh_script_progression --message="Updating NGINX web server configuration..." --weight=1
nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf
# Change the path in the NGINX config file
if [ $change_path -eq 1 ]
then
# Make a backup of the original NGINX config file if modified
ynh_backup_if_checksum_is_different --file="$nginx_conf_path"
# Set global variables for NGINX helper
domain="$old_domain"
path_url="$new_path"
# Create a dedicated NGINX config
ynh_add_nginx_config
fi
# Change the domain for NGINX
if [ $change_domain -eq 1 ]
then
# Delete file checksum for the old conf file location
ynh_delete_file_checksum --file="$nginx_conf_path"
mv $nginx_conf_path /etc/nginx/conf.d/$new_domain.d/$app.conf
# Store file checksum for the new config file location
ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
fi
#=================================================
# RELOAD NGINX
#=================================================
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
ynh_systemd_action --service_name=nginx --action=reload
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Change of URL completed for $app" --last

View file

@ -28,9 +28,7 @@ ynh_abort_if_errors
domain=$YNH_APP_ARG_DOMAIN
path_url='/'
admin=$YNH_APP_ARG_ADMIN
admin_mail=$(yunohost user info $admin | grep "mail:" | cut -d' ' -f2)
is_public=1
database="1"
email=$(ynh_user_get_info --username=$admin --key=mail)
app=$YNH_APP_INSTANCE_NAME
@ -53,9 +51,15 @@ ynh_script_progression --message="Storing installation settings..."
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=admin --value=$admin
ynh_app_setting_set --app=$app --key=is_public --value=$is_public
ynh_app_setting_set --app=$app --key=email --value=$admin_mail
ynh_app_setting_set --app=$app --key=database --value=$database
ynh_app_setting_set --app=$app --key=email --value=$email
#=================================================
# CREATE DEDICATED USER
#=================================================
ynh_script_progression --message="Configuring system user..."
# Create a system user
ynh_system_user_create --username=$app --home_dir="$final_path"
#=================================================
# CREATE A MYSQL DATABASE
@ -74,13 +78,17 @@ ynh_script_progression --message="Setting up source files..."
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
# 1- Clone stable repo
git clone https://github.com/friendica/friendica.git -b stable "$final_path"
ynh_exec_warn_less git clone https://github.com/friendica/friendica.git -b stable "$final_path"
# Copy .htaccess-dist to ..htaccess
cp -f "$final_path/.htaccess-dist" "$final_path/.htaccess"
# 2 - Clone addons repo
git clone https://github.com/friendica/friendica-addons.git -b stable "$final_path/addon"
ynh_exec_warn_less git clone https://github.com/friendica/friendica-addons.git -b stable "$final_path/addon"
chmod 750 "$final_path"
chmod -R o-rwx "$final_path"
chown -R $app:www-data "$final_path"
#=================================================
# NGINX CONFIGURATION
@ -90,29 +98,18 @@ ynh_script_progression --message="Configuring NGINX web server..."
# Create a dedicated nginx config
ynh_add_nginx_config
# configure friendica
config="$final_path/config/local.config.php"
cp -f "$final_path/config/local-sample.config.php" $config
ynh_replace_string --match_string="your.mysqlhost.com" --replace_string="localhost" --target_file="$config"
ynh_replace_string --match_string="mysqlusername" --replace_string="$db_name" --target_file="$config"
ynh_replace_string --match_string="mysqldatabasename" --replace_string="$db_name" --target_file="$config"
ynh_replace_string --match_string="mysqlpassword" --replace_string="$db_pwd" --target_file="$config"
ynh_replace_string --match_string="'admin_email' => ''," --replace_string="'admin_email' => '$admin_mail'," --target_file="$config"
#ynh_replace_string --match_string="OPEN" --replace_string="CLOSED" --target_file="$config"
#=================================================
# ADD A CONFIGURATION
#=================================================
ynh_script_progression --message="Adding a configuration file..."
ynh_add_config --template="../conf/local-sample.config.php" --destination="$final_path/config/local.config.php"
# init db
ynh_mysql_connect_as "$db_name" "$db_pwd" "$db_name" < "$final_path/database.sql"
# ldap addon config
cp "../conf/addon.config.php" "$final_path/config/."
#=================================================
# CREATE DEDICATED USER
#=================================================
ynh_script_progression --message="Configuring system user..."
# Create a system user
ynh_system_user_create --username=$app
# LDAP addon config
ynh_add_config --template="../conf/addon.config.php" --destination="$final_path/config/addon.config.php"
#=================================================
# PHP-FPM CONFIGURATION
@ -127,11 +124,14 @@ phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
mkdir -p "${final_path}/view/smarty3"
chmod -R 775 $final_path/view/smarty3
# Set up poller
ynh_replace_string --match_string="__YNH_WWW_PATH__" --replace_string="$final_path" --target_file="../conf/poller-cron"
ynh_replace_string --match_string="__USER__" --replace_string="$app" --target_file="../conf/poller-cron"
ynh_replace_string --match_string="__PHP_VERSION__" --replace_string="$phpversion" --target_file="../conf/poller-cron"
cp ../conf/poller-cron /etc/cron.d/$app
#=================================================
# SETUP A CRON
#=================================================
ynh_script_progression --message="Setuping a cron..."
ynh_add_config --template="../conf/cron" --destination="/etc/cron.d/$app"
chown root: "/etc/cron.d/$app"
chmod 644 "/etc/cron.d/$app"
#=================================================
# STORE THE CONFIG FILE CHECKSUM
@ -145,14 +145,9 @@ pushd "$final_path"
php$phpversion bin/composer.phar install 2>/dev/null
bin/console config system addon ldapauth
popd
ynh_mysql_connect_as "$db_name" "$db_pwd" "$db_name" <<< "INSERT INTO addon (id, name, version, installed, hidden, timestamp, plugin_admin) VALUES (NULL, 'ldapauth', '', '1', '0', UNIX_TIMESTAMP(), '0');"
#=================================================
# Folder rights
#=================================================
chown -R $app: $final_path
#=================================================
# SETUP SSOWAT
#=================================================

View file

@ -60,6 +60,14 @@ db_pwd=$(ynh_app_setting_get $app mysqlpwd)
ynh_mysql_setup_db $db_name $db_name $db_pwd
ynh_mysql_connect_as $db_name $db_pwd $db_name < ./db.sql
#=================================================
# RECREATE THE DEDICATED USER
#=================================================
ynh_print_info "Recreating the dedicated system user..."
# Create the dedicated user (if not existing)
ynh_system_user_create --username=$app --home_dir="$final_path"
#=================================================
# RESTORE THE APP MAIN DIR
#=================================================
@ -67,13 +75,10 @@ ynh_script_progression --message="Restoring the app main directory..."
ynh_restore_file --origin_path="$final_path"
#=================================================
# RECREATE THE DEDICATED USER
#=================================================
ynh_print_info "Recreating the dedicated system user..."
# Create the dedicated user (if not existing)
ynh_system_user_create $app
chmod 750 "$final_path"
chmod -R o-rwx "$final_path"
chown -R $app:www-data "$final_path"
chmod -R 775 $final_path/view/smarty3
#=================================================
# RESTORE THE PHP-FPM CONFIGURATION
@ -85,28 +90,12 @@ ynh_restore_file --origin_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
# Recreate a dedicated php-fpm config
ynh_add_fpm_config --package="$extra_php_dependencies"
#=================================================
# SPECIFIC RESTORATION
#=================================================
# REINSTALL DEPENDENCIES
#=================================================
ynh_script_progression --message="Reinstalling dependencies..."
# set permission
chmod -R 775 $final_path/view/smarty3
#=================================================
# RESTORE THE CRON FILE
#=================================================
ynh_restore_file "/etc/cron.d/$app"
#=================================================
# Folder rights
#=================================================
chown -R $app: $final_path
#=================================================
# GENERIC FINALIZATION
#=================================================

View file

@ -21,7 +21,7 @@ path_url=$(ynh_app_setting_get --app=$app --key=path)
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
admin_mail=$(ynh_app_setting_get --app=$app --key=email)
email=$(ynh_app_setting_get --app=$app --key=email)
admin=$(ynh_app_setting_get --app=$app --key=admin)
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
@ -76,9 +76,9 @@ if [ -f $final_path/.htconfig.php ]; then
fi
# If admin_mail setting doesn't exist, create it
if [ -z $admin_mail ]; then
admin_mail=$(ynh_user_get_info --username=$admin --key=mail)
ynh_app_setting_set --app=$app --key=email --value=$admin_mail
if [ -z $email ]; then
email=$(ynh_user_get_info --username=$admin --key=mail)
ynh_app_setting_set --app=$app --key=email --value=$email
fi
# Cleaning legacy permissions
@ -88,6 +88,14 @@ if ynh_legacy_permissions_exists; then
ynh_app_setting_delete --app=$app --key=is_public
fi
#=================================================
# CREATE DEDICATED USER
#=================================================
ynh_script_progression --message="Making sure dedicated system user exists..."
# Create a dedicated user (if not existing)
ynh_system_user_create --username=$app --home_dir="$final_path"
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
@ -113,7 +121,7 @@ then
else
# Create a temporary directory and backup smarty3 folder
tmpdir="$(ynh_smart_mktemp 6000)"
tmpdir="$(mktemp -d)"
ynh_script_progression --message="Upgrading source files..."
cp -a "$final_path/view/smarty3" "$tmpdir/view/smarty3"
@ -132,24 +140,15 @@ else
# Restore the smarty3 folder
cp -a "$tmpdir/view/smarty3" "${final_path}"
ynh_secure_remove "$tmpdir"
fi
fi
# Copy config file for correct place
config="$final_path/config/local.config.php"
cp -a "/var/www/$app/config/local-sample.config.php" $config
ynh_add_config --template="../conf/local-sample.config.php" --destination="$final_path/config/local.config.php"
# Replace strings in config file
ynh_replace_string --match_string="your.mysqlhost.com" --replace_string="localhost" --target_file="$config"
ynh_replace_string --match_string="mysqlusername" --replace_string="$db_name" --target_file="$config"
ynh_replace_string --match_string="mysqldatabasename" --replace_string="$db_name" --target_file="$config"
ynh_replace_string --match_string="mysqlpassword" --replace_string="$db_pwd" --target_file= "$config"
ynh_replace_string --match_string="'admin_email' => ''," --replace_string="'admin_email' => '$admin_mail'," --target_file="$config"
#ynh_replace_string --match_string="OPEN" --replace_string="CLOSED" --target_file="$config"
# ldap addon config
cp -f "../conf/addon.config.php" "$final_path/config/."
chmod 750 "$final_path"
chmod -R o-rwx "$final_path"
chown -R $app:www-data "$final_path"
# 3 - some extra folders
chmod -R 775 $final_path/view/smarty3
@ -162,14 +161,6 @@ ynh_script_progression --message="Upgrading NGINX web server configuration..."
# Create a dedicated nginx config
ynh_add_nginx_config
#=================================================
# CREATE DEDICATED USER
#=================================================
ynh_script_progression --message="Making sure dedicated system user exists..."
# Create a dedicated user (if not existing)
ynh_system_user_create --username=$app
#=================================================
# PHP-FPM CONFIGURATION
#=================================================
@ -182,17 +173,9 @@ ynh_add_fpm_config --package="$extra_php_dependencies"
# STORE THE CONFIG FILE CHECKSUM
#=================================================
### Verify the checksum of a file, stored by `ynh_store_file_checksum` in the install script.
### And create a backup of this file if the checksum is different. So the file will be backed up if the admin had modified it.
ynh_backup_if_checksum_is_different --file="$final_path/config/local.config.php"
# Recalculate and store the checksum of the file for the next upgrade.
ynh_store_file_checksum --file="$final_path/config/local.config.php"
# Set up cron job
ynh_replace_string --match_string="__YNH_WWW_PATH__" --replace_string="$final_path" --target_file="../conf/poller-cron"
ynh_replace_string --match_string="__USER__" --replace_string="$app" --target_file="../conf/poller-cron"
ynh_replace_string --match_string="__PHP_VERSION__" --replace_string="$phpversion" --target_file="../conf/poller-cron"
cp "../conf/poller-cron" "/etc/cron.d/$app"
ynh_add_config --template="../conf/cron" --destination="/etc/cron.d/$app"
chown root: "/etc/cron.d/$app"
chmod 644 "/etc/cron.d/$app"
# Run composer
pushd "$final_path"
@ -200,12 +183,6 @@ pushd "$final_path"
bin/console config system addon ldapauth
popd
#=================================================
# Folder rights
#=================================================
chown -R $app: $final_path
#=================================================
# RELOAD NGINX
#=================================================