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:
parent
a190f3e579
commit
6072030390
6 changed files with 63 additions and 56 deletions
|
@ -3,5 +3,7 @@ diaspora_ynh
|
||||||
|
|
||||||
Diaspora integration for YunoHost
|
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.
|
There are not yet active SSO/LDAP integration.
|
||||||
Install can take a very long time !!
|
|
||||||
|
|
|
@ -1,30 +1,22 @@
|
||||||
location PATHTOCHANGE {
|
# Proxy if requested file not found
|
||||||
alias ALIASTOCHANGE/public;
|
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;
|
|
||||||
|
|
||||||
# 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_pass http://diaspora_server;
|
|
||||||
|
|
||||||
|
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_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;
|
||||||
|
|
||||||
# Include SSOWAT user panel.
|
# Include SSOWAT user panel.
|
||||||
include conf.d/yunohost_panel.conf.inc;
|
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
5
conf/nginx_upstream.conf
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
|
||||||
|
upstream diaspora_server {
|
||||||
|
server 127.0.0.1:3986;
|
||||||
|
}
|
||||||
|
|
|
@ -20,14 +20,6 @@
|
||||||
},
|
},
|
||||||
"example": "domain.org"
|
"example": "domain.org"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"name": "path",
|
|
||||||
"ask": {
|
|
||||||
"en": "Choose a path for Diaspora"
|
|
||||||
},
|
|
||||||
"example": "/diaspora",
|
|
||||||
"default": "/diaspora"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"name": "admin",
|
"name": "admin",
|
||||||
"ask": {
|
"ask": {
|
||||||
|
|
|
@ -2,9 +2,8 @@
|
||||||
|
|
||||||
# Retrieve arguments
|
# Retrieve arguments
|
||||||
domain=$1
|
domain=$1
|
||||||
path=$2
|
user=$2
|
||||||
user=$3
|
is_public=$3
|
||||||
is_public=$4
|
|
||||||
|
|
||||||
# Check user parameter
|
# Check user parameter
|
||||||
sudo yunohost user list --json | grep -q "\"username\": \"$user\""
|
sudo yunohost user list --json | grep -q "\"username\": \"$user\""
|
||||||
|
@ -15,14 +14,16 @@ fi
|
||||||
sudo yunohost app setting diaspora admin_user -v $user
|
sudo yunohost app setting diaspora admin_user -v $user
|
||||||
|
|
||||||
# Check domain/path availability
|
# Check domain/path availability
|
||||||
sudo yunohost app checkurl $domain$path -a diaspora
|
sudo yunohost app checkurl $domain -a diaspora
|
||||||
if [[ ! $? -eq 0 ]]; then
|
if [[ ! $? -eq 0 ]]; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
ori_path=$(pwd)
|
ori_path=$(pwd)
|
||||||
final_path=/var/www/diaspora
|
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
|
# configure sys apt-get
|
||||||
|
|
||||||
|
@ -38,7 +39,11 @@ sudo apt-get install -t wheezy-backports redis-server -y
|
||||||
|
|
||||||
# get source code
|
# get source code
|
||||||
git clone -b master git://github.com/diaspora/diaspora.git
|
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
|
# Generate random password
|
||||||
|
|
||||||
|
@ -54,7 +59,7 @@ sudo yunohost app setting diaspora mysqlpwd -v $db_pwd
|
||||||
# prepare and copy diaspora config file
|
# prepare and copy diaspora config file
|
||||||
sed -i "s@FULLURLTOCHANGE@$full_url@g" ../conf/diaspora.yml
|
sed -i "s@FULLURLTOCHANGE@$full_url@g" ../conf/diaspora.yml
|
||||||
sed -i "s@DBUSERTOCHANGE@$db_user@g" ../conf/database.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/diaspora.yml $final_path/config/
|
||||||
sudo cp ../conf/database.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
|
sudo update-rc.d diaspora_ynh defaults
|
||||||
|
|
||||||
# create and config user
|
# create and config user
|
||||||
#sudo adduser --gecos "First Last,RoomNumber,WorkPhone,HomePhone" --quiet --disabled-login -d $final_path diaspora
|
sudo adduser --gecos "First Last,RoomNumber,WorkPhone,HomePhone" --disabled-login --quiet --home $final_path diaspora
|
||||||
sudo useradd -d $final_path diaspora
|
|
||||||
sudo chown -R diaspora:diaspora $final_path
|
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)
|
# 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 "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 "rvm autolibs read-fail ; rvm install 2.0 ; rvm use 2.0.0 --default"
|
||||||
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 "rvm install 2.0"
|
||||||
|
|
||||||
|
sudo env REALLY_GEM_UPDATE_SYSTEM=1 gem update --system --no-user-install
|
||||||
|
|
||||||
# construct diaspora app
|
# construct diaspora app
|
||||||
sudo su - diaspora -c "PATH=$PATH:$final_path; . ~/.bashrc; RAILS_ENV=production bundle install --without test development"
|
sudo su - diaspora -c "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 "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 exec rake assets:precompile"
|
||||||
|
|
||||||
cd $ori_path
|
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
|
sudo service diaspora_ynh start
|
||||||
|
|
||||||
# config nginx
|
# 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@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
|
sudo cp ../conf/nginx.conf /etc/nginx/conf.d/$domain.d/diaspora.conf
|
||||||
|
|
||||||
# Reload Nginx and regenerate SSOwat conf
|
# Reload Nginx and regenerate SSOwat conf
|
||||||
|
|
|
@ -4,6 +4,7 @@ db_user=diaspora
|
||||||
db_name=diaspora_production
|
db_name=diaspora_production
|
||||||
root_pwd=$(sudo cat /etc/yunohost/mysql)
|
root_pwd=$(sudo cat /etc/yunohost/mysql)
|
||||||
domain=$(sudo yunohost app setting diaspora domain)
|
domain=$(sudo yunohost app setting diaspora domain)
|
||||||
|
full_path=$(sudo yunohost app setting diaspora final_path)
|
||||||
|
|
||||||
sudo service diaspora_ynh stop
|
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 service nginx reload
|
||||||
|
|
||||||
sudo deluser --remove-home diaspora
|
sudo killall -u diaspora
|
||||||
sudo rm -rf /var/www/diaspora
|
sleep 5
|
||||||
|
sudo deluser --force --remove-home diaspora
|
||||||
|
sudo rm -rf $full_path
|
||||||
|
|
||||||
sudo update-rc.d -f diaspora_ynh remove
|
sudo update-rc.d -f diaspora_ynh remove
|
||||||
sudo rm -f /etc/init.d/diaspora_ynh
|
sudo rm -f /etc/init.d/diaspora_ynh
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue