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

Merge pull request #28 from YunoHost-Apps/testing

Release v0.7.16.0~ynh1
This commit is contained in:
Augustin Trancart 2022-03-02 16:12:29 +01:00 committed by GitHub
commit ee7996edba
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 266 additions and 112 deletions

View file

@ -1,29 +1,50 @@
diaspora_ynh <!--
========== N.B.: This README was automatically generated by https://github.com/YunoHost/apps/tree/master/tools/README-generator
It shall NOT be edited by hand.
-->
[![Integration level](https://dash.yunohost.org/integration/diaspora.svg)](https://dash.yunohost.org/appci/app/diaspora) ![](https://ci-apps.yunohost.org/ci/badges/diaspora.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/diaspora.maintain.svg)[![Shipped version](https://img.shields.io/github/v/release/yunohost-apps/diaspora_ynh)](https://github.com/yunohost-apps/diaspora_ynh/releases) # Diaspora for YunoHost
[![Install diaspora with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=diaspora) [![Integration level](https://dash.yunohost.org/integration/diaspora.svg)](https://dash.yunohost.org/appci/app/diaspora) ![](https://ci-apps.yunohost.org/ci/badges/diaspora.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/diaspora.maintain.svg)
[![Install Diaspora with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=diaspora)
*[Lire ce readme en français.](./README_fr.md)*
> *This package allows you to install Diaspora quickly and simply on a YunoHost server.
If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/install) to learn how to install it.*
## Overview ## Overview
> *This package allow you to install diaspora* quickly and simply on a YunoHost server. Distributed social networking service
If you don't have YunoHost, please see [here](https://yunohost.org/#/install) to know how to install and enjoy it.*
**Shipped version:** 0.7.13.0 **Shipped version:** 0.7.16.0~ynh1
Notes
--------------
Before installing, you have to:
- get a dedicated domain (must install under web root like **https://diaspora.example.com/** not **https://example.com/diaspora/**)
- get a valid SSL certificate
Installation effects:
- Thank you for being patient as deployment time can take up to about 1 hour (raspberry pi).
- The installation directory can take up to 900MB and app start time can be take 5 minutes
Report a bug: https://github.com/YunoHost-Apps/diaspora_ynh/issues
## Disclaimers / important information
- There is currently no LDAP integration
- the installation is very long, especially the frontend building step
- As upstream doesn't support it, there is no possibility to change the endpoint/url of diaspora\*. Please choose it carefully!
## Documentation and resources
* Official app website: https://diasporafoundation.org/
* Official user documentation: https://wiki.diasporafoundation.org/FAQ_for_users
* Official admin documentation: https://wiki.diasporafoundation.org/FAQ_for_pod_maintainers
* Upstream app code repository: https://github.com/diaspora/diaspora
* YunoHost documentation for this app: https://yunohost.org/app_diaspora
* Report a bug: https://github.com/YunoHost-Apps/diaspora_ynh/issues
## Developer info
Please send your pull request to the [testing branch](https://github.com/YunoHost-Apps/diaspora_ynh/tree/testing).
To try the testing branch, please proceed like that.
```
sudo yunohost app install https://github.com/YunoHost-Apps/diaspora_ynh/tree/testing --debug
or
sudo yunohost app upgrade diaspora -u https://github.com/YunoHost-Apps/diaspora_ynh/tree/testing --debug
```
**More info regarding app packaging:** https://yunohost.org/packaging_apps

46
README_fr.md Normal file
View file

@ -0,0 +1,46 @@
# Diaspora pour YunoHost
[![Niveau d'intégration](https://dash.yunohost.org/integration/diaspora.svg)](https://dash.yunohost.org/appci/app/diaspora) ![](https://ci-apps.yunohost.org/ci/badges/diaspora.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/diaspora.maintain.svg)
[![Installer Diaspora avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=diaspora)
*[Read this readme in english.](./README.md)*
*[Lire ce readme en français.](./README_fr.md)*
> *Ce package vous permet d'installer Diaspora rapidement et simplement sur un serveur YunoHost.
Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour savoir comment l'installer et en profiter.*
## Vue d'ensemble
Service de réseau social distribué
**Version incluse :** 0.7.16.0~ynh1
## Avertissements / informations importantes
- Il n'y a pas d'intégration LDAP pour le moment.
- L'installation est très longue, en particulier l'étape de build du frontend.
- le projet amont ne supporte pas les changements d'url, ainsi l'application yunohost ne supporte pas non plus cette action.
## Documentations et ressources
* Site officiel de l'app : https://diasporafoundation.org/
* Documentation officielle utilisateur : https://wiki.diasporafoundation.org/FAQ_for_users
* Documentation officielle de l'admin : https://wiki.diasporafoundation.org/FAQ_for_pod_maintainers
* Dépôt de code officiel de l'app : https://github.com/diaspora/diaspora
* Documentation YunoHost pour cette app : https://yunohost.org/app_diaspora
* Signaler un bug : https://github.com/YunoHost-Apps/diaspora_ynh/issues
## Informations pour les développeurs
Merci de faire vos pull request sur la [branche testing](https://github.com/YunoHost-Apps/diaspora_ynh/tree/testing).
Pour essayer la branche testing, procédez comme suit.
```
sudo yunohost app install https://github.com/YunoHost-Apps/diaspora_ynh/tree/testing --debug
ou
sudo yunohost app upgrade diaspora -u https://github.com/YunoHost-Apps/diaspora_ynh/tree/testing --debug
```
**Plus d'infos sur le packaging d'applications :** https://yunohost.org/packaging_apps

View file

@ -10,15 +10,10 @@
setup_root=1 setup_root=1
setup_nourl=0 setup_nourl=0
upgrade=1 upgrade=1
upgrade=1 from_commit=0.7.13.0-ynh1
upgrade=1 from_commit=0.7.13.0-ynh2
backup_restore=1 backup_restore=1
multi_instance=1 multi_instance=1
port_already_use=0 port_already_use=0
change_url=0 # not supported upstream change_url=0 # not supported upstream
;;; Levels
# If the level 5 (Package linter) is forced to 1. Please add justifications here.
Level 5=auto
;;; Options ;;; Options
Email= Email=
Notification=none Notification=none

View file

@ -9,5 +9,35 @@ WorkingDirectory=__FINALPATH__/diaspora
ExecStart=/bin/bash -lc "bin/bundle exec sidekiq" ExecStart=/bin/bash -lc "bin/bundle exec sidekiq"
Restart=always Restart=always
# Sandboxing options to harden security
# Depending on specificities of your service/app, you may need to tweak these
# .. but this should be a good baseline
# Details for these options: https://www.freedesktop.org/software/systemd/man/systemd.exec.html
NoNewPrivileges=yes
PrivateTmp=yes
PrivateDevices=yes
RestrictAddressFamilies=AF_UNIX AF_INET AF_INET6
RestrictNamespaces=yes
RestrictRealtime=yes
DevicePolicy=closed
ProtectSystem=full
ProtectControlGroups=yes
ProtectKernelModules=yes
ProtectKernelTunables=yes
LockPersonality=yes
SystemCallFilter=~@clock @debug @module @mount @obsolete @reboot @setuid @swap
# Denying access to capabilities that should not be relevant for webapps
# Doc: https://man7.org/linux/man-pages/man7/capabilities.7.html
CapabilityBoundingSet=~CAP_RAWIO CAP_MKNOD
CapabilityBoundingSet=~CAP_AUDIT_CONTROL CAP_AUDIT_READ CAP_AUDIT_WRITE
CapabilityBoundingSet=~CAP_SYS_BOOT CAP_SYS_TIME CAP_SYS_MODULE CAP_SYS_PACCT
CapabilityBoundingSet=~CAP_LEASE CAP_LINUX_IMMUTABLE CAP_IPC_LOCK
CapabilityBoundingSet=~CAP_BLOCK_SUSPEND CAP_WAKE_ALARM
CapabilityBoundingSet=~CAP_SYS_TTY_CONFIG
CapabilityBoundingSet=~CAP_MAC_ADMIN CAP_MAC_OVERRIDE
CapabilityBoundingSet=~CAP_NET_ADMIN CAP_NET_BROADCAST CAP_NET_RAW
CapabilityBoundingSet=~CAP_SYS_ADMIN CAP_SYS_PTRACE CAP_SYSLOG
[Install] [Install]
WantedBy=__APP__.target WantedBy=__APP__.target

View file

@ -11,5 +11,36 @@ ExecStart=/bin/bash -lc "bin/bundle exec unicorn -c config/unicorn.rb -E product
ExecReload=/bin/kill -USR2 $MAINPID ExecReload=/bin/kill -USR2 $MAINPID
Restart=always Restart=always
# Sandboxing options to harden security
# Depending on specificities of your service/app, you may need to tweak these
# .. but this should be a good baseline
# Details for these options: https://www.freedesktop.org/software/systemd/man/systemd.exec.html
NoNewPrivileges=yes
PrivateTmp=yes
PrivateDevices=yes
RestrictAddressFamilies=AF_UNIX AF_INET AF_INET6
RestrictNamespaces=yes
RestrictRealtime=yes
DevicePolicy=closed
ProtectSystem=full
ProtectControlGroups=yes
ProtectKernelModules=yes
ProtectKernelTunables=yes
LockPersonality=yes
SystemCallFilter=~@clock @debug @module @mount @obsolete @reboot @setuid @swap
# Denying access to capabilities that should not be relevant for webapps
# Doc: https://man7.org/linux/man-pages/man7/capabilities.7.html
CapabilityBoundingSet=~CAP_RAWIO CAP_MKNOD
CapabilityBoundingSet=~CAP_AUDIT_CONTROL CAP_AUDIT_READ CAP_AUDIT_WRITE
CapabilityBoundingSet=~CAP_SYS_BOOT CAP_SYS_TIME CAP_SYS_MODULE CAP_SYS_PACCT
CapabilityBoundingSet=~CAP_LEASE CAP_LINUX_IMMUTABLE CAP_IPC_LOCK
CapabilityBoundingSet=~CAP_BLOCK_SUSPEND CAP_WAKE_ALARM
CapabilityBoundingSet=~CAP_SYS_TTY_CONFIG
CapabilityBoundingSet=~CAP_MAC_ADMIN CAP_MAC_OVERRIDE
CapabilityBoundingSet=~CAP_NET_ADMIN CAP_NET_BROADCAST CAP_NET_RAW
CapabilityBoundingSet=~CAP_SYS_ADMIN CAP_SYS_PTRACE CAP_SYSLOG
[Install] [Install]
WantedBy=__APP__.target WantedBy=__APP__.target

3
doc/DISCLAIMER.md Normal file
View file

@ -0,0 +1,3 @@
- There is currently no LDAP integration
- the installation is very long, especially the frontend building step
- As upstream doesn't support it, there is no possibility to change the endpoint/url of diaspora\*. Please choose it carefully!

3
doc/DISCLAIMER_fr.md Normal file
View file

@ -0,0 +1,3 @@
- Il n'y a pas d'intégration LDAP pour le moment.
- L'installation est très longue, en particulier l'étape de build du frontend.
- le projet amont ne supporte pas les changements d'url, ainsi l'application yunohost ne supporte pas non plus cette action.

View file

@ -1,20 +1,27 @@
{ {
"name": "Diaspora", "name": "Diaspora",
"id": "diaspora", "id": "diaspora",
"url": "https://diasporafoundation.org",
"packaging_format": 1, "packaging_format": 1,
"description": { "description": {
"en": "Distributed social networking service", "en": "Distributed social networking service",
"fr": "Service de réseau social distribué" "fr": "Service de réseau social distribué"
}, },
"version": "0.7.16.0~ynh1",
"url": "https://diasporafoundation.org",
"upstream": {
"license": "AGPL-3.0",
"website": "https://diasporafoundation.org/",
"admindoc": "https://wiki.diasporafoundation.org/FAQ_for_pod_maintainers",
"userdoc": "https://wiki.diasporafoundation.org/FAQ_for_users",
"code": "https://github.com/diaspora/diaspora"
},
"license": "AGPL-3.0", "license": "AGPL-3.0",
"version": "0.7.14.0~ynh1",
"maintainer": { "maintainer": {
"name": "rafi59", "name": "rafi59",
"email": "" "email": ""
}, },
"requirements": { "requirements": {
"yunohost": ">= 3.7.0" "yunohost": ">= 4.3.0"
}, },
"multi_instance": true, "multi_instance": true,
"services": [ "services": [
@ -25,21 +32,11 @@
"install" : [ "install" : [
{ {
"name": "domain", "name": "domain",
"type": "domain", "type": "domain"
"ask": {
"en": "Choose a domain for diaspora* (it needs its own domain)",
"fr": "Choisissez un domaine pour diaspora* (diaspora* a besoin de son propre domaine)"
},
"example": "domain.org"
}, },
{ {
"name": "admin", "name": "admin",
"type": "user", "type": "user"
"ask": {
"en": "Choose the diaspora* administrator (must be an existing YunoHost user)",
"fr": "Choisissez l'administrateur de diaspora* (doit être un utilisateur YunoHost)"
},
"example": "johndoe"
}, },
{ {
"name": "admin_password", "name": "admin_password",

View file

@ -2,4 +2,4 @@
pkg_dependencies="build-essential cmake libssl-dev libcurl4-dev libxml2-dev libxslt-dev imagemagick ghostscript curl libmagickwand-dev git libpq-dev redis-server nodejs postgresql bison " pkg_dependencies="build-essential cmake libssl-dev libcurl4-dev libxml2-dev libxslt-dev imagemagick ghostscript curl libmagickwand-dev git libpq-dev redis-server nodejs postgresql bison "
ruby_build_dependencies="bison libffi-dev libgdbm-dev libncurses5-dev libsqlite3-dev libyaml-dev pkg-config sqlite3 zlib1g-dev libgmp-dev libreadline-dev libssl-dev libjemalloc-dev" ruby_build_dependencies="bison libffi-dev libgdbm-dev libncurses5-dev libsqlite3-dev libyaml-dev pkg-config sqlite3 zlib1g-dev libgmp-dev libreadline-dev libssl-dev libjemalloc-dev"
current_tag="v0.7.14.0" current_tag="v0.7.16.0"

View file

@ -18,7 +18,7 @@ ynh_abort_if_errors
#================================================= #=================================================
# LOAD SETTINGS # LOAD SETTINGS
#================================================= #=================================================
ynh_script_progression --message="Loading installation settings..." ynh_print_info --message="Loading installation settings..."
app=$YNH_APP_INSTANCE_NAME app=$YNH_APP_INSTANCE_NAME
@ -30,18 +30,21 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path)
# clean folder # clean folder
ynh_secure_remove --file="$final_path/backup" ynh_secure_remove --file="$final_path/backup"
mkdir -p $final_path/backup mkdir -p $final_path/backup
#================================================= #=================================================
# BACKUP DIASPORA DATABASE # BACKUP DIASPORA DATABASE
#================================================= #=================================================
ynh_script_progression --message="Backup Diaspora DB..." --weight=10 ynh_print_info --message="Backup Diaspora DB..."
db_pass=$(ynh_app_setting_get --app=$app --key=psqlpwd) db_pass=$(ynh_app_setting_get --app=$app --key=psqlpwd)
dump_file="$final_path/backup/$app.dump" dump_file="$final_path/backup/$app.dump"
pg_dump -d "dbname=$app user=$app password=$db_pass host=localhost" -Fc -f $dump_file pg_dump -d "dbname=$app user=$app password=$db_pass host=localhost" -Fc -f $dump_file
ynh_backup --src_path="$dump_file" ynh_backup --src_path="$dump_file"
#================================================= #=================================================
# BACKUP DIASPORA UPLOADS # BACKUP DIASPORA UPLOADS
#================================================= #=================================================
ynh_script_progression --message="Backup uploads..." --weight=10
if [ -x $final_path/diaspora/public/uploads ]; then if [ -x $final_path/diaspora/public/uploads ]; then
ynh_backup --src_path="$final_path/diaspora/public/uploads" ynh_backup --src_path="$final_path/diaspora/public/uploads"
else else
@ -51,11 +54,11 @@ fi
#================================================= #=================================================
# BACKUP CONF FILES # BACKUP CONF FILES
#================================================= #=================================================
ynh_script_progression --message="Backup configuration files of Diaspora..."
ynh_backup --src_path="$final_path/diaspora/config/database.yml" ynh_backup --src_path="$final_path/diaspora/config/database.yml"
ynh_backup --src_path="$final_path/diaspora/config/diaspora.yml" ynh_backup --src_path="$final_path/diaspora/config/diaspora.yml"
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT
#================================================= #=================================================
ynh_script_progression --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)." --last ynh_print_info --message="Backup script completed for $app. (YunoHost will then actually copy those files to the archive)."

View file

@ -1,23 +1,26 @@
#!/bin/bash #!/bin/bash
pushd $final_path/diaspora pushd $final_path/diaspora
echo 2.6.6 > .ruby-version # overwrite 2.4 default from diaspora because rbenv does not understand it echo 2.6.6 > .ruby-version # overwrite 2.6 default from diaspora because rbenv does not understand it
sudo -u $app --login << EOF sudo -u $app --login << EOF
gem install bundler:1.17.3 gem install bundler:1.17.3
cd diaspora cd diaspora
script/configure_bundler script/configure_bundler
bin/bundle install --full-index --with=postgresql bin/bundle install --full-index --with=postgresql
EOF EOF
# for some reason rake logs a lot in stderr (tried --quiet, didn't change anything)
# redirecting it to stdout to have a saner log on yunohost side
sudo -u $app --login << EOF sudo -u $app --login << EOF
cd diaspora cd diaspora
RAILS_ENV=production bundle exec rake db:migrate RAILS_ENV=production bundle exec rake db:migrate 2>&1
EOF EOF
#================================================= #=================================================
# ASSETS PRECOMPILATION # ASSETS PRECOMPILATION
#================================================= #=================================================
sudo -u $app --login << EOF sudo -u $app --login << EOF
cd diaspora cd diaspora
RAILS_ENV=production bin/rake assets:precompile RAILS_ENV=production bin/rake assets:precompile 2>&1
EOF EOF
popd popd

View file

@ -45,8 +45,6 @@ final_path=/var/www/$app
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS # CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
#================================================= #=================================================
ynh_script_progression --message="Validating installation parameters..." --weight=1 ynh_script_progression --message="Validating installation parameters..." --weight=1
# Check web path availability
ynh_webpath_available --domain=$domain --path_url=/
# check path availability # check path availability
test ! -e "$final_path" || ynh_die "This path already contains a folder" test ! -e "$final_path" || ynh_die "This path already contains a folder"
can_remove_home=1 can_remove_home=1
@ -68,7 +66,7 @@ ynh_app_setting_set --app=$app --key=final_path --value=$final_path
#================================================= #=================================================
# INSTALL DEPENDENCIES # INSTALL DEPENDENCIES
#================================================= #=================================================
ynh_script_progression --message="Installing dependencies..." --weight=27 ynh_script_progression --message="Installing dependencies..." --weight=5
ynh_install_app_dependencies $pkg_dependencies $ruby_build_dependencies ynh_install_app_dependencies $pkg_dependencies $ruby_build_dependencies
#================================================= #=================================================
@ -94,7 +92,7 @@ chown $app:www-data $final_path
#================================================= #=================================================
# INSTALL RVM AND RUBY FOR CURRENT USER # INSTALL RVM AND RUBY FOR CURRENT USER
#================================================= #=================================================
ynh_script_progression --message="Installing rvm and ruby..." --weight=240 ynh_script_progression --message="Installing rvm and ruby... (will take a long time)" --weight=20
source ./install_ruby source ./install_ruby
#================================================= #=================================================
@ -102,7 +100,7 @@ source ./install_ruby
#================================================= #=================================================
# Download, check integrity, unucompress and patch the source from app.src # Download, check integrity, unucompress and patch the source from app.src
pushd $final_path pushd $final_path
ynh_script_progression --message="Download the sources..." --weight=16 ynh_script_progression --message="Download the sources..." --weight=10
sudo -u $app git clone https://github.com/diaspora/diaspora.git -b $current_tag sudo -u $app git clone https://github.com/diaspora/diaspora.git -b $current_tag
popd popd
@ -142,7 +140,7 @@ ynh_store_file_checksum --file="$final_path/diaspora/config/database.yml"
#================================================= #=================================================
# Bundle the ruby app # Bundle the ruby app
#================================================= #=================================================
ynh_script_progression --message="Precompile assets..." --weight=400 ynh_script_progression --message="Precompile assets (will take a long time)..." --weight=40
source ./bundle_app source ./bundle_app
#================================================= #=================================================
@ -172,8 +170,8 @@ yunohost service add $app.target \
#================================================= #=================================================
# SETUP SSOWAT # SETUP SSOWAT
#================================================= #=================================================
# unprotected_uris allows SSO credentials to be passed anyway.
ynh_app_setting_set $app unprotected_uris "/"
#================================================= #=================================================
# CREATE AN ADMIN # CREATE AN ADMIN

View file

@ -31,7 +31,7 @@ final_path=$(ynh_app_setting_get $app final_path)
ynh_script_progression --message="Remove services" ynh_script_progression --message="Remove services"
yunohost service remove $app.target yunohost service remove $app.target
systemctl stop ${app}.target ${app}_sidekiq.service ${app}_web.service systemctl stop ${app}.target ${app}_sidekiq.service ${app}_web.service
systemctl disable ${app}.target ${app}_sidekiq.service ${app}_web.service systemctl disable ${app}.target ${app}_sidekiq.service ${app}_web.service --quiet
ynh_secure_remove --file="/etc/systemd/system/${app}_web.service" ynh_secure_remove --file="/etc/systemd/system/${app}_web.service"
ynh_secure_remove --file="/etc/systemd/system/${app}_sidekiq.service" ynh_secure_remove --file="/etc/systemd/system/${app}_sidekiq.service"
ynh_secure_remove --file="/etc/tmpfiles.d/${app}.conf" ynh_secure_remove --file="/etc/tmpfiles.d/${app}.conf"

View file

@ -41,8 +41,6 @@ db_user=$db_name
#================================================= #=================================================
ynh_script_progression --message="Validating restoration parameters..." ynh_script_progression --message="Validating restoration parameters..."
ynh_webpath_available --domain=$domain --path_url=/ \
|| ynh_die --message="Domain not available: ${domain}"
test ! -d $final_path \ test ! -d $final_path \
|| ynh_die --message="There is already a directory: $final_path " || ynh_die --message="There is already a directory: $final_path "
can_remove_home=1 can_remove_home=1
@ -50,7 +48,8 @@ can_remove_home=1
#================================================= #=================================================
# Reinstall dependencies # Reinstall dependencies
#================================================= #=================================================
ynh_script_progression --message="Reinstalling dependencies..." --weight=27 ynh_script_progression --message="Reinstalling dependencies..." --weight=5
ynh_install_app_dependencies $pkg_dependencies $ruby_build_dependencies ynh_install_app_dependencies $pkg_dependencies $ruby_build_dependencies
# now that we have psql for sure, test db existence # now that we have psql for sure, test db existence
@ -62,6 +61,7 @@ can_remove_db=1
# Restoring dedicated USER # Restoring dedicated USER
#================================================= #=================================================
ynh_script_progression --message="Restoring user..." --weight=1 ynh_script_progression --message="Restoring user..." --weight=1
ynh_system_user_create --username=$app --home_dir=$final_path --use_shell ynh_system_user_create --username=$app --home_dir=$final_path --use_shell
can_remove_user=1 can_remove_user=1
mkdir -p $final_path mkdir -p $final_path
@ -71,7 +71,8 @@ chown $app:www-data $final_path
#================================================= #=================================================
# INSTALL RVM AND RUBY FOR CURRENT USER # INSTALL RVM AND RUBY FOR CURRENT USER
#================================================= #=================================================
ynh_script_progression --message="Reinstalling rvm and ruby..." --weight=50 ynh_script_progression --message="Reinstalling rbenv and ruby..." --weight=10
source ./install_ruby source ./install_ruby
#================================================= #=================================================
@ -79,14 +80,14 @@ source ./install_ruby
#================================================= #=================================================
# Download, check integrity, unucompress and patch the source from app.src # Download, check integrity, unucompress and patch the source from app.src
pushd $final_path pushd $final_path
ynh_script_progression --message="Download the sources..." --weight=16 ynh_script_progression --message="Download the sources..." --weight=5
sudo -u $app git clone https://github.com/diaspora/diaspora.git -b $current_tag sudo -u $app git clone https://github.com/diaspora/diaspora.git -b $current_tag
popd popd
#================================================= #=================================================
# Restore files # Restore files
#================================================= #=================================================
ynh_script_progression --message="Restore the files" --weight=16 ynh_script_progression --message="Restore the files" --weight=5
ynh_restore_file --origin_path=/var/www/diaspora/diaspora/config/database.yml ynh_restore_file --origin_path=/var/www/diaspora/diaspora/config/database.yml
ynh_restore_file --origin_path=/var/www/diaspora/diaspora/config/diaspora.yml ynh_restore_file --origin_path=/var/www/diaspora/diaspora/config/diaspora.yml
ynh_restore_file --not_mandatory --origin_path=/var/www/diaspora/diaspora/public/uploads/ ynh_restore_file --not_mandatory --origin_path=/var/www/diaspora/diaspora/public/uploads/
@ -97,7 +98,7 @@ ynh_restore_file --origin_path=/var/www/diaspora/backup/diaspora.dump --dest_pat
#================================================= #=================================================
# Restore database # Restore database
#================================================= #=================================================
ynh_script_progression --message="Recreating and restoring database..." --weight=16 ynh_script_progression --message="Recreating and restoring database..." --weight=5
db_name=$(ynh_sanitize_dbid $app) db_name=$(ynh_sanitize_dbid $app)
ynh_psql_test_if_first_run ynh_psql_test_if_first_run
db_pass=$(ynh_app_setting_get --app=$app --key=psqlpwd) db_pass=$(ynh_app_setting_get --app=$app --key=psqlpwd)
@ -112,24 +113,27 @@ ynh_secure_remove --file=/tmp/diaspora.dump
#================================================= #=================================================
# Bundle the ruby app # Bundle the ruby app
#================================================= #=================================================
ynh_script_progression --message="Precompile assets..." --weight=200 ynh_script_progression --message="Precompile assets..." --weight=5
source ./bundle_app source ./bundle_app
#================================================= #=================================================
# Restore nginx conf files # Restore nginx conf files
#================================================= #=================================================
ynh_script_progression --message="Recreate nginx config from source" ynh_script_progression --message="Recreate nginx config from source"
ynh_add_nginx_config ynh_add_nginx_config
#================================================= #=================================================
# Restore services # Restore services
#================================================= #=================================================
ynh_script_progression --message="Restore services..." ynh_script_progression --message="Restore services..."
source ./create_services source ./create_services
#================================================= #=================================================
# ADVERTISE SERVICE IN ADMIN PANEL # ADVERTISE SERVICE IN ADMIN PANEL
#================================================= #=================================================
yunohost service add $app.target \ yunohost service add $app.target \
--log $final_path/diaspora/log/production.log \ --log $final_path/diaspora/log/production.log \
$final_path/diaspora/log/unicorn-stderr.log\ $final_path/diaspora/log/unicorn-stderr.log\
@ -137,10 +141,4 @@ yunohost service add $app.target\
$final_path/diaspora/log/sidekiq.log\ $final_path/diaspora/log/sidekiq.log\
--description "Diaspora service (unicorn web and sidekiq)" --description "Diaspora service (unicorn web and sidekiq)"
#=================================================
# SETUP SSOWAT
#=================================================
# unprotected_uris allows SSO credentials to be passed anyway.
ynh_app_setting_set $app unprotected_uris "/"
popd popd

View file

@ -14,6 +14,7 @@ source /usr/share/yunohost/helpers
# LOAD SETTINGS # LOAD SETTINGS
#================================================= #=================================================
ynh_script_progression --message="Loading installation settings..." ynh_script_progression --message="Loading installation settings..."
app=$YNH_APP_INSTANCE_NAME app=$YNH_APP_INSTANCE_NAME
# Retrieve arguments # Retrieve arguments
@ -26,22 +27,35 @@ ynh_clean_setup() {
} }
ynh_abort_if_errors ynh_abort_if_errors
#=================================================
# Migrate legacy permissions to new system
#=================================================
if ynh_legacy_permissions_exists
then
ynh_legacy_permissions_delete_all
ynh_app_setting_delete --app=$app --key=is_public
fi
#================================================= #=================================================
# Check upgrade type # Check upgrade type
#================================================= #=================================================
ynh_script_progression --message="Check upgrade type..." ynh_script_progression --message="Check upgrade type..."
upgrade_type=$(ynh_check_app_version_changed) upgrade_type=$(ynh_check_app_version_changed)
#================================================= #=================================================
# Stop services # Stop services
#================================================= #=================================================
ynh_script_progression --message="Stop services..." ynh_script_progression --message="Stop services..."
systemctl stop $app.target systemctl stop $app.target
#================================================= #=================================================
# INSTALL DEPENDENCIES # INSTALL DEPENDENCIES
#================================================= #=================================================
ynh_script_progression --message="Installing dependencies..." ynh_script_progression --message="Installing dependencies..."
ynh_install_app_dependencies $pkg_dependencies $ruby_build_dependencies ynh_install_app_dependencies $pkg_dependencies $ruby_build_dependencies
#================================================= #=================================================
@ -86,10 +100,21 @@ then
source ./bundle_app source ./bundle_app
fi fi
#=================================================
# ADVERTISE SERVICE IN ADMIN PANEL
#=================================================
yunohost service add $app.target \
--log $final_path/diaspora/log/production.log \
$final_path/diaspora/log/unicorn-stderr.log\
$final_path/diaspora/log/unicorn-stdout.log\
$final_path/diaspora/log/sidekiq.log\
--description "Diaspora service (unicorn web and sidekiq)"
#================================================= #=================================================
# restart services # restart services
#================================================= #=================================================
ynh_script_progression --message="Recreate and start services..." ynh_script_progression --message="Recreate and start services..."
source ./create_services source ./create_services
#================================================= #=================================================
@ -97,6 +122,7 @@ source ./create_services
#================================================= #=================================================
# Create a dedicated nginx config # Create a dedicated nginx config
ynh_script_progression --message="configure nginx..." --weight=1 ynh_script_progression --message="configure nginx..." --weight=1
ynh_add_nginx_config ynh_add_nginx_config