1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/diaspora_ynh.git synced 2024-09-03 18:26:13 +02:00

version fonctionnelle

Version fonctionnelle testée. A éprouver.
This commit is contained in:
Développeur égaré 2015-03-01 23:06:20 +01:00
parent a190f3e579
commit 6072030390
6 changed files with 63 additions and 56 deletions

View file

@ -3,5 +3,7 @@ diaspora_ynh
Diaspora integration for YunoHost
Thank you for being patient as deployment time can take up to about 2 hours.
The installation directory can take up to 700MB and app start time can be take 5 minutes.
There are not yet active SSO/LDAP integration.
Install can take a very long time !!

View file

@ -1,30 +1,22 @@
location PATHTOCHANGE {
alias ALIASTOCHANGE/public;
# Proxy if requested file not found
try_files $uri @diaspora;
root ROOTOCHANGE/public;
# Configure maximum picture size
# Note that Diaspora has a client side check set at 4M
client_max_body_size 5M;
client_body_buffer_size 256K;
location @diaspora {
# Configure maximum picture size
# Note that Diaspora has a client side check set at 4M
client_max_body_size 5M;
client_body_buffer_size 256K;
# Proxy if requested file not found
try_files $uri @diaspora;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto https;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto https;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_pass http://diaspora_server;
proxy_pass http://diaspora_server;
# Include SSOWAT user panel.
include conf.d/yunohost_panel.conf.inc;
# Include SSOWAT user panel.
include conf.d/yunohost_panel.conf.inc;
}
# Proxy destination
# Add as many server directives as you want
# Also takes a socket, like unix:/path/to/some/socket.sock
upstream diaspora_server {
server 127.0.0.1:3986;
}

5
conf/nginx_upstream.conf Normal file
View file

@ -0,0 +1,5 @@
upstream diaspora_server {
server 127.0.0.1:3986;
}

View file

@ -20,14 +20,6 @@
},
"example": "domain.org"
},
{
"name": "path",
"ask": {
"en": "Choose a path for Diaspora"
},
"example": "/diaspora",
"default": "/diaspora"
},
{
"name": "admin",
"ask": {

View file

@ -2,9 +2,8 @@
# Retrieve arguments
domain=$1
path=$2
user=$3
is_public=$4
user=$2
is_public=$3
# Check user parameter
sudo yunohost user list --json | grep -q "\"username\": \"$user\""
@ -15,14 +14,16 @@ fi
sudo yunohost app setting diaspora admin_user -v $user
# Check domain/path availability
sudo yunohost app checkurl $domain$path -a diaspora
sudo yunohost app checkurl $domain -a diaspora
if [[ ! $? -eq 0 ]]; then
exit 1
fi
ori_path=$(pwd)
final_path=/var/www/diaspora
full_url=https://$domain$path
full_url=https://$domain
sudo yunohost app setting diaspora final_path -v $final_path
# configure sys apt-get
@ -38,7 +39,11 @@ sudo apt-get install -t wheezy-backports redis-server -y
# get source code
git clone -b master git://github.com/diaspora/diaspora.git
sudo mv diaspora $final_path
sudo mkdir -p $final_path
tar -cf source.tar.gz diaspora/
mv source.tar.gz diaspora/public/source.tar.gz
sudo cp -ar diaspora/* $final_path
# Generate random password
@ -54,7 +59,7 @@ sudo yunohost app setting diaspora mysqlpwd -v $db_pwd
# prepare and copy diaspora config file
sed -i "s@FULLURLTOCHANGE@$full_url@g" ../conf/diaspora.yml
sed -i "s@DBUSERTOCHANGE@$db_user@g" ../conf/database.yml
sed -i "s@DBPASSTOCHANGE@$db_user@g" ../conf/database.yml
sed -i "s@DBPASSTOCHANGE@$db_pwd@g" ../conf/database.yml
sudo cp ../conf/diaspora.yml $final_path/config/
sudo cp ../conf/database.yml $final_path/config/
@ -64,30 +69,37 @@ sudo chmod 754 /etc/init.d/diaspora_ynh
sudo update-rc.d diaspora_ynh defaults
# create and config user
#sudo adduser --gecos "First Last,RoomNumber,WorkPhone,HomePhone" --quiet --disabled-login -d $final_path diaspora
sudo useradd -d $final_path diaspora
sudo adduser --gecos "First Last,RoomNumber,WorkPhone,HomePhone" --disabled-login --quiet --home $final_path diaspora
sudo chown -R diaspora:diaspora $final_path
sudo su - diaspora -c "echo '. ~/.rvm/scripts/rvm' >> ~/.bashrc"
# Config RVM and force get app deps (for debug)
sudo su - diaspora -c "PATH=$PATH:$final_path; curl -sSL https://rvm.io/mpapis.asc | gpg --import - ; curl -L dspr.tk/1t | bash;"
sudo su - diaspora -c "PATH=$PATH:$final_path; . ~/.bashrc; rvm autolibs read-fail ; rvm install 2.0 ;"
sudo su - diaspora -c "PATH=$PATH:$final_path; . ~/.bashrc; gem install nokogiri -v '1.6.1'; gem install raindrops -v '0.13.0'"
sudo su - diaspora -c "curl -sSL https://rvm.io/mpapis.asc | gpg --import - ; curl -L dspr.tk/1t | bash;"
#sudo su - diaspora -c "rvm autolibs read-fail ; rvm install 2.0 ; rvm use 2.0.0 --default"
sudo su - diaspora -c "rvm install 2.0"
sudo env REALLY_GEM_UPDATE_SYSTEM=1 gem update --system --no-user-install
# construct diaspora app
sudo su - diaspora -c "PATH=$PATH:$final_path; . ~/.bashrc; RAILS_ENV=production bundle install --without test development"
sudo su - diaspora -c "PATH=$PATH:$final_path; . ~/.bashrc; RAILS_ENV=production bundle exec rake db:create db:schema:load"
sudo su - diaspora -c "PATH=$PATH:$final_path; . ~/.bashrc; RAILS_ENV=production bundle exec rake assets:precompile"
sudo su - diaspora -c "RAILS_ENV=production bundle install --without test development"
sudo su - diaspora -c "RAILS_ENV=production bundle exec rake db:create db:schema:load"
sudo su - diaspora -c "RAILS_ENV=production bundle exec rake assets:precompile"
cd $ori_path
# start service
# debug foreman module and start service
sudo mv $final_path/.profile $final_path/.profile.bak
sudo service diaspora_ynh start
# config nginx
cat /etc/nginx/conf.d/$domain.conf | grep -q "diaspora_server"
if [ $? != 0 ]
then
sudo su - -c "cat $ori_path/../conf/nginx_upstream.conf >>/etc/nginx/conf.d/$domain.conf"
fi
sed -i "s@PATHTOCHANGE@$path@g" ../conf/nginx.conf
sed -i "s@ALIASTOCHANGE@$final_path/@g" ../conf/nginx.conf
sed -i "s@ROOTOCHANGE@$final_path/@g" ../conf/nginx.conf
sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/diaspora.conf
# Reload Nginx and regenerate SSOwat conf

View file

@ -4,6 +4,7 @@ db_user=diaspora
db_name=diaspora_production
root_pwd=$(sudo cat /etc/yunohost/mysql)
domain=$(sudo yunohost app setting diaspora domain)
full_path=$(sudo yunohost app setting diaspora final_path)
sudo service diaspora_ynh stop
@ -13,8 +14,11 @@ sudo rm -f /etc/nginx/conf.d/$domain.d/diaspora.conf
sudo service nginx reload
sudo deluser --remove-home diaspora
sudo rm -rf /var/www/diaspora
sudo killall -u diaspora
sleep 5
sudo deluser --force --remove-home diaspora
sudo rm -rf $full_path
sudo update-rc.d -f diaspora_ynh remove
sudo rm -f /etc/init.d/diaspora_ynh