1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/glitchsoc_ynh.git synced 2024-09-03 19:15:59 +02:00

Apply last example_ynh

This commit is contained in:
yalh76 2021-02-17 19:22:07 +01:00
parent 014dcf6239
commit aa8928abd9
10 changed files with 98 additions and 86 deletions

View file

@ -5,8 +5,8 @@
*[Lire ce readme en français.](./README_fr.md)* *[Lire ce readme en français.](./README_fr.md)*
> *This package allow you to install Mastodon quickly and simply on a YunoHost server. > *This package allows you to install Mastodon 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 consult [the guide](https://yunohost.org/#/install) to learn how to install it.*
## Overview ## Overview
Mastodon is a free, open-source microblogging social network. It is a decentralized alternative to commercial platforms like Twitter and avoids the risks of a single company monopolizing your communication for commercial purposes. Mastodon is a free, open-source microblogging social network. It is a decentralized alternative to commercial platforms like Twitter and avoids the risks of a single company monopolizing your communication for commercial purposes.
@ -70,10 +70,9 @@ LDAP authentication is activated. All YunoHost users can authenticate.
--- ---
Developers info ## Developer info
----------------
Please do your pull request to the [testing branch](https://github.com/YunoHost-Apps/mastodon_ynh/tree/testing). Please send your pull request to the [testing branch](https://github.com/YunoHost-Apps/mastodon_ynh/tree/testing).
To try the testing branch, please proceed like that. To try the testing branch, please proceed like that.
``` ```

View file

@ -1,12 +1,12 @@
# Mastodon pour YunoHost # Mastodon pour YunoHost
[![Integration level](https://dash.yunohost.org/integration/mastodon.svg)](https://dash.yunohost.org/appci/app/mastodon) ![](https://ci-apps.yunohost.org/ci/badges/mastodon.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/mastodon.maintain.svg) [![Niveau d'intégration](https://dash.yunohost.org/integration/mastodon.svg)](https://dash.yunohost.org/appci/app/mastodon) ![](https://ci-apps.yunohost.org/ci/badges/mastodon.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/mastodon.maintain.svg)
[![Install Mastodon with YunoHost](https://install-app.yunohost.org/install-with-yunohost.png)](https://install-app.yunohost.org/?app=mastodon) [![Installer Mastodon avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=mastodon)
*[Read this readme in english.](./README.md)* *[Read this readme in english.](./README.md)*
> *Ce package vous permet d'installer Mastodon rapidement et simplement sur un serveur YunoHost. > *Ce package vous permet d'installer Mastodon 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.* Si vous n'avez pas YunoHost, consultez [le guide](https://yunohost.org/#/install) pour apprendre comment l'installer.*
## Vue d'ensemble ## Vue d'ensemble
Mastodon est un réseau social de microblog auto-hébergé et open source. C'est une alternative décentralisée aux plates-formes commerciales comme Twitter. Mastodon évite ainsi les risques qu'une seule société monopolise votre communication à des fins commerciales. Mastodon est un réseau social de microblog auto-hébergé et open source. C'est une alternative décentralisée aux plates-formes commerciales comme Twitter. Mastodon évite ainsi les risques qu'une seule société monopolise votre communication à des fins commerciales.
@ -53,7 +53,7 @@ L'utilisateur admin est créé automatiquement comme : user@domain.tld
## Caractéristiques spécifiques YunoHost ## Caractéristiques spécifiques YunoHost
#### Support multi-utilisateurs #### Support multi-utilisateur
L'authentification LDAP est activée. Tous les utilisateurs YunoHost peuvent s'authentifier. L'authentification LDAP est activée. Tous les utilisateurs YunoHost peuvent s'authentifier.
@ -62,7 +62,7 @@ L'authentification LDAP est activée. Tous les utilisateurs YunoHost peuvent s'a
* x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/mastodon%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/mastodon/) * x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/mastodon%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/mastodon/)
* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/mastodon%20%28Apps%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/mastodon/) * ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/mastodon%20%28Apps%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/mastodon/)
## Links ## Liens
* Signaler un bug : https://github.com/YunoHost-Apps/mastodon_ynh/issues * Signaler un bug : https://github.com/YunoHost-Apps/mastodon_ynh/issues
* Site de l'application : https://joinmastodon.org/ * Site de l'application : https://joinmastodon.org/
@ -71,8 +71,7 @@ L'authentification LDAP est activée. Tous les utilisateurs YunoHost peuvent s'a
--- ---
Informations pour les développeurs ## Informations pour les développeurs
----------------
Merci de faire vos pull request sur la [branche testing](https://github.com/YunoHost-Apps/mastodon_ynh/tree/testing). Merci de faire vos pull request sur la [branche testing](https://github.com/YunoHost-Apps/mastodon_ynh/tree/testing).

View file

@ -1,5 +1,4 @@
;; Nom du test ;; Test complet
auto_remove=1
; Manifest ; Manifest
domain="domain.tld" (DOMAIN) domain="domain.tld" (DOMAIN)
admin="john" (USER) admin="john" (USER)
@ -29,13 +28,8 @@
upgrade=1 from_commit=a233ccc644d97aa89756fac9f0ce68c98d81d27c upgrade=1 from_commit=a233ccc644d97aa89756fac9f0ce68c98d81d27c
backup_restore=1 backup_restore=1
multi_instance=1 multi_instance=1
# This test is no longer necessary since the version 2.7 (PR: https://github.com/YunoHost/yunohost/pull/304), you can still do it if your app could be installed with this version.
# incorrect_path=1
port_already_use=0 port_already_use=0
change_url=0 change_url=0
;;; Levels
# If the level 5 (Package linter) is forced to 1. Please add justifications here.
Level 5=auto
;;; Options ;;; Options
Email=yalh@yahoo.com Email=yalh@yahoo.com
Notification=all Notification=all

View file

@ -4,3 +4,4 @@ SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=tar.gz SOURCE_FORMAT=tar.gz
SOURCE_IN_SUBDIR=true SOURCE_IN_SUBDIR=true
SOURCE_FILENAME= SOURCE_FILENAME=
SOURCE_EXTRACT=true

55
issue_template.md Normal file
View file

@ -0,0 +1,55 @@
---
name: Bug report
about: When creating a bug report, please use the following template to provide all the relevant information and help debugging efficiently.
---
**How to post a meaningful bug report**
1. *Read this whole template first.*
2. *Determine if you are on the right place:*
- *If you were performing an action on the app from the webadmin or the CLI (install, update, backup, restore, change_url...), you are on the right place!*
- *Otherwise, the issue may be due to Mastodon itself. Refer to its documentation or repository for help.*
- *When in doubt, post here and we will figure it out together.*
3. *Delete the italic comments as you write over them below, and remove this guide.*
---
### Describe the bug
*A clear and concise description of what the bug is.*
### Context
- Hardware: *VPS bought online / Old laptop or computer / Raspberry Pi at home / Internet Cube with VPN / Other ARM board / ...*
- YunoHost version: x.x.x
- I have access to my server: *Through SSH | through the webadmin | direct access via keyboard / screen | ...*
- Are you in a special context or did you perform some particular tweaking on your YunoHost instance?: *no / yes*
- If yes, please explain:
- Using, or trying to install package version/branch:
- If upgrading, current package version: *can be found in the admin, or with `yunohost app info $app_id`*
### Steps to reproduce
- *If you performed a command from the CLI, the command itself is enough. For example:*
```sh
sudo yunohost app install mastodon
```
- *If you used the webadmin, please perform the equivalent command from the CLI first.*
- *If the error occurs in your browser, explain what you did:*
1. *Go to '...'*
2. *Click on '...'*
3. *Scroll down to '...'*
4. *See error*
### Expected behavior
*A clear and concise description of what you expected to happen. You can remove this section if the command above is enough to understand your intent.*
### Logs
*When an operation fails, YunoHost provides a simple way to share the logs.*
- *In the webadmin, the error message contains a link to the relevant log page. On that page, you will be able to 'Share with Yunopaste'. If you missed it, the logs of previous operations are also available under Tools > Logs.*
- *In command line, the command to share the logs is displayed at the end of the operation and looks like `yunohost log display [log name] --share`. If you missed it, you can find the log ID of a previous operation using `yunohost log list`.*
*After sharing the log, please copypaste directly the link provided by YunoHost (to help readability, no need to copypaste the entire content of the log here, just the link is enough...)*
*If applicable and useful, add screenshots to help explain your problem.*

View file

@ -13,6 +13,4 @@
## Package_check results ## Package_check results
--- ---
*If you have access to [App Continuous Integration for packagers](https://yunohost.org/#/packaging_apps_ci) you can provide a link to the package_check results like below, replacing '-NUM-' in this link by the PR number and USERNAME by your username on the ci-apps-dev. Or you provide a screenshot or a pastebin of the results* * An automatic package_check will be launch at https://ci-apps-dev.yunohost.org/, when you add a specific comment to your Pull Request: "!testme", "!gogogadgetoci" or "By the power of systemd, I invoke The Great App CI to test this Pull Request!"*
[![Build Status](https://ci-apps-dev.yunohost.org/jenkins/job/mastodon_ynh%20PR-NUM-%20(USERNAME)/badge/icon)](https://ci-apps-dev.yunohost.org/jenkins/job/mastodon_ynh%20PR-NUM-%20(USERNAME)/)

View file

@ -54,7 +54,6 @@ ynh_script_progression --message="Storing installation settings..."
ynh_app_setting_set --app=$app --key=domain --value=$domain ynh_app_setting_set --app=$app --key=domain --value=$domain
ynh_app_setting_set --app=$app --key=path --value=$path_url ynh_app_setting_set --app=$app --key=path --value=$path_url
ynh_app_setting_set --app=$app --key=admin --value=$admin ynh_app_setting_set --app=$app --key=admin --value=$admin
ynh_app_setting_set --app=$app --key=is_public --value=$is_public
ynh_app_setting_set --app=$app --key=language --value=$language ynh_app_setting_set --app=$app --key=language --value=$language
#================================================= #=================================================
@ -83,9 +82,9 @@ ynh_install_extra_app_dependencies --repo="deb https://dl.yarnpkg.com/debian/ st
#================================================= #=================================================
# CREATE A POSTGRESQL DATABASE # CREATE A POSTGRESQL DATABASE
#================================================= #=================================================
ynh_script_progression --message="Creating a MySQL database..." ynh_script_progression --message="Creating a PostgreSQL database..."
# Create postgresql database # Create PostgreSQL database
db_name="${app}_production" db_name="${app}_production"
db_user=$app db_user=$app
db_pwd=$(ynh_string_random --length=30) db_pwd=$(ynh_string_random --length=30)
@ -269,13 +268,14 @@ ynh_systemd_action --service_name=${app}-streaming --action="start" --log_path=s
#================================================= #=================================================
# SETUP SSOWAT # SETUP SSOWAT
#================================================= #=================================================
ynh_script_progression --message="Configuring SSOwat..." ynh_script_progression --message="Configuring permissions..."
# Make app public if necessary # Make app public if necessary
if [ $is_public -eq 1 ] if [ $is_public -eq 1 ]
then then
# unprotected_uris allows SSO credentials to be passed anyway. # Everyone can access the app.
ynh_app_setting_set --app=$app --key=unprotected_uris --value="/" # The "main" permission is automatically created before the install script.
ynh_permission_update --permission="main" --add="visitors"
fi fi
#================================================= #=================================================

View file

@ -20,7 +20,7 @@ app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get --app=$app --key=domain) domain=$(ynh_app_setting_get --app=$app --key=domain)
db_name=$(ynh_app_setting_get --app=$app --key=db_name) db_name=$(ynh_app_setting_get --app=$app --key=db_name)
db_user=$app db_user=$db_name
final_path=$(ynh_app_setting_get --app=$app --key=final_path) final_path=$(ynh_app_setting_get --app=$app --key=final_path)
#================================================= #=================================================
@ -32,19 +32,19 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path)
# Remove the service from the list of services known by Yunohost (added from `yunohost service add`) # Remove the service from the list of services known by Yunohost (added from `yunohost service add`)
if ynh_exec_warn_less yunohost service status "$app-web" >/dev/null if ynh_exec_warn_less yunohost service status "$app-web" >/dev/null
then then
ynh_script_progression --message="Removing $app-web service..." ynh_script_progression --message="Removing $app-web service integration..."
yunohost service remove "$app-web" yunohost service remove "$app-web"
fi fi
if ynh_exec_warn_less yunohost service status "$app-sidekiq" >/dev/null if ynh_exec_warn_less yunohost service status "$app-sidekiq" >/dev/null
then then
ynh_script_progression --message="Removing $app-sidekiq service..." ynh_script_progression --message="Removing $app-sidekiq service integration..."
yunohost service remove "$app-sidekiq" yunohost service remove "$app-sidekiq"
fi fi
if ynh_exec_warn_less yunohost service status "$app-streaming" >/dev/null if ynh_exec_warn_less yunohost service status "$app-streaming" >/dev/null
then then
ynh_script_progression --message="Removing $app-streaming service..." ynh_script_progression --message="Removing $app-streaming service integration..."
yunohost service remove "$app-streaming" yunohost service remove "$app-streaming"
fi fi

View file

@ -15,7 +15,6 @@ source /usr/share/yunohost/helpers
#================================================= #=================================================
# MANAGE SCRIPT FAILURE # MANAGE SCRIPT FAILURE
#================================================= #=================================================
ynh_script_progression --message="Managing script failure..."
ynh_clean_setup () { ynh_clean_setup () {
ynh_clean_check_starting ynh_clean_check_starting
@ -34,7 +33,7 @@ domain=$(ynh_app_setting_get --app=$app --key=domain)
path_url=$(ynh_app_setting_get --app=$app --key=path) path_url=$(ynh_app_setting_get --app=$app --key=path)
final_path=$(ynh_app_setting_get --app=$app --key=final_path) final_path=$(ynh_app_setting_get --app=$app --key=final_path)
db_name=$(ynh_app_setting_get --app=$app --key=db_name) db_name=$(ynh_app_setting_get --app=$app --key=db_name)
db_user=$app db_user=$db_name
db_pwd=$(ynh_app_setting_get --app=$app --key=db_pwd) db_pwd=$(ynh_app_setting_get --app=$app --key=db_pwd)
#================================================= #=================================================
@ -135,7 +134,7 @@ ynh_script_progression --message="Restoring the systemd configuration..."
ynh_restore_file --origin_path="/etc/systemd/system/$app-web.service" ynh_restore_file --origin_path="/etc/systemd/system/$app-web.service"
ynh_restore_file --origin_path="/etc/systemd/system/$app-sidekiq.service" ynh_restore_file --origin_path="/etc/systemd/system/$app-sidekiq.service"
ynh_restore_file --origin_path="/etc/systemd/system/$app-streaming.service" ynh_restore_file --origin_path="/etc/systemd/system/$app-streaming.service"
systemctl enable "$app-web" "$app-sidekiq" "$app-streaming" systemctl enable "$app-web" "$app-sidekiq" "$app-streaming" --quiet
#================================================= #=================================================
# INTEGRATE SERVICE IN YUNOHOST # INTEGRATE SERVICE IN YUNOHOST
@ -167,7 +166,7 @@ ynh_restore_file --origin_path="/etc/cron.d/$app"
#================================================= #=================================================
# RELOAD NGINX # RELOAD NGINX
#================================================= #=================================================
ynh_script_progression --message="Reloading nginx web server..." ynh_script_progression --message="Reloading NGINX web server..."
ynh_systemd_action --service_name=nginx --action=reload ynh_systemd_action --service_name=nginx --action=reload

View file

@ -37,6 +37,8 @@ otp_secret=$(ynh_app_setting_get --app=$app --key=otp_secret)
vapid_private_key=$(ynh_app_setting_get --app=$app --key=vapid_private_key) vapid_private_key=$(ynh_app_setting_get --app=$app --key=vapid_private_key)
vapid_public_key=$(ynh_app_setting_get --app=$app --key=vapid_public_key) vapid_public_key=$(ynh_app_setting_get --app=$app --key=vapid_public_key)
config="$final_path/live/.env.production"
#================================================= #=================================================
# CHECK VERSION # CHECK VERSION
#================================================= #=================================================
@ -49,39 +51,27 @@ upgrade_type=$(ynh_check_app_version_changed)
#================================================= #=================================================
ynh_script_progression --message="Ensuring downward compatibility..." ynh_script_progression --message="Ensuring downward compatibility..."
config="$final_path/live/.env.production"
# If db_name doesn't exist, create it # Cleaning legacy permissions
if [ -z "$db_name" ]; then if ynh_legacy_permissions_exists; then
db_name="${app}_production" ynh_legacy_permissions_delete_all
ynh_app_setting_set --app=$app --key=db_name --value=$db_name
ynh_app_setting_delete --app=$app --key=is_public
fi fi
# If final_path doesn't exist, create it # If port_web doesn't exist, create it, needed for old install
if [ -z "$final_path" ]; then
final_path=/var/www/$app
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
fi
# Check if admin is not null
if [[ "$admin" = "" || "$language" = "" ]]; then
echo "Unable to upgrade, please contact support"
ynh_die
fi
# If port_web doesn't exist, create it, need for old install
if [[ -z "$port_web" ]]; then if [[ -z "$port_web" ]]; then
port_web=3000 port_web=3000
ynh_app_setting_set --app=$app --key=port_web --value=$port_web ynh_app_setting_set --app=$app --key=port_web --value=$port_web
fi fi
# If port_web doesn't exist, create it, need for old install # If port_web doesn't exist, create it, needed for old install
if [[ -z "$port_stream" ]]; then if [[ -z "$port_stream" ]]; then
port_stream=4000 port_stream=4000
ynh_app_setting_set --app=$app --key=port_stream --value=$port_stream ynh_app_setting_set --app=$app --key=port_stream --value=$port_stream
fi fi
# If db_pwd doesn't exist, create it, need for old install # If db_pwd doesn't exist, create it, needed for old install
if [[ -z "$db_pwd" ]]; then if [[ -z "$db_pwd" ]]; then
db_pwd=$(ynh_string_random) db_pwd=$(ynh_string_random)
ynh_app_setting_set --app=$app --key=db_pwd --value=$db_pwd ynh_app_setting_set --app=$app --key=db_pwd --value=$db_pwd
@ -143,18 +133,6 @@ ynh_clean_setup () {
# Exit if an error occurs during the execution of the script # Exit if an error occurs during the execution of the script
ynh_abort_if_errors ynh_abort_if_errors
#=================================================
# CHECK THE PATH
#=================================================
# Normalize the URL path syntax
# N.B. : this is for app installations before YunoHost 2.7
# where this value might be something like /foo/ or foo/
# instead of /foo ....
# If nobody installed your app before 2.7, then you may
# safely remove this line
path_url=$(ynh_normalize_url_path --path_url=$path_url)
#================================================= #=================================================
# STANDARD UPGRADE STEPS # STANDARD UPGRADE STEPS
#================================================= #=================================================
@ -201,6 +179,7 @@ fi
#================================================= #=================================================
ynh_script_progression --message="Upgrading nginx web server configuration..." ynh_script_progression --message="Upgrading nginx web server configuration..."
# Create a dedicated NGINX config
ynh_add_nginx_config 'port_web port_stream' ynh_add_nginx_config 'port_web port_stream'
#================================================= #=================================================
@ -315,15 +294,6 @@ ynh_add_systemd_config --service="$app-web" --template="mastodon-web.service" --
ynh_add_systemd_config --service="$app-sidekiq" --template="mastodon-sidekiq.service" --others_var="RBENV_ROOT" ynh_add_systemd_config --service="$app-sidekiq" --template="mastodon-sidekiq.service" --others_var="RBENV_ROOT"
ynh_add_systemd_config --service="$app-streaming" --template="mastodon-streaming.service" --others_var="port_stream ynh_node_load_PATH ynh_node" ynh_add_systemd_config --service="$app-streaming" --template="mastodon-streaming.service" --others_var="port_stream ynh_node_load_PATH ynh_node"
#=================================================
# INTEGRATE SERVICE IN YUNOHOST
#=================================================
ynh_script_progression --message="Integrating service in YunoHost..."
yunohost service add "$app-web" --description "$app web service" --log_type "systemd"
yunohost service add "$app-sidekiq" --description "$app sidekiq service" --log_type "systemd"
yunohost service add "$app-streaming" --description "$app streaming service" --log_type "systemd"
#================================================= #=================================================
# GENERIC FINALIZATION # GENERIC FINALIZATION
#================================================= #=================================================
@ -335,16 +305,13 @@ ynh_script_progression --message="Securing files and directories..."
chown -R $app: $final_path chown -R $app: $final_path
#================================================= #=================================================
# SETUP SSOWAT # INTEGRATE SERVICE IN YUNOHOST
#================================================= #=================================================
ynh_script_progression --message="Upgrading SSOwat configuration..." ynh_script_progression --message="Integrating service in YunoHost..."
# Make app public if necessary yunohost service add "$app-web" --description "$app web service" --log_type "systemd"
if [ $is_public -eq 1 ] yunohost service add "$app-sidekiq" --description "$app sidekiq service" --log_type "systemd"
then yunohost service add "$app-streaming" --description "$app streaming service" --log_type "systemd"
# unprotected_uris allows SSO credentials to be passed anyway
ynh_app_setting_set --app=$app --key=unprotected_uris --value="/"
fi
#================================================= #=================================================
# START SYSTEMD SERVICE # START SYSTEMD SERVICE