mirror of
https://github.com/YunoHost-Apps/friendica_ynh.git
synced 2024-09-03 18:36:14 +02:00
commit
23242489ec
21 changed files with 474 additions and 464 deletions
62
README.md
62
README.md
|
@ -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
|
||||
|
||||
[](https://dash.yunohost.org/appci/app/friendica)  
|
||||
[](https://install-app.yunohost.org/?app=friendica)
|
||||
[](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://dir.friendica.social/servers
|
||||
|
||||
**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.
|
||||

|
||||
|
||||
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.
|
||||
|
||||

|
||||
|
||||
## 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
|
||||
## Documentation and resources
|
||||
|
||||
* x86-64 - [](https://ci-apps.yunohost.org/ci/apps/friendica/)
|
||||
* ARMv8-A - [](https://ci-apps-arm.yunohost.org/ci/apps/friendica/)
|
||||
* 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
|
||||
|
||||
## Links
|
||||
## Developer info
|
||||
|
||||
* 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/
|
||||
|
||||
---
|
||||
|
||||
## 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
66
README_fr.md
Normal file
|
@ -0,0 +1,66 @@
|
|||
# Friendica pour YunoHost
|
||||
|
||||
[](https://dash.yunohost.org/appci/app/friendica)  
|
||||
[](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://dir.friendica.social/servers
|
||||
|
||||
## Captures d'écran
|
||||
|
||||

|
||||
|
||||
## 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
|
|
@ -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
|
||||
change_url=1
|
||||
;;; Options
|
||||
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&
|
||||
|
|
|
@ -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
2
conf/cron
Normal file
|
@ -0,0 +1,2 @@
|
|||
# Run poller periodically to update Friendica
|
||||
*/10 * * * * __APP__ /usr/bin/php__PHPVERSION__ -f __FINALPATH__/bin/worker.php
|
|
@ -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;
|
44
conf/local-sample.config.php
Normal file
44
conf/local-sample.config.php
Normal 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',
|
||||
],
|
||||
];
|
|
@ -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
|
|
@ -1,57 +1,23 @@
|
|||
##
|
||||
# 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) {
|
||||
rewrite ^ https://$server_name$request_uri? permanent;
|
||||
}
|
||||
|
||||
if (!-e $request_filename) {
|
||||
if (!-e $request_filename) {
|
||||
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)(/.*)$;
|
||||
|
|
|
@ -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
19
doc/DISCLAIMER.md
Normal 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
19
doc/DISCLAIMER_fr.md
Normal 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.
|
BIN
doc/screenshots/friendica-vier-profile.png
Normal file
BIN
doc/screenshots/friendica-vier-profile.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 393 KiB |
|
@ -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://dir.friendica.social/servers",
|
||||
"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~ynh4",
|
||||
"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"
|
||||
}
|
||||
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,6 +4,11 @@
|
|||
# COMMON VARIABLES
|
||||
#=================================================
|
||||
|
||||
# commit hashes
|
||||
# 2021.07
|
||||
version_commit="d1d208f18b9b43916378ccfd09b963246fe631dd"
|
||||
addons_version_commit="b164910032a620bd637574bd4b42423ff8c067bb"
|
||||
|
||||
# dependencies used by the app
|
||||
YNH_PHP_VERSION="7.3"
|
||||
|
||||
|
@ -13,31 +18,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 /; then
|
||||
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
|
||||
#=================================================
|
||||
|
|
|
@ -31,7 +31,6 @@ app=$YNH_APP_INSTANCE_NAME
|
|||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||
db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
|
||||
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
|
||||
|
||||
#=================================================
|
||||
|
@ -57,6 +56,13 @@ ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
|||
|
||||
ynh_backup --src_path="/etc/php/$phpversion/fpm/pool.d/$app.conf"
|
||||
|
||||
#=================================================
|
||||
# BACKUP VARIOUS FILES
|
||||
#=================================================
|
||||
|
||||
# Backup cron job
|
||||
ynh_backup --src_path="/etc/cron.d/$app"
|
||||
|
||||
#=================================================
|
||||
# BACKUP THE MYSQL DATABASE
|
||||
#=================================================
|
||||
|
@ -64,9 +70,6 @@ ynh_print_info --message="Backing up the MySQL database..."
|
|||
|
||||
ynh_mysql_dump_db --database="$db_name" > db.sql
|
||||
|
||||
# Backup cron job
|
||||
ynh_backup --src_path="/etc/cron.d/$app"
|
||||
|
||||
#=================================================
|
||||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
|
105
scripts/change_url
Normal file
105
scripts/change_url
Normal 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=3
|
||||
|
||||
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
|
123
scripts/install
123
scripts/install
|
@ -24,20 +24,17 @@ ynh_abort_if_errors
|
|||
# RETRIEVE ARGUMENTS FROM THE MANIFEST
|
||||
#=================================================
|
||||
|
||||
# Retrieve arguments
|
||||
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
|
||||
|
||||
#=================================================
|
||||
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Validating installation parameters..."
|
||||
ynh_script_progression --message="Validating installation parameters..." --weight=1
|
||||
|
||||
final_path=/var/www/$app
|
||||
test ! -e "$final_path" || ynh_die --message="This path already contains a folder"
|
||||
|
@ -48,19 +45,25 @@ ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url
|
|||
#=================================================
|
||||
# STORE SETTINGS FROM MANIFEST
|
||||
#=================================================
|
||||
ynh_script_progression --message="Storing installation settings..."
|
||||
ynh_script_progression --message="Storing installation settings..." --weight=1
|
||||
|
||||
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..." --weight=1
|
||||
|
||||
# Create a system user
|
||||
ynh_system_user_create --username=$app --home_dir="$final_path"
|
||||
|
||||
#=================================================
|
||||
# CREATE A MYSQL DATABASE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Creating a MySQL database..."
|
||||
ynh_script_progression --message="Creating a MySQL database..." --weight=2
|
||||
|
||||
db_name=$(ynh_sanitize_dbid --db_name=$app)
|
||||
db_user=$db_name
|
||||
|
@ -70,100 +73,90 @@ ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name
|
|||
#=================================================
|
||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Setting up source files..."
|
||||
ynh_script_progression --message="Setting up source files..." --weight=5
|
||||
|
||||
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"
|
||||
|
||||
# 1 - Clone stable repo
|
||||
git clone --quiet https://github.com/friendica/friendica.git -b stable "$final_path"
|
||||
# Reset branch to the level of update we needed
|
||||
pushd "$final_path"
|
||||
git reset --hard $version_commit
|
||||
popd
|
||||
|
||||
# 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"
|
||||
git clone --quiet https://github.com/friendica/friendica-addons.git -b stable "$final_path/addon"
|
||||
# Reset addons branch to the level of update we needed
|
||||
pushd "$final_path/addon"
|
||||
git reset --hard $addons_version_commit
|
||||
popd
|
||||
|
||||
chmod 750 "$final_path"
|
||||
chmod -R o-rwx "$final_path"
|
||||
chown -R $app:www-data "$final_path"
|
||||
|
||||
#=================================================
|
||||
# NGINX CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring NGINX web server..."
|
||||
ynh_script_progression --message="Configuring NGINX web server..." --weight=1
|
||||
|
||||
# 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..." --weight=1
|
||||
|
||||
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"
|
||||
ynh_mysql_connect_as --user="$db_user" --password="$db_pwd" --database="$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
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring php-fpm..."
|
||||
ynh_script_progression --message="Configuring PHP_FPM..." --weight=4
|
||||
|
||||
# Create a dedicated php-fpm configy
|
||||
# Create a dedicated PHP-FPM configy
|
||||
ynh_add_fpm_config --package="$extra_php_dependencies"
|
||||
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
|
||||
|
||||
# 3 - some extra folders
|
||||
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
|
||||
mkdir -p "$final_path/view/smarty3"
|
||||
chmod -R 775 "$final_path/view/smarty3"
|
||||
|
||||
#=================================================
|
||||
# STORE THE CONFIG FILE CHECKSUM
|
||||
# SETUP A CRON
|
||||
#=================================================
|
||||
ynh_script_progression --message="Setuping a cron job..." --weight=1
|
||||
|
||||
# Calculate and store the config file checksum into the app settings
|
||||
ynh_store_file_checksum --file="$final_path/config/local.config.php"
|
||||
ynh_add_config --template="../conf/cron" --destination="/etc/cron.d/$app"
|
||||
chown root: "/etc/cron.d/$app"
|
||||
chmod 644 "/etc/cron.d/$app"
|
||||
|
||||
#=================================================
|
||||
# INSTALL FRIENDICA
|
||||
#=================================================
|
||||
|
||||
# Run composer
|
||||
pushd "$final_path"
|
||||
php$phpversion bin/composer.phar install 2>/dev/null
|
||||
bin/console config system addon ldapauth
|
||||
ynh_exec_as "$app" php$phpversion bin/composer.phar install --no-dev --quiet
|
||||
ynh_exec_as "$app" 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
|
||||
#=================================================
|
||||
|
||||
# unprotected_uris allows SSO credentials to be passed anyway.
|
||||
ynh_permission_update --permission="main" --add="visitors"
|
||||
|
||||
#=================================================
|
||||
# RELOAD NGINX
|
||||
#=================================================
|
||||
ynh_script_progression --message="Reloading NGINX web server..."
|
||||
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
|
||||
|
||||
ynh_systemd_action --service_name=nginx --action=reload
|
||||
|
||||
|
@ -171,4 +164,4 @@ ynh_systemd_action --service_name=nginx --action=reload
|
|||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Installation of $app completed"
|
||||
ynh_script_progression --message="Installation of $app completed" --last
|
||||
|
|
|
@ -12,7 +12,7 @@ source /usr/share/yunohost/helpers
|
|||
#=================================================
|
||||
# LOAD SETTINGS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Loading installation settings..."
|
||||
ynh_script_progression --message="Loading installation settings..." --weight=1
|
||||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
|
@ -23,7 +23,7 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
|||
#=================================================
|
||||
# REMOVE THE MYSQL DATABASE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing the MySQL database..."
|
||||
ynh_script_progression --message="Removing the MySQL database..." --weight=1
|
||||
|
||||
# Remove a database if it exists, along with the associated user
|
||||
ynh_mysql_remove_db --db_user=$db_user --db_name=$db_name
|
||||
|
@ -31,7 +31,7 @@ ynh_mysql_remove_db --db_user=$db_user --db_name=$db_name
|
|||
#=================================================
|
||||
# REMOVE DEPENDENCIES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing dependencies..."
|
||||
ynh_script_progression --message="Removing dependencies..." --weight=2
|
||||
|
||||
# Remove metapackage and its dependencies
|
||||
ynh_remove_app_dependencies
|
||||
|
@ -39,7 +39,7 @@ ynh_remove_app_dependencies
|
|||
#=================================================
|
||||
# REMOVE APP MAIN DIR
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing app main directory..."
|
||||
ynh_script_progression --message="Removing app main directory..." --weight=3
|
||||
|
||||
# Remove the app directory securely
|
||||
ynh_secure_remove --file="$final_path"
|
||||
|
@ -47,7 +47,7 @@ ynh_secure_remove --file="$final_path"
|
|||
#=================================================
|
||||
# REMOVE NGINX CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing NGINX web server configuration..."
|
||||
ynh_script_progression --message="Removing NGINX web server configuration..." --weight=1
|
||||
|
||||
# Remove the dedicated nginx config
|
||||
ynh_remove_nginx_config
|
||||
|
@ -55,19 +55,24 @@ ynh_remove_nginx_config
|
|||
#=================================================
|
||||
# REMOVE PHP-FPM CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing PHP-FPM configuration..."
|
||||
ynh_script_progression --message="Removing PHP-FPM configuration..." --weight=1
|
||||
|
||||
# Remove the dedicated php-fpm config
|
||||
# Remove the dedicated PHP-FPM config
|
||||
ynh_remove_fpm_config
|
||||
|
||||
#=================================================
|
||||
# REMOVE LOGROTATE CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing logrotate configuration..."
|
||||
ynh_script_progression --message="Removing logrotate configuration..." --weight=1
|
||||
|
||||
# Remove the app-specific logrotate config
|
||||
ynh_remove_logrotate
|
||||
|
||||
#=================================================
|
||||
# REMOVE CRON FILE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing cron file..." --weight=1
|
||||
|
||||
# Remove a cron file
|
||||
ynh_secure_remove --file="/etc/cron.d/$app"
|
||||
|
||||
|
@ -76,7 +81,7 @@ ynh_secure_remove --file="/etc/cron.d/$app"
|
|||
#=================================================
|
||||
# REMOVE DEDICATED USER
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing the dedicated system user..."
|
||||
ynh_script_progression --message="Removing the dedicated system user..." --weight=1
|
||||
|
||||
# Delete a system user
|
||||
ynh_system_user_delete --username=$app
|
||||
|
@ -85,4 +90,4 @@ ynh_system_user_delete --username=$app
|
|||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
||||
ynh_print_info "Removal of $app completed"
|
||||
ynh_script_progression --message="Removal of $app completed" --last
|
||||
|
|
|
@ -24,7 +24,7 @@ ynh_abort_if_errors
|
|||
#=================================================
|
||||
# LOAD SETTINGS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Loading settings..."
|
||||
ynh_script_progression --message="Loading settings..." --weight=1
|
||||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
|
@ -32,12 +32,14 @@ domain=$(ynh_app_setting_get --app=$app --key=domain)
|
|||
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_user=$db_name
|
||||
db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
|
||||
phpversion=$(ynh_app_setting_get --app=$app --key=phpversion)
|
||||
|
||||
#=================================================
|
||||
# CHECK IF THE APP CAN BE RESTORED
|
||||
#=================================================
|
||||
ynh_script_progression --message="Validating restoration parameters..."
|
||||
ynh_script_progression --message="Validating restoration parameters..." --weight=1
|
||||
|
||||
ynh_webpath_available --domain=$domain --path_url=$path_url \
|
||||
|| ynh_die --message="Path not available: ${domain}${path_url}"
|
||||
|
@ -49,70 +51,62 @@ test ! -d $final_path \
|
|||
#=================================================
|
||||
# RESTORE THE NGINX CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring the NGINX configuration..." --weight=1
|
||||
|
||||
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE MYSQL DATABASE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring the MySQL database..." --weight=1
|
||||
|
||||
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
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE APP MAIN DIR
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring the app main directory..."
|
||||
|
||||
ynh_restore_file --origin_path="$final_path"
|
||||
db_pwd=$(ynh_app_setting_get --app=$app --key=mysqlpwd)
|
||||
ynh_mysql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd
|
||||
ynh_mysql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql
|
||||
|
||||
#=================================================
|
||||
# RECREATE THE DEDICATED USER
|
||||
#=================================================
|
||||
ynh_print_info "Recreating the dedicated system user..."
|
||||
ynh_script_progression --message="Recreating the dedicated system user..." --weight=1
|
||||
|
||||
# Create the dedicated user (if not existing)
|
||||
ynh_system_user_create $app
|
||||
ynh_system_user_create --username=$app --home_dir="$final_path"
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE APP MAIN DIR
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring the app main directory..." --weight=1
|
||||
|
||||
ynh_restore_file --origin_path="$final_path"
|
||||
|
||||
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
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring PHP-FPM configuration..."
|
||||
ynh_script_progression --message="Restoring PHP-FPM configuration..." --weight=1
|
||||
|
||||
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_script_progression --message="Restoring various files..." --weight=1
|
||||
|
||||
ynh_restore_file "/etc/cron.d/$app"
|
||||
|
||||
#=================================================
|
||||
# Folder rights
|
||||
#=================================================
|
||||
|
||||
chown -R $app: $final_path
|
||||
|
||||
#=================================================
|
||||
# GENERIC FINALIZATION
|
||||
#=================================================
|
||||
# RELOAD NGINX AND PHP-FPM
|
||||
#=================================================
|
||||
ynh_script_progression --message="Reloading NGINX web server and PHP-FPM..."
|
||||
ynh_script_progression --message="Reloading NGINX web server and PHP-FPM..." --weight=1
|
||||
|
||||
ynh_systemd_action --service_name=php$phpversion-fpm --action=reload
|
||||
ynh_systemd_action --service_name=nginx --action=reload
|
||||
|
@ -121,4 +115,4 @@ ynh_systemd_action --service_name=nginx --action=reload
|
|||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Restoration completed for $app"
|
||||
ynh_script_progression --message="Restoration completed for $app" --last
|
||||
|
|
126
scripts/upgrade
126
scripts/upgrade
|
@ -12,7 +12,7 @@ source /usr/share/yunohost/helpers
|
|||
#=================================================
|
||||
# LOAD SETTINGS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Loading installation settings..."
|
||||
ynh_script_progression --message="Loading installation settings..." --weight=1
|
||||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
|
@ -20,8 +20,9 @@ domain=$(ynh_app_setting_get --app=$app --key=domain)
|
|||
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_user=$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)
|
||||
|
||||
|
@ -34,7 +35,7 @@ upgrade_type=$(ynh_check_app_version_changed)
|
|||
#=================================================
|
||||
# ENSURE DOWNWARD COMPATIBILITY
|
||||
#=================================================
|
||||
ynh_script_progression --message="Ensuring downward compatibility..."
|
||||
ynh_script_progression --message="Ensuring downward compatibility..." --weight=3
|
||||
|
||||
# If db_name doesn't exist, create it
|
||||
if [ -z "$db_name" ]; then
|
||||
|
@ -45,7 +46,7 @@ fi
|
|||
#=================================================
|
||||
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
||||
#=================================================
|
||||
ynh_script_progression --message="Backing up the app before upgrading (may take a while)..."
|
||||
ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=2
|
||||
|
||||
# Backup the current version of the app
|
||||
ynh_backup_before_upgrade
|
||||
|
@ -76,9 +77,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,129 +89,112 @@ 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..." --weight=1
|
||||
|
||||
# Create a dedicated user (if not existing)
|
||||
ynh_system_user_create --username=$app --home_dir="$final_path"
|
||||
|
||||
#=================================================
|
||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||
#=================================================
|
||||
|
||||
if [ "$upgrade_type" == "UPGRADE_APP" ]
|
||||
then
|
||||
|
||||
ynh_script_progression --message="Upgrading source files..." --weight=3
|
||||
# Check if the repo can be updated with git
|
||||
if [ `cd $final_path && git rev-parse --is-inside-work-tree` ];
|
||||
if [ `cd $final_path && git rev-parse --is-inside-work-tree &> /dev/null` ];
|
||||
then
|
||||
# Update through git
|
||||
# Update through Git
|
||||
pushd "$final_path"
|
||||
git fetch
|
||||
git checkout stable
|
||||
git pull
|
||||
git reset --hard $version_commit
|
||||
popd
|
||||
pushd "$final_path/addon"
|
||||
git fetch
|
||||
git checkout stable
|
||||
git pull
|
||||
git reset --hard $addons_version_commit
|
||||
popd
|
||||
# If git is not present upgrade through manual method
|
||||
# If Git is not present upgrade through manual method
|
||||
else
|
||||
|
||||
# Create a temporary directory and backup smarty3 folder
|
||||
tmpdir="$(ynh_smart_mktemp 6000)"
|
||||
ynh_script_progression --message="Upgrading source files..."
|
||||
mkdir -p "$tmpdir/view/"
|
||||
cp -a "$final_path/view/smarty3" "$tmpdir/view/smarty3"
|
||||
# Create a temporary directory and backup smarty3 folder
|
||||
tmpdir="$(mktemp -d)"
|
||||
cp -a "$final_path/view/smarty3" "$tmpdir/smarty3"
|
||||
|
||||
# Remove the app directory securely
|
||||
ynh_secure_remove "$final_path"
|
||||
|
||||
# 1- Clone stable repo
|
||||
$git clone https://github.com/friendica/friendica.git -b stable "$final_path"
|
||||
|
||||
# Remove the addon directory securely
|
||||
ynh_secure_remove "$final_path/addon"
|
||||
# 1 - Clone stable repo
|
||||
git clone --quiet https://github.com/friendica/friendica.git -b stable "$final_path"
|
||||
# Reset branch to the level of update we needed
|
||||
pushd "$final_path"
|
||||
git reset --hard $version_commit
|
||||
popd
|
||||
|
||||
# 2 - Clone addons repo
|
||||
git clone https://github.com/friendica/friendica-addons.git -b stable "$final_path/addon"
|
||||
git clone --quiet https://github.com/friendica/friendica-addons.git -b stable "$final_path/addon"
|
||||
# Reset addons branch to the level of update we needed
|
||||
pushd "$final_path/addon"
|
||||
git reset --hard $addons_version_commit
|
||||
popd
|
||||
|
||||
# Restore the smarty3 folder
|
||||
cp -a "$tmpdir/view/smarty3" "${final_path}"
|
||||
cp -a "$tmpdir/smarty3" "$final_path/view/smarty3"
|
||||
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
|
||||
chmod -R 775 "$final_path/view/smarty3"
|
||||
|
||||
#=================================================
|
||||
# NGINX CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Upgrading NGINX web server configuration..."
|
||||
ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=1
|
||||
|
||||
# Create a dedicated nginx config
|
||||
# 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
|
||||
#=================================================
|
||||
ynh_script_progression --message="Upgrading PHP-FPM configuration..."
|
||||
ynh_script_progression --message="Upgrading PHP-FPM configuration..." --weight=4
|
||||
|
||||
# Create a dedicated php-fpm config
|
||||
# Create a dedicated PHP-FPM config
|
||||
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"
|
||||
ynh_add_config --template="../conf/cron" --destination="/etc/cron.d/$app"
|
||||
chown root: "/etc/cron.d/$app"
|
||||
chmod 644 "/etc/cron.d/$app"
|
||||
|
||||
# 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"
|
||||
|
||||
# Run composer
|
||||
# Run Composer
|
||||
pushd "$final_path"
|
||||
php$phpversion bin/console dbstructure update 2> /dev/null
|
||||
bin/console config system addon ldapauth
|
||||
ynh_exec_as "$app" php$phpversion bin/composer.phar install --no-dev --quiet
|
||||
ynh_exec_as "$app" bin/console dbstructure update
|
||||
#ynh_exec_as "$app" bin/console config system addon ldapauth
|
||||
popd
|
||||
|
||||
#=================================================
|
||||
# Folder rights
|
||||
#=================================================
|
||||
|
||||
chown -R $app: $final_path
|
||||
|
||||
#=================================================
|
||||
# RELOAD NGINX
|
||||
#=================================================
|
||||
ynh_script_progression --message="Reloading NGINX web server..."
|
||||
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
|
||||
|
||||
ynh_systemd_action --service_name=nginx --action=reload
|
||||
|
||||
|
@ -218,4 +202,4 @@ ynh_systemd_action --service_name=nginx --action=reload
|
|||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Upgrade of $app completed"
|
||||
ynh_script_progression --message="Upgrade of $app completed" --last
|
||||
|
|
Loading…
Add table
Reference in a new issue