Install Seafile

Create DB
Add Nginx conf
This commit is contained in:
Elie 2014-08-06 20:57:24 -04:00
parent fcac4cf06a
commit a65a1045f6
8 changed files with 110 additions and 4 deletions

View file

@ -1,4 +1 @@
seafile_ynh
===========
Seafile packaged for Yunohost
Seafile 3.0.4 32bit packaged for Yunohost

View file

@ -0,0 +1 @@

View file

@ -0,0 +1 @@

View file

@ -0,0 +1 @@

8
conf/nginx.conf Normal file
View file

@ -0,0 +1,8 @@
location PATHTOCHANGE {
alias ALIASTOCHANGE;
if ($scheme = http) {
rewrite ^ https://$server_name$request_uri? permanent;
}
client_max_body_size 10G;
}

33
manifest.json Normal file
View file

@ -0,0 +1,33 @@
{
"name": "Seafile",
"id": "seafile",
"description": {
"en": "Open Source Cloud Storage",
"fr": "Stockage Cloud Open Source"
},
"developer": {
"name": "ElieSauveterre",
"email": "contact@mikangali.om",
"url": "http://www.mikangali.com/"
},
"multi_instance": "false",
"arguments": {
"install": [
{
"name": "domain",
"ask": {
"en": "Choose a domain for Seafile"
},
"example": "domain.org"
},
{
"name": "path",
"ask": {
"en": "Choose a path for Seafile"
},
"example": "/seafile",
"default": "/seafile"
}
]
}
}

55
scripts/install Normal file
View file

@ -0,0 +1,55 @@
# Retrieve arguments
domain=$1
path=$2
# Check domain/path availability
sudo yunohost app checkurl $domain$path -a seafile
if [[ ! $? -eq 0 ]]; then
exit 1
fi
# Check dependencies
sudo apt-get install -y python2.7 python-setuptools python-simplejson python-imaging python-mysqldb
# Generate random DES key & password
deskey=$(dd if=/dev/urandom bs=1 count=200 2> /dev/null | tr -c -d '[A-Za-z0-9]' | sed -n 's/\(.\{24\}\).*/\1/p')
db_pwd_ccnet=$(dd if=/dev/urandom bs=1 count=200 2> /dev/null | tr -c -d '[A-Za-z0-9]' | sed -n 's/\(.\{24\}\).*/\1/p')
db_pwd_seafile=$(dd if=/dev/urandom bs=1 count=200 2> /dev/null | tr -c -d '[A-Za-z0-9]' | sed -n 's/\(.\{24\}\).*/\1/p')
db_pwd_seahub=$(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 same database name and user
db_user_ccnet=seafile_ccnet
db_user_seafile=seafile_seafile
db_user_seahub=seafile_seahub
# Initialize databases and store mysql password for upgrade
sudo yunohost app initdb $seafile_ccnet -p $db_pwd -s $(readlink -e ../conf/SQL/ccnet_mysql.initial.sql)
sudo yunohost app setting seafile mysqlpwd_ccnet -v $db_pwd_ccnet
sudo yunohost app initdb $db_user_seafile -p $db_pwd -s $(readlink -e ../conf/SQL/seafile_mysql.initial.sql)
sudo yunohost app setting seafile mysqlpwd_seafile -v $db_pwd_seafile
sudo yunohost app initdb $seafile_seahub -p $db_pwd -s $(readlink -e ../conf/SQL/seahub_mysql.initial.sql)
sudo yunohost app setting seafile mysqlpwd_seahub -v $db_pwd_seahub
# Copy files to the right place
final_path=/var/www/seafile
sudo mkdir -p $final_path
sudo wget https://bitbucket.org/haiwen/seafile/downloads/seafile-server_3.0.4_i386.tar.gz
sudo tar xvzf seafile-server_*.tar.gz
sudo rm seafile-*.tar.gz
cd seafile-server-*
# Set permissions to roundcube directory
sudo chown -R www-data: $final_path
# Modify Nginx configuration file and copy it to Nginx conf directory
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/seafile.conf
# Reload Nginx and regenerate SSOwat conf
sudo service nginx reload
sudo yunohost app ssowatconf

10
scripts/remove Normal file
View file

@ -0,0 +1,10 @@
#!/bin/bash
db_user=seafile
db_name=seafile
root_pwd=$(sudo cat /etc/yunohost/mysql)
domain=$(sudo yunohost app setting seafile domain)
mysql -u root -p$root_pwd -e "DROP DATABASE $db_name ; DROP USER $db_user@localhost ;"
sudo rm -rf /var/www/seafile
sudo rm -f /etc/nginx/conf.d/$domain.d/seafile.conf