This repository has been archived by the owner on Nov 25, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 293
/
pydio-gluster.sh
executable file
·144 lines (110 loc) · 4.88 KB
/
pydio-gluster.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
#!/bin/bash
function install_from_repos {
echo 'Installing Pydio repositories'
echo '-----------------------------'
echo 'deb http://dl.ajaxplorer.info/repos/apt stable main' >> /etc/apt/sources.list
echo 'deb-src http://dl.ajaxplorer.info/repos/apt stable main' >> /etc/apt/sources.list
wget http://dl.ajaxplorer.info/repos/charles@ajaxplorer.info.gpg.key
apt-key add charles@ajaxplorer.info.gpg.key
echo 'Updating repositories list and installing Pydio'
echo '-----------------------------'
apt-get update
apt-get install php5 php5-mysql php5-ldap php-apc php-pear libattr1-dev php5-dev make imagemagick pydio
sleep 1
echo "Compiling Extended Attribute PECL Extension"
pecl install xattr
echo "extension=xattr.so" > /etc/php5/conf.d/xattr.ini
}
function update_apache_conf {
echo 'Updating Apache Configuration'
echo '-----------------------------'
# Update HTTPD Configuration
cp /usr/share/doc/pydio/apache2.sample.conf /etc/apache2/sites-enabled/pydio.conf
# Filter out the regular health checks of HAProxy
sed -i 's/CustomLog ${APACHE_LOG_DIR}\/access.log combined/SetEnvIf Request_URI « ^\/pydio\/check\.txt$" dontlog\n\tCustomLog ${APACHE_LOG_DIR}\/access_log combined env=!dontlog/' /etc/apache2/sites-enabled/000-default
}
function update_php_conf {
echo 'Updating PHP Configuration'
echo '-----------------------------'
cp /etc/php5/apache2/php.ini /etc/php5/apache2/php.ini.orig
sed -i 's/output_buffering = 4096/output_buffering = Off/g' /etc/php5/apache2/php.ini
sed -i 's/post_max_size = 8M/post_max_size = 200M/g' /etc/php5/apache2/php.ini
sed -i 's/upload_max_filesize = 2M/upload_max_filesize = 200M/g' /etc/php5/apache2/php.ini
}
function update_pydio_conf {
echo 'Updating Pydio Configuration'
echo '-----------------------------'
config_volume=$1
data_volume=$2
# Create target folders inside the gluster volumes
echo 'Configuring RHS nodes'
mkdir -p ${config_volume}/appdata
mkdir -p ${config_volume}/cache
mkdir -p ${config_volume}/log
mkdir -p ${data_volume}/public
mkdir -p ${data_volume}/common
mkdir -p ${data_volume}/users
mkdir -p /var/cache/pydio
cp -Rf /var/lib/pydio/data/plugins ${config_volume}/appdata
chown -R www-data:www-data ${config_volume}
chown -R www-data:www-data ${data_volume}
chown -R www-data:www-data /var/cache/pydio
cp /etc/pydio/bootstrap_repositories.php /etc/pydio/bootstrap_repositories.php.orig
cp /etc/pydio/bootstrap_context.php /etc/pydio/bootstrap_context.php.orig
sed -i "s#AJXP_INSTALL_PATH.\"/data\"#\"${config_volume}\/appdata\"#g" /etc/pydio/bootstrap_context.php
sed -i "s#AJXP_INSTALL_PATH.\"/data/cache\"#\"${config_volume}/cache\"#g" /etc/pydio/bootstrap_context.php
sed -i "s#AJXP_DATA_PATH.\"/cache\"#\"/var/cache/pydio\"#g" /etc/pydio/bootstrap_context.php
sed -i "s#\"AJXP_DATA_PATH/files\"#\"${data_volume}/common\"#g" /etc/pydio/bootstrap_repositories.php
sed -i "s#\"AJXP_DATA_PATH/personal/AJXP_USER\"#\"${data_volume}/users/AJXP_USER\"#g" /etc/pydio/bootstrap_repositories.php
}
# CONFIG_VOLUME /mnt/pydio-config
# DATA_VOLUME /mnt/pydio-data
echo "--- Describe Gluster volumes ---"
data_volume_default="/mnt/pydio-data"
read -p "Data volume [$data_volume_default]: " data_volume
data_volume="${data_volume:-$data_volume_default}"
config_volume_default="/mnt/pydio-config"
read -p "Config volume [$config_volume_default]: " config_volume
config_volume="${config_volume:-$config_volume_default}"
echo "Pydio will be installed on the following volumes: $data_volume , $config_volume"
read -p "Are you sure? " -n 1 -r
echo # (optional) move to a new line
if [[ ! $REPLY =~ ^[Yy]$ ]]
then
exit 1
fi
install_from_repos
sleep 1
update_apache_conf
sleep 1
update_php_conf
sleep 1
update_pydio_conf ${config_volume} ${data_volume}
sleep 1
apachectl restart
# Deploy patches if necessary
if [ -d ${config_volume}/install_patches ]
then
cp -Rf ${config_volume}/install_patches/* /usr/share/pydio/
cp ${config_volume}/install_patches/.*?? /usr/share/pydio/
fi
echo 'Finalizing Installation status'
if [ -e ${config_volume}/skip_install ]
then
touch /var/cache/pydio/admin_counted
touch /var/cache/pydio/first_run_passed
touch /var/cache/pydio/diag_result.php
touch /usr/share/pydio/check.txt
echo '-----------------------'
echo 'Pydio is ready to go. Configurations were launched from RHS node.'
echo 'You can verify this by opening http://yourhost/pydio/ through a web browser'
echo '-----------------------'
else
touch /usr/share/pydio/check.txt
touch ${config_volume}/skip_install
echo '-----------------------'
echo 'Your first Pydio node is now running.'
echo 'Please open http://yourhost/pydio/ in a web browser and follow the setup wizard.'
echo 'Then you should update the necessary settings, particularly the outside world IP of the installation, in the Pydio Core Options.'
echo '-----------------------'
fi