1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/rainloop_ynh.git synced 2024-09-03 20:16:18 +02:00

New features

- Admin password (for user 'admin')
- Rainloop installed in /var/www/rainloop/app for SSO to work (temporary
fix)
- Autoconfig langage (thanks maniackcrudelis)
- Autosetup all existing domains
- No hook yet (not implemented for domains)
This commit is contained in:
scith 2015-10-11 22:46:23 +02:00
parent 3755b973b4
commit 6d8d8c9c2b
8 changed files with 75 additions and 55 deletions

View file

@ -7,8 +7,8 @@ Rainloop is a lightweight webmail.
To configure it, go to http://DOMAIN.TLD/rainloop/app/?admin To configure it, go to http://DOMAIN.TLD/rainloop/app/?admin
- The default login is : user chosen during install - The default login is : admin
- The default password is : 12345 - The default password is : Password chosen during install
Each user can add a remote carddav server from their own parameters interface. Each user can add a remote carddav server from their own parameters interface.
If you use baikal, the CardDav address is : If you use baikal, the CardDav address is :
@ -24,8 +24,8 @@ Rainloop est un webmail simple et léger.
Pour le configurer après l'installation, veuillez vous rendre sur http://DOMAIN.TLD/rainloop/app/?admin Pour le configurer après l'installation, veuillez vous rendre sur http://DOMAIN.TLD/rainloop/app/?admin
- Le nom d'utilisateur admin par défaut est : utilisateur choisi lors de l'installation - Le nom d'utilisateur admin par défaut est : admin
- Le mot de passe admin par défaut est : 12345 - Le mot de passe admin par défaut est : Mot de passe choisi lors de l'installation
Chaque utilisateur peut ajouter un carnet d'adresse distant CardDav via leur propre paramètres. Chaque utilisateur peut ajouter un carnet d'adresse distant CardDav via leur propre paramètres.
Si vous utilisez Baikal, l'adresse à renseigner est du type : Si vous utilisez Baikal, l'adresse à renseigner est du type :

9
conf/config.php Normal file
View file

@ -0,0 +1,9 @@
<?php
$_ENV['RAINLOOP_INCLUDE_AS_API'] = true;
include '/var/www/rainloop/app/index.php';
$oConfig = \RainLoop\Api::Config();
$oConfig->SetPassword('ADMINPASSWORD');
echo $oConfig->Save() ? 'Admin password updated' : 'Admin password not updated';
?>

View file

@ -17,10 +17,10 @@ allow_themes = On
allow_user_background = Off allow_user_background = Off
; Language used by default ; Language used by default
language = "en" language = "LANGTOCHANGE"
; Admin Panel interface language ; Admin Panel interface language
language_admin = "en" language_admin = "LANGTOCHANGE"
; Allow language selection on settings screen ; Allow language selection on settings screen
allow_languages_on_settings = On allow_languages_on_settings = On
@ -147,7 +147,7 @@ view_editor_type = "Html"
; layout: 0 - no preview, 1 - side preview, 2 - bottom preview ; layout: 0 - no preview, 1 - side preview, 2 - bottom preview
view_layout = 1 view_layout = 1
view_use_checkboxes = On view_use_checkboxes = On
autologout = 30 autologout = Off
show_images = Off show_images = Off
contacts_autosave = On contacts_autosave = On
mail_use_threads = Off mail_use_threads = Off

View file

@ -5,6 +5,10 @@ location PATHTOCHANGE {
rewrite ^ https://$server_name$request_uri? permanent; rewrite ^ https://$server_name$request_uri? permanent;
} }
location ^~ PATHTOCHANGEapp/data {
deny all;
}
client_max_body_size 10G; client_max_body_size 10G;
index index.php; index index.php;
try_files $uri $uri/ index.php; try_files $uri $uri/ index.php;

View file

@ -2,7 +2,7 @@
// Enable RainLoop Api and include index file // Enable RainLoop Api and include index file
$_ENV['RAINLOOP_INCLUDE_AS_API'] = true; $_ENV['RAINLOOP_INCLUDE_AS_API'] = true;
include '/var/www/rainloop/index.php'; include '/var/www/rainloop/app/index.php';
// Retrieve email and password // Retrieve email and password
if (isset($_SERVER['HTTP_EMAIL']) && isset($_SERVER['PHP_AUTH_PW'])) { if (isset($_SERVER['HTTP_EMAIL']) && isset($_SERVER['PHP_AUTH_PW'])) {
@ -11,8 +11,8 @@ if (isset($_SERVER['HTTP_EMAIL']) && isset($_SERVER['PHP_AUTH_PW'])) {
$ssoHash = \RainLoop\Api::GetUserSsoHash($email, $password); $ssoHash = \RainLoop\Api::GetUserSsoHash($email, $password);
// redirect to webmail sso url // redirect to webmail sso url
\header('Location: https://domain.tldPATHTOCHANGE/index.php?sso&hash='.$ssoHash); \header('Location: https://domain.tldPATHTOCHANGE/app/index.php?sso&hash='.$ssoHash);
} }
else { else {
\header('Location: https://domain.tldPATHTOCHANGE/index.php'); \header('Location: https://domain.tldPATHTOCHANGE/app/index.php');
} }

View file

@ -42,13 +42,12 @@
"default": "No" "default": "No"
}, },
{ {
"name": "admin", "name": "password",
"type": "user", "type": "password",
"ask": { "ask": {
"en": "Choose the Rainloop administrator (must be an existing YunoHost user)", "en": "Choose a strong password for the 'admin' user",
"fr": "Choisissez l'administrateur Rainloop (doit être un utilisateur YunoHost déjà existant)" "fr": "Choisissez un mot de passe fort pour l'administrateur 'admin'"
}, }
"example": "homer"
} }
] ]
} }

View file

@ -6,7 +6,7 @@ app=rainloop
domain=$1 domain=$1
path=$2 path=$2
is_public=$3 is_public=$3
user=$4 password=$4
# Check user parameter # Check user parameter
sudo yunohost user list --json | grep -qi "\"username\": \"$user\"" \ sudo yunohost user list --json | grep -qi "\"username\": \"$user\"" \
@ -26,8 +26,6 @@ else
path=${path%/} path=${path%/}
fi fi
# Check domain/path availability # Check domain/path availability
sudo yunohost app checkurl $domain$path -a rainloop sudo yunohost app checkurl $domain$path -a rainloop
if [[ ! $? -eq 0 ]]; then if [[ ! $? -eq 0 ]]; then
@ -48,40 +46,51 @@ sudo yunohost app setting rainloop mysqlpwd -v $db_pwd
# Copy files to the right place # Copy files to the right place
final_path=/var/www/$app final_path=/var/www/$app
rainloop_path=${final_path}/app
sudo rm -rf $final_path sudo rm -rf $final_path
sudo mkdir -p $final_path sudo mkdir -p $final_path
sudo mkdir -p $rainloop_path
# Use of latest community edition # Use of latest community edition
sudo wget http://repository.rainloop.net/v2/webmail/rainloop-community-latest.zip -O $final_path/rainloop.zip sudo wget http://repository.rainloop.net/v2/webmail/rainloop-community-latest.zip -O $rainloop_path/rainloop.zip
sudo unzip $final_path/rainloop.zip -d $final_path/ sudo unzip $rainloop_path/rainloop.zip -d $rainloop_path/
sudo rm $final_path/rainloop.zip sudo rm $rainloop_path/rainloop.zip
# Autoconfig # Autoconfig
sudo mkdir -p $final_path/data/_data_/_default_/configs/ sudo mkdir -p $rainloop_path/data/_data_/_default_/configs/
sed -i "s@domain.tld@$domain@g" ../conf/data/configs/application.ini sed -i "s@domain.tld@$domain@g" ../conf/data/configs/application.ini
sed -i "s@ADMINUSER@$user@g" ../conf/data/configs/application.ini
sed -i "s@ADMINPASSWORD@12345@g" ../conf/data/configs/application.ini
sed -i "s@MYSQLUSER@db_user@g" ../conf/data/configs/application.ini sed -i "s@MYSQLUSER@db_user@g" ../conf/data/configs/application.ini
sed -i "s@MYSQLPASSWORD@$db_pwd@g" ../conf/data/configs/application.ini sed -i "s@MYSQLPASSWORD@$db_pwd@g" ../conf/data/configs/application.ini
sudo cp ../conf/data/configs/application.ini $final_path/data/_data_/_default_/configs/application.ini if [ $(echo $LANG | cut -c1-2) == "fr" ]
then
lang=fr
else
lang=en
fi
sed -i "s@LANGTOCHANGE@$lang@g" ../conf/data/configs/application.ini
sudo cp ../conf/data/configs/application.ini $rainloop_path/data/_data_/_default_/configs/application.ini
# Add default domain config # Set admin password
sudo mkdir -p $final_path/data/_data_/_default_/domains/ sed -i "s@ADMINPASSWORD@$password@g" ../conf/data/config.php
sudo php ../conf/data/config.php
# Add default domain configs by looping through all the domains already added
sudo mkdir -p $rainloop_path/data/_data_/_default_/domains/
sudo yunohost domain list | sed -e '1d' | while read -r line ; do
domain=${line//- }
sed -i "s@domain.tld@$domain@g" ../conf/data/domains/domain.tld.ini sed -i "s@domain.tld@$domain@g" ../conf/data/domains/domain.tld.ini
sudo cp ../conf/data/domains/domain.tld.ini $final_path/data/_data_/_default_/domains/$domain.ini sudo cp ../conf/data/domains/domain.tld.ini $rainloop_path/data/_data_/_default_/domains/$domain.ini
sudo cp ../conf/data/domains/disabled $final_path/data/_data_/_default_/domains/disabled sed -i "s@$domain@domain.tld@g" ../conf/data/domains/domain.tld.ini
done
sudo cp ../conf/data/domains/disabled $rainloop_path/data/_data_/_default_/domains/disabled
# Hooks for domains are not implemented yet, so new domains will not be added automatically
# SSO # SSO
sed -i "s@domain.tld@$domain@g" ../conf/sso.php sed -i "s@domain.tld@$domain@g" ../conf/sso.php
sed -i "s@PATHTOCHANGE@$path@g" ../conf/sso.php sed -i "s@PATHTOCHANGE@$path@g" ../conf/sso.php
sudo cp ../conf/sso.php $final_path/sso.php sudo cp ../conf/sso.php $final_path/index.php
# Temporary workaround until someone finds a way to setup NGINX properly...
sudo mkdir -p $final_path/app
sudo mv $final_path/index.php $final_path/app/index.php
sudo mv $final_path/data $final_path/app/data
sudo mv $final_path/rainloop $final_path/app/rainloop
sudo sed -i "s@index.php@app/index.php@g" $final_path/sso.php
sudo mv $final_path/sso.php $final_path/index.php
# Set permissions to rainloop directory # Set permissions to rainloop directory
# sudo mkdir -p $final_path/logs # sudo mkdir -p $final_path/logs

View file

@ -16,14 +16,18 @@ sudo yunohost app initdb $db_user -p $db_pwd
# Copy files to the right place # Copy files to the right place
final_path=/var/www/$app final_path=/var/www/$app
#sudo rm -rf $final_path/* rainloop_path=${final_path}/app
# Use of latest community edition
sudo wget http://repository.rainloop.net/v2/webmail/rainloop-community-latest.zip -O $final_path/rainloop.zip sudo rm -rf $final_path
sudo unzip -ou $final_path/rainloop.zip -d $final_path/ sudo mkdir -p $final_path
sudo rm $final_path/rainloop.zip sudo mkdir -p $rainloop_path
# Use of latest community edition
sudo wget http://repository.rainloop.net/v2/webmail/rainloop-community-latest.zip -O $rainloop_path/rainloop.zip
sudo unzip $rainloop_path/rainloop.zip -d $rainloop_path/
sudo rm $rainloop_path/rainloop.zip
# Set permissions to rainloop directory
sudo chown -R www-data:www-data /var/www/$app
# Modify Nginx configuration file and copy it to Nginx conf directory # Modify Nginx configuration file and copy it to Nginx conf directory
sed -i "s@PATHTOCHANGE@$path@g" ../conf/nginx.conf sed -i "s@PATHTOCHANGE@$path@g" ../conf/nginx.conf
@ -40,15 +44,10 @@ sudo chmod 644 $finalphpconf
# SSO # SSO
sed -i "s@domain.tld@$domain@g" ../conf/sso.php sed -i "s@domain.tld@$domain@g" ../conf/sso.php
sed -i "s@PATHTOCHANGE@$path@g" ../conf/sso.php sed -i "s@PATHTOCHANGE@$path@g" ../conf/sso.php
sudo cp ../conf/sso.php $final_path/sso.php sudo cp ../conf/sso.php $final_path/index.php
# Temporary workaround until someone finds a way to setup NGINX properly... # Set permissions to rainloop directory
sudo mkdir -p $final_path/app sudo chown -R www-data:www-data $final_path
sudo mv $final_path/index.php $final_path/app/index.php
sudo mv $final_path/data $final_path/app/data
sudo mv $final_path/rainloop $final_path/app/rainloop
sudo sed -i "s@index.php@app/index.php@g" $final_path/sso.php
sudo mv $final_path/sso.php $final_path/index.php
# Make app public if necessary # Make app public if necessary
sudo yunohost app setting $app is_public -v "$is_public" sudo yunohost app setting $app is_public -v "$is_public"