[wip] map home dir

This commit is contained in:
Julien Malik 2014-10-04 18:58:01 +02:00
parent 4521dbbd86
commit b7be77ece7
7 changed files with 228 additions and 18 deletions

5
TODO
View file

@ -1,4 +1,5 @@
* user's home dirs, in replacement of "My Files"
* Put common files in /home/yunohost.app
* specific php-fpm with output_buffering OFF, higher upload limit, ...
* upgrade script
* perf improvements
* https://pyd.io/administrator/enriching-your-users-experience/tuning-server-performances-apc-powerfs-xsendfile/
* https://pyd.io/administrator/enriching-your-users-experience/websocket-server-activation/

View file

@ -0,0 +1,178 @@
<?php
/*
* Copyright 2007-2013 Charles du Jeu - Abstrium SAS <team (at) pyd.io>
* This file is part of Pydio.
*
* Pydio is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Pydio is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Pydio. If not, see <http://www.gnu.org/licenses/>.
*
* The latest code can be found at <http://pyd.io/>.
*
* Description : configuration file
* BASIC REPOSITORY CONFIGURATION.
* The standard repository will point to the data path (ajaxplorer/data by default), folder "files"
* Use the GUI to add new repositories.
* + Log in as "admin" and open the "Settings" Repository
*/
defined('AJXP_EXEC') or die( 'Access not allowed');
$REPOSITORIES[0] = array(
"DISPLAY" => "Default Files",
"DISPLAY_ID" => 430,
"DESCRIPTION_ID"=> 475,
"AJXP_SLUG" => "default",
"DRIVER" => "fs",
"DRIVER_OPTIONS"=> array(
"PATH" => "AJXP_DATA_PATH/common_files",
"CREATE" => true,
"RECYCLE_BIN" => '.pydio_recycle_bin',
"CHMOD_VALUE" => '0600',
"DEFAULT_RIGHTS"=> "",
"PAGINATION_THRESHOLD" => 500,
"PAGINATION_NUMBER" => 200,
"META_SOURCES" => array(
"metastore.serial"=> array(
"METADATA_FILE" => ".ajxp_meta",
"METADATA_FILE_LOCATION" => "infolders"
),
"meta.user" => array(
"meta_fields" => "tags",
"meta_labels" => "Tags",
"meta_visibility" => "hidden"
),
"meta.filehasher" => array(),
"meta.watch" => array(),
"meta.syncable" => array(),
"meta.exif" => array(
"meta_fields" => "COMPUTED_GPS.GPS_Latitude,COMPUTED_GPS.GPS_Longitude",
"meta_labels" => "Latitude,Longitude"
),
"index.lucene" => array(
"index_meta_fields" => "tags"
),
)
),
);
$REPOSITORIES[1] = array(
"DISPLAY" => "My Files",
"DISPLAY_ID" => 432,
"DESCRIPTION_ID"=> 476,
"AJXP_SLUG" => "my-files",
"DRIVER" => "fs",
"DRIVER_OPTIONS"=> array(
"PATH" => "/home/AJXP_USER",
"CREATE" => true,
"RECYCLE_BIN" => '.pydio_recycle_bin',
"CHMOD_VALUE" => '0600',
"DEFAULT_RIGHTS"=> "rw",
"PAGINATION_THRESHOLD" => 500,
"PAGINATION_NUMBER" => 200,
"META_SOURCES" => array(
"metastore.serial"=> array(
"METADATA_FILE" => ".ajxp_meta",
"METADATA_FILE_LOCATION" => "infolders"
),
"meta.user" => array(
"meta_fields" => "tags",
"meta_labels" => "Tags",
"meta_visibility" => "hidden"
),
"meta.filehasher" => array(),
"meta.watch" => array(),
"meta.syncable" => array(),
"meta.exif" => array(
"meta_fields" => "COMPUTED_GPS.GPS_Latitude,COMPUTED_GPS.GPS_Longitude",
"meta_labels" => "Latitude,Longitude"
),
"index.lucene" => array(
"index_meta_fields" => "tags",
"repository_specific_keywords" => "AJXP_USER",
)
)
),
);
// DO NOT REMOVE THIS!
// USER DASHBOARD
$REPOSITORIES["ajxp_user"] = array(
"DISPLAY" => "My Dashboard",
"AJXP_SLUG" => "dashboard",
"DISPLAY_ID" => "user_dash.title",
"DESCRIPTION_ID" => "user_dash.desc",
"DRIVER" => "ajxp_user",
"DRIVER_OPTIONS" => array(
"DEFAULT_RIGHTS" => "rw"
)
);
$REPOSITORIES["ajxp_home"] = array(
"DISPLAY" => "Welcome",
"AJXP_SLUG" => "welcome",
"DISPLAY_ID" => "user_home.title",
"DESCRIPTION_ID" => "user_home.desc",
"DRIVER" => "ajxp_home",
"DRIVER_OPTIONS" => array(
"DEFAULT_RIGHTS" => "rw"
)
);
// ADMIN REPOSITORY
$REPOSITORIES["ajxp_conf"] = array(
"DISPLAY" => "Settings",
"AJXP_SLUG" => "settings",
"DISPLAY_ID" => "165",
"DESCRIPTION_ID" => "506",
"DRIVER" => "ajxp_conf",
"DRIVER_OPTIONS" => array()
);
$REPOSITORIES["fs_template"] = array(
"DISPLAY" => "Sample Template",
"DISPLAY_ID" => 431,
"IS_TEMPLATE" => true,
"DRIVER" => "fs",
"DRIVER_OPTIONS"=> array(
"CREATE" => true,
"RECYCLE_BIN" => 'recycle_bin',
"CHMOD_VALUE" => '0600',
"PAGINATION_THRESHOLD" => 500,
"PAGINATION_NUMBER" => 200,
"PURGE_AFTER" => 0,
"CHARSET" => "",
"META_SOURCES" => array(
"metastore.serial"=> array(
"METADATA_FILE" => ".ajxp_meta",
"METADATA_FILE_LOCATION" => "infolders"
),
"meta.user" => array(
"meta_fields" => "tags",
"meta_labels" => "Tags",
"meta_visibility" => "hidden"
),
"meta.filehasher" => array(),
"meta.watch" => array(),
"meta.syncable" => array(),
"meta.exif" => array(
"meta_fields" => "COMPUTED_GPS.GPS_Latitude,COMPUTED_GPS.GPS_Longitude",
"meta_labels" => "Latitude,Longitude"
),
"index.lucene" => array(
"index_meta_fields" => "tags"
)
)
),
);

View file

@ -1,6 +1,6 @@
; Start a new pool named 'www'.
; Start a new pool named 'NAMETOCHANGE'.
; the variable $pool can we used in any directive and will be replaced by the
; pool name ('www' here)
; pool name ('NAMETOCHANGE' here)
[NAMETOCHANGE]
; Per pool prefix
@ -80,7 +80,7 @@ pm = dynamic
; CGI.
; Note: Used when pm is set to either 'static' or 'dynamic'
; Note: This value is mandatory.
pm.max_children = 6
pm.max_children = 15
; The number of child processes created on startup.
; Note: Used only when pm is set to 'dynamic'

View file

@ -1,3 +1,3 @@
upload_max_filesize=10G
post_max_size=10G
output_buffering=Off
output_buffering=off

4
hooks/post_user_create Normal file
View file

@ -0,0 +1,4 @@
#!/bin/bash
user=$1
sudo setfacl -m g:pydio:rwx /home/$user

View file

@ -18,6 +18,9 @@ if [[ ! $? -eq 0 ]]; then
exit 1
fi
# Install dependencies
sudo apt-get install acl -y -qq
mkdir ../upstream
version=$(cat version)
wget -O ../upstream/pydio-core.tar.gz http://sourceforge.net/projects/ajaxplorer/files/pydio/dev-channel/$version/pydio-core-$version.tar.gz
@ -34,6 +37,7 @@ sudo mkdir -p $final_path
sudo cp -ar ../upstream/pydio-core-$version/* $final_path
sudo mkdir -p $data_path
sudo mv $final_path/data $data_path
# Database
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')
@ -41,19 +45,23 @@ db_user=pydio
sudo yunohost app initdb $db_user -p $db_pwd -s $(readlink -e ../conf/create.mysql)
sudo yunohost app setting pydio mysqlpwd -v $db_pwd
sudo cp ../conf/bootstrap_context.php $final_path/conf
sudo cp ../conf/bootstrap_repositories.php $final_path/conf
sed -i "s@YNH_MYSQL_PWD@$db_pwd@g" ../conf/bootstrap.json
sed -i "s@YNH_ADMIN@$admin@g" ../conf/bootstrap.json
sudo mkdir -p $final_path/data/plugins/boot.conf
sudo cp ../conf/bootstrap.json $final_path/data/plugins/boot.conf/bootstrap.json
sudo mkdir -p $data_path/data/plugins/boot.conf
sudo cp ../conf/bootstrap.json $data_path/data/plugins/boot.conf/bootstrap.json
sudo yunohost app setting pydio admin -v $admin
sudo cp ../conf/bootstrap_context.php $final_path/conf
sudo touch $data_path/data/cache/admin_counted
sudo touch $data_path/data/cache/first_run_passed
sudo touch $data_path/data/cache/diag_result.php
sudo touch $final_path/data/cache/admin_counted
sudo touch $final_path/data/cache/first_run_passed
sudo touch $final_path/data/cache/diag_result.php
sudo mv $final_path/data $data_path
# let's rename the "Common Files" repository mount to common_files
# also, "files" mount is useless now since we map to /home/AJXP_USER directly
sudo mkdir -p $data_path/data/common_files
sudo rm -rf $data_path/data/{files,personal}
# Fix up permissions
sudo chown -R root: $final_path
@ -64,16 +72,26 @@ sudo chown -R pydio:pydio $data_path
sudo find $data_path/data -type f -exec chmod 660 {} \;
sudo find $data_path/data -type d -exec chmod 770 {} \;
# Allow pydio to access user's home
for i in $(ls /home)
do
sudo yunohost user list --json | grep -q "\"username\": \"$i\""
if [[ $? -eq 0 ]];
then
sudo setfacl -m g:pydio:rwx /home/$i
fi
done
sed -i "s@NAMETOCHANGE@pydio@g" ../conf/php-fpm.conf
finalphpconf=/etc/php5/fpm/pool.d/pydio.conf
sudo cp ../conf/php-fpm.conf $finalphpconf
sudo chown root: $finalphpconf
sudo chmod 644 $finalphpconf
finalphpini=/etc/php5/fpm/conf.d/20-pydio.ini
sudo cp ../conf/php-fpm.ini $finalphpini
sudo chown root: $finalphpini
sudo chmod 644 $finalphpini
#finalphpini=/etc/php5/fpm/conf.d/20-pydio.ini
#sudo cp ../conf/php-fpm.ini $finalphpini
#sudo chown root: $finalphpini
#sudo chmod 644 $finalphpini
# Nginx configuration
sed -i "s@NAMETOCHANGE@pydio@g" ../conf/nginx.conf

View file

@ -14,6 +14,15 @@ db_name=pydio
root_pwd=$(sudo cat /etc/yunohost/mysql)
mysql -u root -p$root_pwd -e "DROP DATABASE $db_name ; DROP USER $db_user@localhost ;"
for i in $(ls /home)
do
sudo yunohost user list --json | grep -q "\"username\": \"$i\""
if [[ $? -eq 0 ]];
then
sudo setfacl -x g:pydio:rwx /home/$i
fi
done
sudo userdel pydio > /dev/null 2>&1
sudo service nginx reload