mirror of
https://github.com/YunoHost-Apps/friendica_ynh.git
synced 2024-09-03 18:36:14 +02:00
init
This commit is contained in:
parent
04191b15a2
commit
81a1312fd2
8 changed files with 203 additions and 17 deletions
17
.gitattributes
vendored
17
.gitattributes
vendored
|
@ -1,17 +0,0 @@
|
||||||
# Auto detect text files and perform LF normalization
|
|
||||||
* text=auto
|
|
||||||
|
|
||||||
# Custom for Visual Studio
|
|
||||||
*.cs diff=csharp
|
|
||||||
|
|
||||||
# Standard to msysgit
|
|
||||||
*.doc diff=astextplain
|
|
||||||
*.DOC diff=astextplain
|
|
||||||
*.docx diff=astextplain
|
|
||||||
*.DOCX diff=astextplain
|
|
||||||
*.dot diff=astextplain
|
|
||||||
*.DOT diff=astextplain
|
|
||||||
*.pdf diff=astextplain
|
|
||||||
*.PDF diff=astextplain
|
|
||||||
*.rtf diff=astextplain
|
|
||||||
*.RTF diff=astextplain
|
|
7
README.md
Normal file
7
README.md
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
friendica_ynh
|
||||||
|
==========
|
||||||
|
|
||||||
|
Friendica integration for YunoHost
|
||||||
|
|
||||||
|
You can use accounts from YunoHost's LDAP. There are not yet active SSO.
|
||||||
|
For upgrade, please use admin page for updates. More stable. http://friendica.com/node/27
|
8
conf/conf.php
Normal file
8
conf/conf.php
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
|
||||||
|
$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';
|
33
conf/nginx.conf
Normal file
33
conf/nginx.conf
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
location PATHTOCHANGE {
|
||||||
|
alias ALIASTOCHANGE;
|
||||||
|
client_max_body_size 10G;
|
||||||
|
index index.php;
|
||||||
|
|
||||||
|
if (!-f $request_filename) {
|
||||||
|
rewrite ^PATHTOCHANGE/(.+)$ PATHTOCHANGE/index.php?q=$1 last;
|
||||||
|
}
|
||||||
|
#try_files $uri $uri/ =404;
|
||||||
|
|
||||||
|
location ~* \.php {
|
||||||
|
include fastcgi_params;
|
||||||
|
fastcgi_split_path_info ^(.+\.php)(/.+)$;
|
||||||
|
fastcgi_param HTTPS on;
|
||||||
|
fastcgi_index index.php;
|
||||||
|
fastcgi_pass unix:/var/run/php5-fpm.sock;
|
||||||
|
#try_files $uri $uri/ =404;
|
||||||
|
}
|
||||||
|
|
||||||
|
#default_type text/html;
|
||||||
|
#location ~ [^/]\.php(/|$) {
|
||||||
|
# fastcgi_split_path_info ^(.+?\.php)(/.*)$;
|
||||||
|
# fastcgi_pass unix:/var/run/php5-fpm.sock;
|
||||||
|
# fastcgi_index index.php;
|
||||||
|
# include fastcgi_params;
|
||||||
|
# fastcgi_param REMOTE_USER $remote_user;
|
||||||
|
# fastcgi_param PATH_INFO $fastcgi_path_info;
|
||||||
|
#}
|
||||||
|
|
||||||
|
|
||||||
|
# Include SSOWAT user panel.
|
||||||
|
#include conf.d/yunohost_panel.conf.inc;
|
||||||
|
}
|
49
manifest.json
Normal file
49
manifest.json
Normal file
|
@ -0,0 +1,49 @@
|
||||||
|
{
|
||||||
|
"name": "Friendica",
|
||||||
|
"id": "friendica",
|
||||||
|
"description": {
|
||||||
|
"en": "Social Communication Server",
|
||||||
|
"fr": "Serveur de Communication Social"
|
||||||
|
},
|
||||||
|
"developer": {
|
||||||
|
"name": "aymhce",
|
||||||
|
"email": "aymhce@gmail.com",
|
||||||
|
"url": "http://friendica.com"
|
||||||
|
},
|
||||||
|
"multi_instance": "true",
|
||||||
|
"arguments": {
|
||||||
|
"install" : [
|
||||||
|
{
|
||||||
|
"name": "domain",
|
||||||
|
"ask": {
|
||||||
|
"en": "Choose a domain for Friendica"
|
||||||
|
},
|
||||||
|
"example": "domain.org"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "path",
|
||||||
|
"ask": {
|
||||||
|
"en": "Choose a path for Friendica"
|
||||||
|
},
|
||||||
|
"example": "/friendica",
|
||||||
|
"default": "/friendica"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "admin",
|
||||||
|
"ask": {
|
||||||
|
"en": "Choose the Friendica administrator (must be an existing YunoHost user)"
|
||||||
|
},
|
||||||
|
"example": "homer"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "public_site",
|
||||||
|
"ask": {
|
||||||
|
"en": "Is it a public Friendica site ?",
|
||||||
|
"fr": "Est-ce un site public ?"
|
||||||
|
},
|
||||||
|
"choices": ["Yes", "No"],
|
||||||
|
"default": "Yes"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
92
scripts/install
Normal file
92
scripts/install
Normal file
|
@ -0,0 +1,92 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Retrieve arguments
|
||||||
|
domain=$1
|
||||||
|
path=$2
|
||||||
|
user=$3
|
||||||
|
is_public=$4
|
||||||
|
|
||||||
|
# Check user parameter
|
||||||
|
sudo yunohost user list --json | grep -q "\"username\": \"$user\""
|
||||||
|
if [[ ! $? -eq 0 ]]; then
|
||||||
|
echo "Wrong user"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
sudo yunohost app setting friendica admin_user -v $user
|
||||||
|
|
||||||
|
# Check domain/path availability
|
||||||
|
sudo yunohost app checkurl $domain$path -a friendica
|
||||||
|
if [[ ! $? -eq 0 ]]; then
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Get admin mail
|
||||||
|
admin_mail=$(sudo yunohost user info $user | grep "mail:" | cut -d' ' -f2)
|
||||||
|
|
||||||
|
# Get code
|
||||||
|
version=$(cat upstream_version)
|
||||||
|
git clone -b "${version}" 'https://github.com/friendica/friendica.git'
|
||||||
|
sudo chown -R admin friendica
|
||||||
|
sudo cp -ar friendica $final_path
|
||||||
|
|
||||||
|
# Generate random password
|
||||||
|
|
||||||
|
db_pwd=$(dd if=/dev/urandom bs=1 count=200 2> /dev/null | tr -c -d 'A-Za-z0-9' | sed -n 's/\(.\{24\}\).*/\1/p')
|
||||||
|
|
||||||
|
# Use 'friendica' as database name and user
|
||||||
|
db_user=friendica
|
||||||
|
|
||||||
|
# Initialize database and store mysql password for upgrade
|
||||||
|
sudo yunohost app initdb $db_user -p $db_pwd
|
||||||
|
sudo yunohost app setting friendica mysqlpwd -v $db_pwd
|
||||||
|
|
||||||
|
# Modify Nginx configuration file and copy it to Nginx conf directory
|
||||||
|
|
||||||
|
final_path=/var/www/friendica
|
||||||
|
|
||||||
|
sed -i "s@PATHTOCHANGE@$path@g" ../conf/nginx.conf
|
||||||
|
sed -i "s@ALIASTOCHANGE@$final_path/@g" ../conf/nginx.conf
|
||||||
|
sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/friendica.conf
|
||||||
|
|
||||||
|
# configure friendica
|
||||||
|
|
||||||
|
sudo cp $final_path/htconfig.php $final_path/.htconfig.php
|
||||||
|
|
||||||
|
sudo sed -i "s@your.mysqlhost.com@localhost@g" $final_path/.htconfig.php
|
||||||
|
sudo sed -i "s@mysqlusername@$db_user@g" $final_path/.htconfig.php
|
||||||
|
sudo sed -i "s@mysqldatabasename@$db_user@g" $final_path/.htconfig.php
|
||||||
|
sudo sed -i "s@mysqlpassword@$db_pwd@g" $final_path/.htconfig.php
|
||||||
|
sudo sed -i "s/\['admin_email'\] = '';/\['admin_email'\] = '$admin_mail';/g" $final_path/.htconfig.php
|
||||||
|
|
||||||
|
# init db
|
||||||
|
|
||||||
|
mysql -u $db_user -p$db_pwd $db_user < $final_path/database.sql
|
||||||
|
|
||||||
|
# Ldap auth
|
||||||
|
|
||||||
|
wget -O ldapauth.php https://raw.githubusercontent.com/friendica/friendica-addons/master/ldapauth/ldapauth.php > /dev/null 2>&1
|
||||||
|
echo "Copy ldapauth.php to $final_path/addon/ldapauth..."
|
||||||
|
mkdir -p $final_path/addon/ldapauth
|
||||||
|
sudo cp ldapauth.php $final_path/addon/ldapauth
|
||||||
|
|
||||||
|
# Ldap auth config
|
||||||
|
|
||||||
|
sudo su -c "cat ../conf/conf.php >> $final_path/.htconfig.php"
|
||||||
|
|
||||||
|
# set permission
|
||||||
|
|
||||||
|
sudo chown -R www-data:www-data $final_path
|
||||||
|
|
||||||
|
# Reload Nginx and regenerate SSOwat conf
|
||||||
|
|
||||||
|
sudo service nginx reload
|
||||||
|
sudo yunohost app setting friendica skipped_uris -v "/"
|
||||||
|
sudo yunohost app ssowatconf
|
||||||
|
|
||||||
|
#protect URIs
|
||||||
|
|
||||||
|
if [ $is_public = "No" ];
|
||||||
|
then
|
||||||
|
sudo yunohost app setting friendica protected_uris -v "/"
|
||||||
|
sudo yunohost app ssowatconf
|
||||||
|
fi
|
13
scripts/remove
Normal file
13
scripts/remove
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
db_user=friendica
|
||||||
|
db_name=friendica
|
||||||
|
root_pwd=$(sudo cat /etc/yunohost/mysql)
|
||||||
|
domain=$(sudo yunohost app setting friendica domain)
|
||||||
|
|
||||||
|
mysql -u root -p$root_pwd -e "DROP DATABASE $db_name ; DROP USER $db_user@localhost ;"
|
||||||
|
|
||||||
|
sudo rm -rf /var/www/friendica
|
||||||
|
sudo rm -f /etc/nginx/conf.d/$domain.d/friendica.conf
|
||||||
|
|
||||||
|
sudo service nginx reload
|
1
scripts/upstream_version
Normal file
1
scripts/upstream_version
Normal file
|
@ -0,0 +1 @@
|
||||||
|
release-3.3.2
|
Loading…
Add table
Reference in a new issue