1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/weblate_ynh.git synced 2024-10-01 13:35:04 +02:00

Merge pull request #47 from YunoHost-Apps/patch

Add ynh_add_config
This commit is contained in:
Éric Gaspar 2021-06-29 21:22:12 +02:00 committed by GitHub
commit e5a635a9ef
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
17 changed files with 219 additions and 196 deletions

View file

@ -1,24 +1,31 @@
<!--
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.
-->
# Weblate for YunoHost # Weblate for YunoHost
[![Integration level](https://dash.yunohost.org/integration/weblate.svg)](https://dash.yunohost.org/appci/app/weblate) ![](https://ci-apps.yunohost.org/ci/badges/weblate.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/weblate.maintain.svg) [![Integration level](https://dash.yunohost.org/integration/weblate.svg)](https://dash.yunohost.org/appci/app/weblate) ![](https://ci-apps.yunohost.org/ci/badges/weblate.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/weblate.maintain.svg)
[![Install Weblate with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=weblate) [![Install Weblate with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=weblate)
> *This package allows you to install Weblate quickly and simply on a YunoHost server. *[Lire ce readme en français.](./README_fr.md)*
> *This package allows you to install Weblate 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.* If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/install) to learn how to install it.*
## Overview ## Overview
Weblate is a libre web-based translation tool with tight version control integration. It provides two user interfaces, propagation of translations across components, quality checks and automatic linking to source files. Translation platform using Git and Python
**Shipped version:** 4.7 **Shipped version:** 4.7~ynh1
**Demo:** https://translate.yunohost.org
## Screenshots ## Screenshots
![](https://weblate.org/static/img/BigScreenshot.png) ![](./doc/screenshots/BigScreenshot.png)
## Demo ## Disclaimers / important information
* [YunoHost project uses Weblate for translations](https://translate.yunohost.org)
## GitHub ## GitHub
@ -38,31 +45,16 @@ You can edit the file `$final_path/local_settings.py` to enable or disable featu
It doesn't work yet, but while [it looks doable](https://docs.weblate.org/en/latest/admin/auth.html?highlight=LDAP#ldap-authentication), I'm unsure it is a good idea to connect this kind of tools to your LDAP. It doesn't work yet, but while [it looks doable](https://docs.weblate.org/en/latest/admin/auth.html?highlight=LDAP#ldap-authentication), I'm unsure it is a good idea to connect this kind of tools to your LDAP.
#### Supported architectures ## Documentation and resources
* x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/weblate%20%28Apps%29.svg)](https://ci-apps.yunohost.org/ci/apps/weblate/) * Official app website: https://weblate.org
* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/weblate%20%28Apps%29.svg)](https://ci-apps-arm.yunohost.org/ci/apps/weblate/) * Official user documentation: https://yunohost.org/apps
* Official admin documentation: https://docs.weblate.org/
* Upstream app code repository: https://github.com/WeblateOrg/weblate
* YunoHost documentation for this app: https://yunohost.org/app_weblate
* Report a bug: https://github.com/YunoHost-Apps/weblate_ynh/issues
## Limitations ## Developer info
* Any known limitations.
## Additional information
* Other info you would like to add about this app.
## Links
* Report a bug about this package: https://github.com/YunoHost-Apps/weblate_ynh
* Report a bug about Weblate itself: https://github.com/WeblateOrg/weblate
* Documentation: https://docs.weblate.org/
* Weblate website: https://weblate.org/
* YunoHost website: https://yunohost.org/
---
Developer info
----------------
Please send your pull request to the [testing branch](https://github.com/YunoHost-Apps/weblate_ynh/tree/testing). Please send your pull request to the [testing branch](https://github.com/YunoHost-Apps/weblate_ynh/tree/testing).
@ -72,3 +64,5 @@ sudo yunohost app install https://github.com/YunoHost-Apps/weblate_ynh/tree/test
or or
sudo yunohost app upgrade weblate -u https://github.com/YunoHost-Apps/weblate_ynh/tree/testing --debug sudo yunohost app upgrade weblate -u https://github.com/YunoHost-Apps/weblate_ynh/tree/testing --debug
``` ```
**More info regarding app packaging:** https://yunohost.org/packaging_apps

63
README_fr.md Normal file
View file

@ -0,0 +1,63 @@
# Weblate pour YunoHost
[![Niveau d'intégration](https://dash.yunohost.org/integration/weblate.svg)](https://dash.yunohost.org/appci/app/weblate) ![](https://ci-apps.yunohost.org/ci/badges/weblate.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/weblate.maintain.svg)
[![Installer Weblate avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=weblate)
*[Read this readme in english.](./README.md)*
*[Lire ce readme en français.](./README_fr.md)*
> *Ce package vous permet d'installer Weblate 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
Plateforme de traduction utilisant Git et Python
**Version incluse :** 4.7~ynh1
**Démo :** https://translate.yunohost.org
## Captures d'écran
![](./doc/screenshots/BigScreenshot.png)
## Avertissements / informations importantes
## GitHub
Vous devrez donner à Weblate un utilisateur GitHub et un jeton. Veuillez lire [la documentation de GitHub sur le jeton](https://help.github.com/articles/creating-a-personal-access-token-for-the-command-line/).
Cet utilisateur ne sera utilisé que pour ouvrir la pull-request, chaque traduction garde son auteur.
**Clés SSH**, vous devrez vous rendre dans l'administration, générer une clé publique pour Weblate et ajouter github.com pour que Weblate connaisse l'empreinte digitale. Veuillez noter que si votre compte possède déjà une clé publique (ssh-rsa), vous devrez ajouter manuellement celle de Weblate à votre compte GitHub.
## Paramètres et mises à niveau
Presque tout ce qui concerne la configuration de Weblate est géré dans un fichier `settings.py`.
Vous pouvez éditer le fichier `$final_path/local_settings.py` pour activer ou désactiver des fonctionnalités.
# Divers
## Connexion LDAP
Cela ne fonctionne pas encore, mais bien que [cela semble faisable](https://docs.weblate.org/en/latest/admin/auth.html?highlight=LDAP#ldap-authentication), je ne suis pas sûr que ce soit le cas une bonne idée de connecter ce genre d'outils à votre LDAP.
## Documentations et ressources
* Site officiel de l'app : https://weblate.org
* Documentation officielle utilisateur : https://yunohost.org/apps
* Documentation officielle de l'admin : https://docs.weblate.org/
* Dépôt de code officiel de l'app : https://github.com/WeblateOrg/weblate
* Documentation YunoHost pour cette app : https://yunohost.org/app_weblate
* Signaler un bug : https://github.com/YunoHost-Apps/weblate_ynh/issues
## Informations pour les développeurs
Merci de faire vos pull request sur la [branche testing](https://github.com/YunoHost-Apps/weblate_ynh/tree/testing).
Pour essayer la branche testing, procédez comme suit.
```
sudo yunohost app install https://github.com/YunoHost-Apps/weblate_ynh/tree/testing --debug
ou
sudo yunohost app upgrade weblate -u https://github.com/YunoHost-Apps/weblate_ynh/tree/testing --debug
```
**Plus d'infos sur le packaging d'applications :** https://yunohost.org/packaging_apps

View file

@ -1,15 +1,11 @@
# See here for more informations
# https://github.com/YunoHost/package_check#syntax-check_process-file
# Move this file from check_process.default to check_process when you have filled it.
;; Test complet ;; Test complet
; Manifest ; Manifest
domain="domain.tld" (DOMAIN) domain="domain.tld"
path="/path" (PATH) path="/path"
admin="john" (USER) admin="john"
password="randompass" password="randompass"
is_public=1 (PUBLIC|public=1|private=0) is_public=1
github_account="myaccount" github_account="myaccount"
github_token="myoauthtoken" github_token="myoauthtoken"
; Checks ; Checks
@ -20,15 +16,19 @@
setup_private=1 setup_private=1
setup_public=1 setup_public=1
upgrade=1 upgrade=1
upgrade=1 from_commit=cef22ac5634565cecd2d8545229efe3fe79d85bc #4.4
upgrade=1 from_commit=66eb909e771d11b092dfff2acf50ff63fa6f6ec6
#4.6.1
upgrade=1 from_commit=3f8363cdc588e609a775cb8b78b9d080f96405d9
backup_restore=1 backup_restore=1
multi_instance=1 multi_instance=1
port_already_use=0
change_url=1 change_url=1
;;; Options ;;; Options
Email= Email=
Notification=all Notification=all
;;; Upgrade options ;;; Upgrade options
; commit=cef22ac5634565cecd2d8545229efe3fe79d85bc ; commit=66eb909e771d11b092dfff2acf50ff63fa6f6ec6
name=Upgrade from 3.11.3 name=Upgrade from 4.4
; commit=3f8363cdc588e609a775cb8b78b9d080f96405d9
name=Upgrade from 4.6.1
manifest_arg=domain=DOMAIN&path=PATH&admin=USER&is_public=1&github_account=fake&github_token=fake manifest_arg=domain=DOMAIN&path=PATH&admin=USER&is_public=1&github_account=fake&github_token=fake

View file

@ -1,4 +1,4 @@
github.com: github.com:
- user: __GITHUBUSER__ - user: __GITHUB_ACCOUNT__
oauth_token: __GITHUBTOKEN__ oauth_token: __GITHUB_TOKEN__
protocol: https protocol: https

View file

@ -136,7 +136,7 @@ USE_L10N = True
USE_TZ = True USE_TZ = True
# URL prefix to use, please see documentation for more details # URL prefix to use, please see documentation for more details
URL_PREFIX = "__PATHURL__" URL_PREFIX = "__PATH_URL__"
# Absolute filesystem path to the directory that will hold user-uploaded files. # Absolute filesystem path to the directory that will hold user-uploaded files.
MEDIA_ROOT = os.path.join(DATA_DIR, "media") MEDIA_ROOT = os.path.join(DATA_DIR, "media")

View file

@ -42,7 +42,7 @@ from logging.handlers import SysLogHandler
DEBUG = False DEBUG = False
ADMINS = ( ADMINS = (
('__ADMIN__', '__ADMINMAIL__'), ('__ADMIN__', '__ADMIN_MAIL__'),
) )
MANAGERS = ADMINS MANAGERS = ADMINS
@ -52,9 +52,9 @@ DATABASES = {
# Use "postgresql" or "mysql". # Use "postgresql" or "mysql".
"ENGINE": "django.db.backends.postgresql", "ENGINE": "django.db.backends.postgresql",
# Database name. # Database name.
"NAME": "__NAME__", "NAME": "__APP__",
# Database user. # Database user.
"USER": "__NAME__", "USER": "__APP__",
# Name of role to alter to set parameters in PostgreSQL, # Name of role to alter to set parameters in PostgreSQL,
# use in case role name is different than user used for authentication. # use in case role name is different than user used for authentication.
# "ALTER_ROLE": "weblate", # "ALTER_ROLE": "weblate",
@ -158,7 +158,7 @@ USE_TZ = True
DEFAULT_AUTO_FIELD = "django.db.models.AutoField" DEFAULT_AUTO_FIELD = "django.db.models.AutoField"
# URL prefix to use, please see documentation for more details # URL prefix to use, please see documentation for more details
URL_PREFIX = "__PATHURL__" URL_PREFIX = "__PATH_URL__"
# Absolute filesystem path to the directory that will hold user-uploaded files. # Absolute filesystem path to the directory that will hold user-uploaded files.
MEDIA_ROOT = os.path.join(DATA_DIR, "media") MEDIA_ROOT = os.path.join(DATA_DIR, "media")
@ -221,8 +221,8 @@ TEMPLATES = [
# GitHub username and token for sending pull requests. # GitHub username and token for sending pull requests.
# Please see the documentation for more details. # Please see the documentation for more details.
GITHUB_USERNAME = "__GITHUBUSER__" GITHUB_USERNAME = "__GITHUB_ACCOUNT__"
GITHUB_TOKEN = "__GITHUBTOKEN__" GITHUB_TOKEN = "__GITHUB_TOKEN__"
# GitLab username and token for sending merge requests. # GitLab username and token for sending merge requests.
# Please see the documentation for more details. # Please see the documentation for more details.

View file

@ -5,7 +5,7 @@ protocol = uwsgi
socket = /var/run/__APP__/socket socket = /var/run/__APP__/socket
# http://uwsgi-docs.readthedocs.io/en/latest/Nginx.html#hosting-multiple-apps-in-the-same-process-aka-managing-script-name-and-path-info # http://uwsgi-docs.readthedocs.io/en/latest/Nginx.html#hosting-multiple-apps-in-the-same-process-aka-managing-script-name-and-path-info
mount = __PATH__=__FINALPATH__/venv/lib/__PYTHONPATH__/site-packages/weblate/wsgi.py mount = __PATH_URL__=__FINALPATH__/venv/lib/__WEBLATE_PYPATH__/site-packages/weblate/wsgi.py
# Add path to Weblate checkout if you did not install # Add path to Weblate checkout if you did not install
# Weblate by pip # Weblate by pip

17
doc/DISCLAIMER.md Normal file
View file

@ -0,0 +1,17 @@
## GitHub
You'll need to give Weblate a GitHub user and a token. Please read [GitHub's documentation about token](https://help.github.com/articles/creating-a-personal-access-token-for-the-command-line/).
This user will only be used to open the pull-request, each translation keep his author.
**SSH keys**, you will have to go in administration, and generate a public key for Weblate and add github.com so Weblate knows the fingerprint. Please note if your account already have a public key (ssh-rsa), you will have to manually add the Weblate's one to your GitHub account.
## Settings and upgrades
Almost everything related to Weblate's configuration is handled in a `settings.py` file.
You can edit the file `$final_path/local_settings.py` to enable or disable features.
# Miscellaneous
## LDAP connexion
It doesn't work yet, but while [it looks doable](https://docs.weblate.org/en/latest/admin/auth.html?highlight=LDAP#ldap-authentication), I'm unsure it is a good idea to connect this kind of tools to your LDAP.

17
doc/DISCLAIMER_fr.md Normal file
View file

@ -0,0 +1,17 @@
## GitHub
Vous devrez donner à Weblate un utilisateur GitHub et un jeton. Veuillez lire [la documentation de GitHub sur le jeton](https://help.github.com/articles/creating-a-personal-access-token-for-the-command-line/).
Cet utilisateur ne sera utilisé que pour ouvrir la pull-request, chaque traduction garde son auteur.
**Clés SSH**, vous devrez vous rendre dans l'administration, générer une clé publique pour Weblate et ajouter github.com pour que Weblate connaisse l'empreinte digitale. Veuillez noter que si votre compte possède déjà une clé publique (ssh-rsa), vous devrez ajouter manuellement celle de Weblate à votre compte GitHub.
## Paramètres et mises à niveau
Presque tout ce qui concerne la configuration de Weblate est géré dans un fichier `settings.py`.
Vous pouvez éditer le fichier `$final_path/local_settings.py` pour activer ou désactiver des fonctionnalités.
# Divers
## Connexion LDAP
Cela ne fonctionne pas encore, mais bien que [cela semble faisable](https://docs.weblate.org/en/latest/admin/auth.html?highlight=LDAP#ldap-authentication), je ne suis pas sûr que ce soit le cas une bonne idée de connecter ce genre d'outils à votre LDAP.

Binary file not shown.

After

Width:  |  Height:  |  Size: 52 KiB

View file

@ -3,22 +3,30 @@
"id": "weblate", "id": "weblate",
"packaging_format": 1, "packaging_format": 1,
"description": { "description": {
"en": "A translation platform using Git and Python", "en": "Translation platform using Git and Python",
"fr": "Une plateforme de traduction utilisant Git et Python" "fr": "Plateforme de traduction utilisant Git et Python"
}, },
"version": "4.7~ynh1", "version": "4.7~ynh1",
"url": "https://weblate.org", "url": "https://weblate.org",
"upstream": {
"license": "AGPL-3.0",
"website": "https://weblate.org",
"demo": "https://translate.yunohost.org",
"admindoc": "https://docs.weblate.org/",
"userdoc": "https://yunohost.org/apps",
"code": "https://github.com/WeblateOrg/weblate"
},
"license": "AGPL-3.0", "license": "AGPL-3.0",
"maintainer": { "maintainer": {
"name": "", "name": "YunoHost Contributors",
"email": "" "email": "apps@yunohost.org"
}, },
"previous_maintainers": [{ "previous_maintainers": [{
"name": "Jean-Baptiste Holcroft", "name": "Jean-Baptiste Holcroft",
"email": "jean-baptiste@holcroft.fr" "email": "jean-baptiste@holcroft.fr"
}], }],
"requirements": { "requirements": {
"yunohost": ">= 4.1.0" "yunohost": ">= 4.2.0"
}, },
"multi_instance": true, "multi_instance": true,
"services": [ "services": [

View file

@ -14,7 +14,6 @@ pkg_dependencies="libxml2-dev libxslt-dev libfreetype6-dev libjpeg-dev libz-dev
# Weblate's version for PIP and settings file # Weblate's version for PIP and settings file
weblate_version="4.7" weblate_version="4.7"
debian_maj_version=$(sed 's/\..*//' /etc/debian_version) debian_maj_version=$(sed 's/\..*//' /etc/debian_version)
if [ "$debian_maj_version" -eq 9 ] ; then if [ "$debian_maj_version" -eq 9 ] ; then
@ -138,5 +137,3 @@ ynh_redis_remove_db() {
#================================================= #=================================================
# EXPERIMENTAL HELPERS # EXPERIMENTAL HELPERS
#================================================= #=================================================

View file

@ -24,7 +24,7 @@ app=$YNH_APP_INSTANCE_NAME
#================================================= #=================================================
# LOAD SETTINGS # LOAD SETTINGS
#================================================= #=================================================
ynh_script_progression --message="Loading installation settings..." ynh_script_progression --message="Loading installation settings..." --weight=1
final_path=$(ynh_app_setting_get --app="$app" --key=final_path) final_path=$(ynh_app_setting_get --app="$app" --key=final_path)
is_public=$(ynh_app_setting_get --app="$app" --key=is_public) is_public=$(ynh_app_setting_get --app="$app" --key=is_public)
@ -67,7 +67,7 @@ fi
#================================================= #=================================================
# STOP SYSTEMD SERVICE # STOP SYSTEMD SERVICE
#================================================= #=================================================
ynh_script_progression --message="Stopping systemd services..." ynh_script_progression --message="Stopping systemd services..." --weight=1
ynh_systemd_action --service_name="$app" --action="stop" ynh_systemd_action --service_name="$app" --action="stop"
ynh_systemd_action --service_name="$app-celery" --action="stop" ynh_systemd_action --service_name="$app-celery" --action="stop"
@ -77,7 +77,7 @@ ynh_systemd_action --service_name="$app-celery" --action="stop"
#================================================= #=================================================
# MODIFY URL IN NGINX CONF # MODIFY URL IN NGINX CONF
#================================================= #=================================================
ynh_script_progression --message="Updating nginx web server configuration..." ynh_script_progression --message="Updating NGINX web server configuration..." --weight=1
nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf
@ -108,7 +108,7 @@ fi
#================================================= #=================================================
# MODIFY SETTINGS # MODIFY SETTINGS
#================================================= #=================================================
ynh_script_progression --message="Modify weblate's config file..." ynh_script_progression --message="Modify weblate's config file..." --weight=1
settings="$final_path/venv/lib/$weblate_pypath/site-packages/weblate/settings.py" settings="$final_path/venv/lib/$weblate_pypath/site-packages/weblate/settings.py"
ynh_backup_if_checksum_is_different --file="$settings" ynh_backup_if_checksum_is_different --file="$settings"
@ -160,7 +160,7 @@ ynh_systemd_action --service_name="$app-celery" --action="start"
#================================================= #=================================================
# RELOAD NGINX # RELOAD NGINX
#================================================= #=================================================
ynh_script_progression --message="Reloading nginx web server..." ynh_script_progression --message="Reloading NGINX web server..." --weight=1
ynh_systemd_action --service_name=nginx --action=reload ynh_systemd_action --service_name=nginx --action=reload

View file

@ -33,7 +33,7 @@ app=$YNH_APP_INSTANCE_NAME
#================================================= #=================================================
# 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..." ynh_script_progression --message="Validating installation parameters..." --weight=1
final_path=/var/www/$app final_path=/var/www/$app
test ! -e "$final_path" || ynh_die --message="This path already contains a folder" test ! -e "$final_path" || ynh_die --message="This path already contains a folder"
@ -46,7 +46,7 @@ mkdir -p "$final_path"
#================================================= #=================================================
# STORE SETTINGS FROM MANIFEST # STORE SETTINGS FROM MANIFEST
#================================================= #=================================================
ynh_script_progression --message="Storing installation settings..." ynh_script_progression --message="Storing installation settings..." --weight=1
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"
@ -67,7 +67,7 @@ ynh_exec_warn_less ynh_install_app_dependencies "$pkg_dependencies"
#================================================= #=================================================
# CREATE A PostgreSQL DATABASE # CREATE A PostgreSQL DATABASE
#================================================= #=================================================
ynh_script_progression --message="Creating a PostgreSQL database..." ynh_script_progression --message="Creating a PostgreSQL database..." --weight=2
db_name=$(ynh_sanitize_dbid --db_name="$app") db_name=$(ynh_sanitize_dbid --db_name="$app")
db_user=$db_name db_user=$db_name
@ -81,7 +81,7 @@ ynh_psql_setup_db --db_user="$db_user" --db_name="$db_name"
#================================================= #=================================================
# NGINX CONFIGURATION # NGINX CONFIGURATION
#================================================= #=================================================
ynh_script_progression --message="Configuring nginx web server..." ynh_script_progression --message="Configuring NGINX web server..." --weight=2
# Create a dedicated nginx config # Create a dedicated nginx config
ynh_add_nginx_config ynh_add_nginx_config
@ -89,7 +89,7 @@ ynh_add_nginx_config
#================================================= #=================================================
# CREATE DEDICATED USER # CREATE DEDICATED USER
#================================================= #=================================================
ynh_script_progression --message="Configuring system user..." ynh_script_progression --message="Configuring system user..." --weight=1
# Hub needs a home directory with a config file # Hub needs a home directory with a config file
ynh_system_user_create --username="$app" --home_dir="$final_path" --use_shell ynh_system_user_create --username="$app" --home_dir="$final_path" --use_shell
@ -97,12 +97,10 @@ ynh_system_user_create --username="$app" --home_dir="$final_path" --use_shell
#================================================= #=================================================
# CONFIGURE HUB # CONFIGURE HUB
#================================================= #=================================================
ynh_script_progression --message="Configure hub..." ynh_script_progression --message="Configure hub..." --weight=1
mkdir "$final_path/.config/" mkdir "$final_path/.config/"
cp ../conf/hub_config "$final_path/.config/hub" ynh_add_config --template="../conf/hub_config" --destination="$final_path/.config/hub"
ynh_replace_string --match_string="__GITHUBUSER__" --replace_string="$github_account" --target_file="$final_path/.config/hub"
ynh_replace_string --match_string="__GITHUBTOKEN__" --replace_string="$github_token" --target_file="$final_path/.config/hub"
cat <<EOF > "$final_path/.bashrc" cat <<EOF > "$final_path/.bashrc"
eval "$(hub alias -s /bin/bash)" eval "$(hub alias -s /bin/bash)"
@ -141,31 +139,16 @@ chown -R "$app": "$final_path"
# https://docs.weblate.org/en/latest/admin/install.html#installation # https://docs.weblate.org/en/latest/admin/install.html#installation
# TODO: use --extra-search-dir=/path/to/dists # TODO: use --extra-search-dir=/path/to/dists
#================================================= #=================================================
ynh_script_progression --message="Create weblate configuration file..." ynh_script_progression --message="Create weblate configuration file..." --weight=1
db_pwd=$(ynh_app_setting_get --app="$app" --key=psqlpwd) db_pwd=$(ynh_app_setting_get --app="$app" --key=psqlpwd)
admin_mail=$(ynh_user_get_info --username="$admin" --key=mail) admin_mail=$(ynh_user_get_info --username="$admin" --key=mail)
key=$(ynh_string_random --length=50) key=$(ynh_string_random --length=50)
redis_db=$(ynh_redis_get_free_db) redis_db=$(ynh_redis_get_free_db)
path_url="${path_url%/}"
settings="$final_path/venv/lib/$weblate_pypath/site-packages/weblate/settings.py" settings="$final_path/venv/lib/$weblate_pypath/site-packages/weblate/settings.py"
cp "../conf/settings.py" "$settings"
ynh_replace_string --match_string="__NAME__" --replace_string="$app" --target_file="$settings" ynh_add_config --template="../conf/settings.py" --destination="$settings"
ynh_replace_string --match_string="__DB_PWD__" --replace_string="$db_pwd" --target_file="$settings"
ynh_replace_string --match_string="__ADMIN__" --replace_string="$admin" --target_file="$settings"
ynh_replace_string --match_string="__ADMINMAIL__" --replace_string="$admin_mail" --target_file="$settings"
ynh_replace_string --match_string="__DOMAIN__" --replace_string="$domain" --target_file="$settings"
ynh_replace_string --match_string="__KEY__" --replace_string="$key" --target_file="$settings"
ynh_replace_string --match_string="__FINALPATH__" --replace_string="$final_path" --target_file="$settings"
ynh_replace_string --match_string="__GITHUBUSER__" --replace_string="$github_account" --target_file="$settings"
ynh_replace_string --match_string="__GITHUBTOKEN__" --replace_string="$github_token" --target_file="$settings"
ynh_replace_string --match_string="__REDIS_DB__" --replace_string="$redis_db" --target_file="$settings"
ynh_replace_string --match_string="__PYTHONPATH__" --replace_string="$weblate_pypath" --target_file="$settings"
ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="$settings"
# remove last "/" of $path_url
ynh_replace_string --match_string="__PATHURL__" --replace_string="${path_url%/}" --target_file="$settings"
ynh_app_setting_set --app="$app" --key=redis_db --value="$redis_db" ynh_app_setting_set --app="$app" --key=redis_db --value="$redis_db"
@ -209,36 +192,27 @@ ynh_store_file_checksum --file="$settings"
#================================================= #=================================================
# SPECIFIC SETUP UWSGI # SPECIFIC SETUP UWSGI
#================================================= #=================================================
ynh_script_progression --message="Configure uwsgi..." ynh_script_progression --message="Configure uwsgi..." --weight=1
finaluwsgiini="/etc/uwsgi/apps-available/$app.ini" finaluwsgiini="/etc/uwsgi/apps-available/$app.ini"
cp ../conf/uwsgi.ini "$finaluwsgiini"
ynh_replace_string --match_string="__FINALPATH__" --replace_string="$final_path" --target_file="$finaluwsgiini" ynh_add_config --template="../conf/uwsgi.ini" --destination="$finaluwsgiini"
ynh_replace_string --match_string="__PATH__" --replace_string="$path_url" --target_file="$finaluwsgiini"
ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="$finaluwsgiini"
ynh_replace_string --match_string="__PYTHONPATH__" --replace_string="$weblate_pypath" --target_file="$finaluwsgiini"
ynh_store_file_checksum --file="$finaluwsgiini"
#================================================= #=================================================
# SETUP SYSTEMD # SETUP SYSTEMD
#================================================= #=================================================
ynh_script_progression --message="Configuring a systemd service..." ynh_script_progression --message="Configuring a systemd service..." --weight=2
ynh_add_systemd_config --service="$app" --template="weblate.service" ynh_add_systemd_config --service="$app" --template="weblate.service"
#================================================= #=================================================
# ACTIVATE CELERY # ACTIVATE CELERY
#================================================= #=================================================
ynh_script_progression --message="Configure celery..." ynh_script_progression --message="Configure celery..." --weight=1
celeryconf="$final_path/celery-weblate" celeryconf="$final_path/celery-weblate"
cp ../conf/celery-weblate "$celeryconf"
ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="$celeryconf" ynh_add_config --template="../conf/celery-weblate" --destination="$celeryconf"
ynh_replace_string --match_string="__FINALPATH__" --replace_string="$final_path" --target_file="$celeryconf"
ynh_add_systemd_config --service="$app-celery" --template="celery-weblate.service" ynh_add_systemd_config --service="$app-celery" --template="celery-weblate.service"
@ -260,7 +234,7 @@ chmod -R o-rwx "$final_path"
#================================================= #=================================================
# SETUP LOGROTATE # SETUP LOGROTATE
#================================================= #=================================================
ynh_script_progression --message="Configuring log rotation..." ynh_script_progression --message="Configuring log rotation..." --weight=1
# Use logrotate to manage application logfile(s) # Use logrotate to manage application logfile(s)
ynh_use_logrotate --non-append ynh_use_logrotate --non-append
@ -268,7 +242,7 @@ ynh_use_logrotate --non-append
#================================================= #=================================================
# INTEGRATE SERVICE IN YUNOHOST # INTEGRATE SERVICE IN YUNOHOST
#================================================= #=================================================
ynh_script_progression --message="Integrating service in YunoHost..." ynh_script_progression --message="Integrating service in YunoHost..." --weight=3
yunohost service add "$app" --log "/var/log/$app/weblate.log" yunohost service add "$app" --log "/var/log/$app/weblate.log"
yunohost service add "$app-celery" --log "/var/log/$app/weblate-celery-w1.log" yunohost service add "$app-celery" --log "/var/log/$app/weblate-celery-w1.log"
@ -276,9 +250,7 @@ yunohost service add "$app-celery" --log "/var/log/$app/weblate-celery-w1.log"
#================================================= #=================================================
# SETUP SSOWAT # SETUP SSOWAT
#================================================= #=================================================
ynh_script_progression --message="Configuring SSOwat..." ynh_script_progression --message="Configuring permissions..." --weight=1
# Make app public if necessary # Make app public if necessary
if [ "$is_public" -eq 1 ] if [ "$is_public" -eq 1 ]
@ -297,7 +269,7 @@ ynh_systemd_action --service_name="$app-celery" --action="start"
#================================================= #=================================================
# RELOAD NGINX # RELOAD NGINX
#================================================= #=================================================
ynh_script_progression --message="Reloading nginx web server..." ynh_script_progression --message="Reloading NGINX web server..." --weight=1
ynh_systemd_action --service_name="nginx" --action="reload" ynh_systemd_action --service_name="nginx" --action="reload"
@ -312,4 +284,8 @@ If you facing an issue or want to improve this app, please open a new issue in t
ynh_send_readme_to_admin "$message" "$admin" ynh_send_readme_to_admin "$message" "$admin"
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Installation of $app completed" --last ynh_script_progression --message="Installation of $app completed" --last

View file

@ -12,7 +12,7 @@ source /usr/share/yunohost/helpers
#================================================= #=================================================
# LOAD SETTINGS # LOAD SETTINGS
#================================================= #=================================================
ynh_script_progression --message="Loading installation settings..." ynh_script_progression --message="Loading installation settings..." --weight=1
app=$YNH_APP_INSTANCE_NAME app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get --app="$app" --key=domain) domain=$(ynh_app_setting_get --app="$app" --key=domain)
@ -29,14 +29,14 @@ final_path=$(ynh_app_setting_get --app="$app" --key=final_path)
# Remove a service from the admin panel, added by `yunohost service add` # Remove a service from the admin panel, added by `yunohost service add`
if yunohost service status "$app" >/dev/null 2>&1 if yunohost service status "$app" >/dev/null 2>&1
then then
ynh_script_progression --message="Removing $app service integration..." ynh_script_progression --message="Removing $app service integration..." --weight=1
yunohost service remove "$app" yunohost service remove "$app"
fi fi
# Remove a service from the admin panel, added by `yunohost service add` # Remove a service from the admin panel, added by `yunohost service add`
if yunohost service status "$app-celery" >/dev/null 2>&1 if yunohost service status "$app-celery" >/dev/null 2>&1
then then
ynh_script_progression --message="Removing $app-celery service integration..." ynh_script_progression --message="Removing $app-celery service integration..." --weight=1
yunohost service remove "$app-celery" yunohost service remove "$app-celery"
fi fi
@ -51,7 +51,7 @@ ynh_remove_systemd_config --service="$app-celery"
#================================================= #=================================================
# REMOVE THE PostgreSQL DATABASE # REMOVE THE PostgreSQL DATABASE
#================================================= #=================================================
ynh_script_progression --message="Removing the PostgreSQL database..." ynh_script_progression --message="Removing the PostgreSQL database..." --weight=1
# Remove a database if it exists, along with the associated user # Remove a database if it exists, along with the associated user
ynh_psql_remove_db --db_user=$db_user --db_name=$db_name ynh_psql_remove_db --db_user=$db_user --db_name=$db_name
@ -75,7 +75,7 @@ ynh_exec_warn_less ynh_remove_app_dependencies
#================================================= #=================================================
# REMOVE APP MAIN DIR # REMOVE APP MAIN DIR
#================================================= #=================================================
ynh_script_progression --message="Removing app main directory..." ynh_script_progression --message="Removing app main directory..." --weight=2
# Remove the app directory securely # Remove the app directory securely
ynh_secure_remove --file="$final_path" ynh_secure_remove --file="$final_path"
@ -83,7 +83,7 @@ ynh_secure_remove --file="$final_path"
#================================================= #=================================================
# REMOVE NGINX CONFIGURATION # REMOVE NGINX CONFIGURATION
#================================================= #=================================================
ynh_script_progression --message="Removing nginx web server configuration..." ynh_script_progression --message="Removing NGINX web server configuration..." --weight=1
# Remove the dedicated nginx config # Remove the dedicated nginx config
ynh_remove_nginx_config ynh_remove_nginx_config
@ -91,7 +91,7 @@ ynh_remove_nginx_config
#================================================= #=================================================
# REMOVE LOGROTATE CONFIGURATION # REMOVE LOGROTATE CONFIGURATION
#================================================= #=================================================
ynh_script_progression --message="Removing logrotate configuration..." ynh_script_progression --message="Removing logrotate configuration..." --weight=1
# Remove the app-specific logrotate config # Remove the app-specific logrotate config
ynh_remove_logrotate ynh_remove_logrotate
@ -109,7 +109,7 @@ ynh_secure_remove --file="/var/run/$app-celery"
#================================================= #=================================================
# REMOVE DEDICATED USER # REMOVE DEDICATED USER
#================================================= #=================================================
ynh_script_progression --message="Removing the dedicated system user..." ynh_script_progression --message="Removing the dedicated system user..." --weight=1
# Delete a system user # Delete a system user
ynh_system_user_delete --username="$app" ynh_system_user_delete --username="$app"

View file

@ -18,7 +18,7 @@ ynh_abort_if_errors
#================================================= #=================================================
# LOAD SETTINGS # LOAD SETTINGS
#================================================= #=================================================
ynh_script_progression --message="Loading settings..." ynh_script_progression --message="Loading settings..." --weight=1
app=$YNH_APP_INSTANCE_NAME app=$YNH_APP_INSTANCE_NAME
@ -32,7 +32,7 @@ db_pwd=$(ynh_app_setting_get --app="$app" --key=psqlpwd)
#================================================= #=================================================
# CHECK IF THE APP CAN BE RESTORED # CHECK IF THE APP CAN BE RESTORED
#================================================= #=================================================
ynh_script_progression --message="Validating restoration parameters..." ynh_script_progression --message="Validating restoration parameters..." --weight=1
ynh_webpath_available --domain=$domain --path_url=$path_url \ ynh_webpath_available --domain=$domain --path_url=$path_url \
|| ynh_die --message="Path not available: ${domain}${path_url}" || ynh_die --message="Path not available: ${domain}${path_url}"
@ -50,7 +50,7 @@ ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#================================================= #=================================================
# RESTORE THE APP MAIN DIR # RESTORE THE APP MAIN DIR
#================================================= #=================================================
ynh_script_progression --message="Restoring the app main directory..." ynh_script_progression --message="Restoring the app main directory..." --weight=4
ynh_restore_file --origin_path="$final_path" ynh_restore_file --origin_path="$final_path"
@ -60,7 +60,7 @@ ln -sf "$final_path/local_settings.py" "$final_path/venv/lib/$weblate_pypath/sit
#================================================= #=================================================
# RECREATE THE DEDICATED USER # RECREATE THE DEDICATED USER
#================================================= #=================================================
ynh_script_progression --message="Recreating the dedicated system user..." ynh_script_progression --message="Recreating the dedicated system user..." --weight=1
# Create the dedicated user (if not existing) # Create the dedicated user (if not existing)
ynh_system_user_create --username=$app --home_dir="$final_path" --use_shell ynh_system_user_create --username=$app --home_dir="$final_path" --use_shell
@ -100,7 +100,7 @@ ynh_psql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./d
#================================================= #=================================================
# RESTORE SYSTEMD # RESTORE SYSTEMD
#================================================= #=================================================
ynh_script_progression --message="Restoring the systemd configuration..." ynh_script_progression --message="Restoring the systemd configuration..." --weight=4
ynh_restore_file --origin_path="/etc/systemd/system/$app.service" ynh_restore_file --origin_path="/etc/systemd/system/$app.service"
systemctl enable $app.service --quiet systemctl enable $app.service --quiet
@ -110,14 +110,14 @@ systemctl enable "$app-celery" --quiet
#================================================= #=================================================
# RESTORE UWSGI # RESTORE UWSGI
#================================================= #=================================================
ynh_script_progression --message="Restoring uwsgi configurations..." ynh_script_progression --message="Restoring uwsgi configurations..." --weight=1
ynh_restore_file --origin_path="/etc/uwsgi/apps-available/$app.ini" ynh_restore_file --origin_path="/etc/uwsgi/apps-available/$app.ini"
#================================================= #=================================================
# INTEGRATE SERVICE IN YUNOHOST # INTEGRATE SERVICE IN YUNOHOST
#================================================= #=================================================
ynh_script_progression --message="Integrating service in YunoHost..." ynh_script_progression --message="Integrating service in YunoHost..." --weight=3
yunohost service add "$app" --log "/var/log/$app/weblate.log" yunohost service add "$app" --log "/var/log/$app/weblate.log"
yunohost service add "$app-celery" --log "/var/log/$app/weblate-celery-w1.log" yunohost service add "$app-celery" --log "/var/log/$app/weblate-celery-w1.log"
@ -142,7 +142,7 @@ ynh_systemd_action --service_name="$app-celery" --action="start"
#================================================= #=================================================
# RELOAD NGINX # RELOAD NGINX
#================================================= #=================================================
ynh_script_progression --message="Reloading nginx web server..." ynh_script_progression --message="Reloading NGINX web server..." --weight=1
ynh_systemd_action --service_name="nginx" --action="reload" ynh_systemd_action --service_name="nginx" --action="reload"

View file

@ -11,12 +11,11 @@ source /usr/share/yunohost/helpers
#================================================= #=================================================
# LOAD SETTINGS # LOAD SETTINGS
#================================================= #=================================================
ynh_script_progression --message="Loading installation settings..." ynh_script_progression --message="Loading installation settings..." --weight=1
app=$YNH_APP_INSTANCE_NAME app=$YNH_APP_INSTANCE_NAME
path_url=$(ynh_app_setting_get --app="$app" --key=path) path_url=$(ynh_app_setting_get --app="$app" --key=path)
is_public=$(ynh_app_setting_get --app="$app" --key=is_public)
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=$db_name db_user=$db_name
@ -56,16 +55,7 @@ fi
#================================================= #=================================================
# ENSURE DOWNWARD COMPATIBILITY # ENSURE DOWNWARD COMPATIBILITY
#================================================= #=================================================
ynh_script_progression --message="Ensuring downward compatibility..." ynh_script_progression --message="Ensuring downward compatibility..." --weight=1
# Fix is_public as a boolean value
if [ "$is_public" = "Yes" ]; then
ynh_app_setting_set --app=$app --key=is_public --value=1
is_public=1
elif [ "$is_public" = "No" ]; then
ynh_app_setting_set --app=$app --key=is_public --value=0
is_public=0
fi
if [[ -d "$final_path/bin/" ]] if [[ -d "$final_path/bin/" ]]
then then
@ -94,7 +84,7 @@ ynh_systemd_action --service_name="$app-celery" --action="stop"
#================================================= #=================================================
# NGINX CONFIGURATION # NGINX CONFIGURATION
#================================================= #=================================================
ynh_script_progression --message="Upgrading nginx web server configuration..." ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=3
# Create a dedicated nginx config # Create a dedicated nginx config
ynh_add_nginx_config ynh_add_nginx_config
@ -104,14 +94,14 @@ ynh_add_nginx_config
#================================================= #=================================================
# Update dependencies # Update dependencies
#================================================= #=================================================
ynh_script_progression --message="Upgrading dependencies..." ynh_script_progression --message="Upgrading dependencies..." --weight=5
ynh_exec_warn_less ynh_install_app_dependencies "$pkg_dependencies" ynh_exec_warn_less ynh_install_app_dependencies "$pkg_dependencies"
#================================================= #=================================================
# CREATE DEDICATED USER # CREATE DEDICATED USER
#================================================= #=================================================
ynh_script_progression --message="Making sure dedicated system user exists..." ynh_script_progression --message="Making sure dedicated system user exists..." --weight=1
# Create a system user # Create a system user
ynh_system_user_create --username="$app" --home_dir="$final_path" --use_shell ynh_system_user_create --username="$app" --home_dir="$final_path" --use_shell
@ -119,12 +109,10 @@ ynh_system_user_create --username="$app" --home_dir="$final_path" --use_shell
#================================================= #=================================================
# CONFIGURE HUB # CONFIGURE HUB
#================================================= #=================================================
ynh_script_progression --message="Configure hub..." ynh_script_progression --message="Configure hub..." --weight=2
mkdir -p "$final_path/.config/" mkdir -p "$final_path/.config/"
cp ../conf/hub_config "$final_path/.config/hub" ynh_add_config --template="../conf/hub_config" --destination="$final_path/.config/hub"
ynh_replace_string --match_string="__GITHUBUSER__" --replace_string="$github_account" --target_file="$final_path/.config/hub"
ynh_replace_string --match_string="__GITHUBTOKEN__" --replace_string="$github_token" --target_file="$final_path/.config/hub"
cat <<EOF > "$final_path/.bashrc" cat <<EOF > "$final_path/.bashrc"
eval "$(hub alias -s /bin/bash)" eval "$(hub alias -s /bin/bash)"
@ -133,36 +121,27 @@ EOF
#================================================= #=================================================
# SPECIFIC SETUP UWSGI # SPECIFIC SETUP UWSGI
#================================================= #=================================================
ynh_script_progression --message="Configure uwsgi..." ynh_script_progression --message="Configure uwsgi..." --weight=2
finaluwsgiini="/etc/uwsgi/apps-available/$app.ini" finaluwsgiini="/etc/uwsgi/apps-available/$app.ini"
ynh_backup_if_checksum_is_different --file="$finaluwsgiini"
cp ../conf/uwsgi.ini "$finaluwsgiini"
ynh_replace_string --match_string="__FINALPATH__" --replace_string="$final_path" --target_file="$finaluwsgiini" ynh_add_config --template="../conf/uwsgi.ini" --destination="$finaluwsgiini"
ynh_replace_string --match_string="__PATH__" --replace_string="$path_url" --target_file="$finaluwsgiini"
ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="$finaluwsgiini"
ynh_replace_string --match_string="__PYTHONPATH__" --replace_string="$weblate_pypath" --target_file="$finaluwsgiini"
ynh_store_file_checksum --file="$finaluwsgiini"
#================================================= #=================================================
# SETUP SYSTEMD # SETUP SYSTEMD
#================================================= #=================================================
ynh_script_progression --message="Configuring a systemd service..." ynh_script_progression --message="Configuring a systemd service..." --weight=3
ynh_add_systemd_config --service="$app" --template="weblate.service" ynh_add_systemd_config --service="$app" --template="weblate.service"
#================================================= #=================================================
# ACTIVATE CELERY # ACTIVATE CELERY
#================================================= #=================================================
ynh_script_progression --message="Configure celery..." ynh_script_progression --message="Configure celery..." --weight=2
celeryconf="$final_path/celery-weblate" celeryconf="$final_path/celery-weblate"
cp ../conf/celery-weblate "$celeryconf"
ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="$celeryconf" ynh_add_config --template="../conf/celery-weblate" --destination="$celeryconf"
ynh_replace_string --match_string="__FINALPATH__" --replace_string="$final_path" --target_file="$celeryconf"
ynh_add_systemd_config --service="$app-celery" --template="celery-weblate.service" ynh_add_systemd_config --service="$app-celery" --template="celery-weblate.service"
@ -202,28 +181,12 @@ upgrade() {
#================================================= #=================================================
# MODIFY A CONFIG FILE # MODIFY A CONFIG FILE
#================================================= #=================================================
ynh_script_progression --message="Create weblate configuration file..." ynh_script_progression --message="Create weblate configuration file..." --weight=2
# save old settings file # save old settings file
settings="$final_path/venv/lib/$weblate_pypath/site-packages/weblate/settings.py" settings="$final_path/venv/lib/$weblate_pypath/site-packages/weblate/settings.py"
path_url="${path_url%/}"
ynh_backup_if_checksum_is_different --file="$settings" ynh_add_config --template="../conf/settings.py" --destination="$settings"
cp "$settings_template" "$settings"
ynh_replace_string --match_string="__NAME__" --replace_string="$app" --target_file="$settings"
ynh_replace_string --match_string="__DB_PWD__" --replace_string="$db_pwd" --target_file="$settings"
ynh_replace_string --match_string="__ADMIN__" --replace_string="$admin" --target_file="$settings"
ynh_replace_string --match_string="__ADMINMAIL__" --replace_string="$admin_mail" --target_file="$settings"
ynh_replace_string --match_string="__DOMAIN__" --replace_string="$domain" --target_file="$settings"
ynh_replace_string --match_string="__KEY__" --replace_string="$key" --target_file="$settings"
ynh_replace_string --match_string="__FINALPATH__" --replace_string="$final_path" --target_file="$settings"
ynh_replace_string --match_string="__GITHUBUSER__" --replace_string="$github_account" --target_file="$settings"
ynh_replace_string --match_string="__GITHUBTOKEN__" --replace_string="$github_token" --target_file="$settings"
ynh_replace_string --match_string="__REDIS_DB__" --replace_string="$redis_db" --target_file="$settings"
ynh_replace_string --match_string="__PYTHONPATH__" --replace_string="$weblate_pypath" --target_file="$settings"
ynh_replace_string --match_string="__APP__" --replace_string="$app" --target_file="$settings"
# remove last "/" of $path_url
ynh_replace_string --match_string="__PATHURL__" --replace_string="${path_url%/}" --target_file="$settings"
ynh_app_setting_set --app="$app" --key=redis_db --value="$redis_db" ynh_app_setting_set --app="$app" --key=redis_db --value="$redis_db"
@ -286,7 +249,7 @@ upgrade $weblate_version "../conf/settings.py"
#================================================= #=================================================
# SETUP LOGROTATE # SETUP LOGROTATE
#================================================= #=================================================
ynh_script_progression --message="Upgrading logrotate configuration..." ynh_script_progression --message="Upgrading logrotate configuration..." --weight=1
# Use logrotate to manage app-specific logfile(s) # Use logrotate to manage app-specific logfile(s)
ynh_use_logrotate --non-append ynh_use_logrotate --non-append
@ -294,7 +257,7 @@ ynh_use_logrotate --non-append
#================================================= #=================================================
# INTEGRATE SERVICE IN YUNOHOST # INTEGRATE SERVICE IN YUNOHOST
#================================================= #=================================================
ynh_script_progression --message="Integrating service in YunoHost..." ynh_script_progression --message="Integrating service in YunoHost..." --weight=2
yunohost service add "$app" --log "/var/log/$app/weblate.log" yunohost service add "$app" --log "/var/log/$app/weblate.log"
yunohost service add "$app-celery" --log "/var/log/$app/weblate-celery-w1.log" yunohost service add "$app-celery" --log "/var/log/$app/weblate-celery-w1.log"
@ -322,22 +285,10 @@ ynh_script_progression --message="Starting systemd services..." --weight=5
ynh_systemd_action --service_name="$app" --action="start" ynh_systemd_action --service_name="$app" --action="start"
ynh_systemd_action --service_name="$app-celery" --action="start" ynh_systemd_action --service_name="$app-celery" --action="start"
#=================================================
# SETUP SSOWAT
#=================================================
ynh_script_progression --message="Upgrading SSOwat configuration..."
# Make app public if necessary
if [ "$is_public" -eq 1 ]
then
# unprotected_uris allows SSO credentials to be passed anyway.
ynh_app_setting_set --app="$app" --key=unprotected_uris --value="/"
fi
#================================================= #=================================================
# RELOAD NGINX # RELOAD NGINX
#================================================= #=================================================
ynh_script_progression --message="Reloading nginx web server..." ynh_script_progression --message="Reloading NGINX web server..." --weight=1
ynh_systemd_action --service_name=nginx --action=reload ynh_systemd_action --service_name=nginx --action=reload
@ -345,4 +296,4 @@ ynh_systemd_action --service_name=nginx --action=reload
# END OF SCRIPT # END OF SCRIPT
#================================================= #=================================================
ynh_script_progression --message="Upgrade of $app completed" --last ynh_script_progression --message="Upgrade of $app completed" --last