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

Fix linter warnings

This commit is contained in:
ericgaspar 2020-12-18 22:56:28 +01:00
parent 2ad9f594ac
commit 3be837d749
No known key found for this signature in database
GPG key ID: 574F281483054D44
8 changed files with 55 additions and 21 deletions

View file

@ -1,19 +1,16 @@
diaspora_ynh Diaspora for YunoHost
==========
[![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) [![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)
[![Install Diaspora with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=diaspora)
[![Install diaspora with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=diaspora)
## Overview ## Overview
> *This package allow you to install diaspora* quickly and simply on a YunoHost server. > *This package allow you to install Diaspora quickly and simply on a YunoHost server.
If you don't have YunoHost, please see [here](https://yunohost.org/#/install) to know how to install and enjoy it.* 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.13.0
Notes ## Notes
--------------
Before installing, you have to: Before installing, you have to:
@ -25,5 +22,20 @@ Installation effects:
- Thank you for being patient as deployment time can take up to about 1 hour (raspberry pi). - 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 - The installation directory can take up to 900MB and app start time can be take 5 minutes
## Links
Report a bug: https://github.com/YunoHost-Apps/diaspora_ynh/issues * Report a bug: https://github.com/YunoHost-Apps/diaspora_ynh/issues
* YunoHost website: https://yunohost.org/
---
## 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
```

View file

@ -16,9 +16,6 @@
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

@ -8,13 +8,13 @@
"fr": "Service de réseau social distribué" "fr": "Service de réseau social distribué"
}, },
"license": "AGPL-3.0", "license": "AGPL-3.0",
"version": "0.7.14.0~ynh1", "version": "0.7.14.0~ynh2",
"maintainer": { "maintainer": {
"name": "rafi59", "name": "rafi59",
"email": "" "email": ""
}, },
"requirements": { "requirements": {
"yunohost": ">= 3.7.0" "yunohost": ">= 3.8.1"
}, },
"multi_instance": true, "multi_instance": true,
"services": [ "services": [

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,20 @@ 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
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 +53,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

@ -179,6 +179,7 @@ ynh_app_setting_set $app unprotected_uris "/"
# CREATE AN ADMIN # CREATE AN ADMIN
#================================================= #=================================================
ynh_script_progression --message="Create admin..." --weight=1 ynh_script_progression --message="Create admin..." --weight=1
pushd $final_path/diaspora pushd $final_path/diaspora
sudo -u $app /bin/bash --login << EOF sudo -u $app /bin/bash --login << EOF
RAILS_ENV=production bundle exec rails console << END RAILS_ENV=production bundle exec rails console << END

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

@ -51,6 +51,7 @@ can_remove_home=1
# Reinstall dependencies # Reinstall dependencies
#================================================= #=================================================
ynh_script_progression --message="Reinstalling dependencies..." --weight=27 ynh_script_progression --message="Reinstalling dependencies..." --weight=27
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 +63,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
@ -72,6 +74,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="Reinstalling rvm and ruby..." --weight=50 ynh_script_progression --message="Reinstalling rvm and ruby..." --weight=50
source ./install_ruby source ./install_ruby
#================================================= #=================================================
@ -112,24 +115,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=20
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\

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
@ -30,18 +31,21 @@ ynh_abort_if_errors
# 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 +90,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 +112,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