mirror of
https://github.com/YunoHost-Apps/weblate_ynh.git
synced 2024-10-01 13:35:04 +02:00
Apply last example_ynh
This commit is contained in:
parent
c51b8ee032
commit
e7bcc4eb7b
10 changed files with 357 additions and 383 deletions
|
@ -16,7 +16,7 @@
|
||||||
setup_public=1
|
setup_public=1
|
||||||
upgrade=1
|
upgrade=1
|
||||||
#4.6.1
|
#4.6.1
|
||||||
upgrade=1 from_commit=3f8363cdc588e609a775cb8b78b9d080f96405d9
|
upgrade=1 from_commit=3f8363cdc588e609a775cb8b78b9d080f96405d9
|
||||||
backup_restore=1
|
backup_restore=1
|
||||||
multi_instance=1
|
multi_instance=1
|
||||||
port_already_use=0
|
port_already_use=0
|
||||||
|
|
|
@ -1,38 +1,38 @@
|
||||||
#sub_path_only rewrite ^__PATH__$ __PATH__/ permanent;
|
#sub_path_only rewrite ^__PATH__$ __PATH__/ permanent;
|
||||||
# https://github.com/WeblateOrg/weblate/blob/master/weblate/examples/weblate.nginx.conf
|
# https://github.com/WeblateOrg/weblate/blob/master/weblate/examples/weblate.nginx.conf
|
||||||
location = __PATH__/favicon.ico {
|
location = __PATH__/favicon.ico {
|
||||||
# DATA_DIR/static/favicon.ico
|
# DATA_DIR/static/favicon.ico
|
||||||
alias __FINALPATH__/data/static/favicon.ico;
|
alias __FINALPATH__/data/static/favicon.ico;
|
||||||
expires 30d;
|
expires 30d;
|
||||||
}
|
}
|
||||||
|
|
||||||
location = __PATH__/robots.txt {
|
location = __PATH__/robots.txt {
|
||||||
# DATA_DIR/static/robots.txt
|
# DATA_DIR/static/robots.txt
|
||||||
alias __FINALPATH__/data/static/robots.txt;
|
alias __FINALPATH__/data/static/robots.txt;
|
||||||
expires 30d;
|
expires 30d;
|
||||||
}
|
}
|
||||||
|
|
||||||
location __PATH__/static/ {
|
location __PATH__/static/ {
|
||||||
# DATA_DIR/static/
|
# DATA_DIR/static/
|
||||||
alias __FINALPATH__/data/static/;
|
alias __FINALPATH__/data/static/;
|
||||||
expires 30d;
|
expires 30d;
|
||||||
}
|
}
|
||||||
|
|
||||||
location __PATH__/media/ {
|
location __PATH__/media/ {
|
||||||
# DATA_DIR/media/
|
# DATA_DIR/media/
|
||||||
alias __FINALPATH__/data/media/;
|
alias __FINALPATH__/data/media/;
|
||||||
expires 30d;
|
expires 30d;
|
||||||
}
|
}
|
||||||
|
|
||||||
location __PATH__/ {
|
location __PATH__/ {
|
||||||
# Path to source
|
# Path to source
|
||||||
alias __FINALPATH__/ ;
|
alias __FINALPATH__/ ;
|
||||||
|
|
||||||
include uwsgi_params;
|
include uwsgi_params;
|
||||||
# Needed for long running operations in admin interface
|
# Needed for long running operations in admin interface
|
||||||
uwsgi_read_timeout 3600;
|
uwsgi_read_timeout 3600;
|
||||||
uwsgi_pass unix:///var/run/__NAME__/socket;
|
uwsgi_pass unix:///var/run/__NAME__/socket;
|
||||||
|
|
||||||
# Include SSOWAT user panel.
|
# Include SSOWAT user panel.
|
||||||
include conf.d/yunohost_panel.conf.inc;
|
include conf.d/yunohost_panel.conf.inc;
|
||||||
}
|
}
|
||||||
|
|
146
manifest.json
146
manifest.json
|
@ -1,14 +1,14 @@
|
||||||
{
|
{
|
||||||
"name": "Weblate",
|
"name": "Weblate",
|
||||||
"id": "weblate",
|
"id": "weblate",
|
||||||
"packaging_format": 1,
|
"packaging_format": 1,
|
||||||
"description": {
|
"description": {
|
||||||
"en": "Translation platform using Git and Python",
|
"en": "Translation platform using Git and Python",
|
||||||
"fr": "Plateforme de traduction utilisant Git et Python"
|
"fr": "Plateforme de traduction utilisant Git et Python"
|
||||||
},
|
},
|
||||||
"version": "4.11~ynh1",
|
"version": "4.11~ynh2",
|
||||||
"url": "https://weblate.org",
|
"url": "https://weblate.org",
|
||||||
"upstream": {
|
"upstream": {
|
||||||
"license": "AGPL-3.0",
|
"license": "AGPL-3.0",
|
||||||
"website": "https://weblate.org",
|
"website": "https://weblate.org",
|
||||||
"demo": "https://hosted.weblate.org/",
|
"demo": "https://hosted.weblate.org/",
|
||||||
|
@ -16,69 +16,65 @@
|
||||||
"userdoc": "https://docs.weblate.org/",
|
"userdoc": "https://docs.weblate.org/",
|
||||||
"code": "https://github.com/WeblateOrg/weblate"
|
"code": "https://github.com/WeblateOrg/weblate"
|
||||||
},
|
},
|
||||||
"license": "AGPL-3.0",
|
"license": "AGPL-3.0",
|
||||||
"maintainer": {
|
"maintainer": {
|
||||||
"name": "YunoHost Contributors",
|
"name": "YunoHost Contributors",
|
||||||
"email": "apps@yunohost.org"
|
"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.2.0"
|
"yunohost": ">= 4.3.0"
|
||||||
},
|
},
|
||||||
"multi_instance": true,
|
"multi_instance": true,
|
||||||
"services": [
|
"services": [
|
||||||
"nginx"
|
"nginx"
|
||||||
],
|
],
|
||||||
"arguments": {
|
"arguments": {
|
||||||
"install" : [
|
"install": [
|
||||||
{
|
{
|
||||||
"name": "domain",
|
"name": "domain",
|
||||||
"type": "domain"
|
"type": "domain"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "path",
|
"name": "path",
|
||||||
"type": "path",
|
"type": "path",
|
||||||
"example": "/weblate",
|
"example": "/weblate",
|
||||||
"default": "/weblate"
|
"default": "/weblate"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "is_public",
|
"name": "is_public",
|
||||||
"type": "boolean",
|
"type": "boolean",
|
||||||
"help": {
|
"default": false
|
||||||
"en": "Any YunoHost user and anonymous people from the web will be able to access the application",
|
},
|
||||||
"fr": "Tout utilisateur YunoHost et les personnes anonymes pourront accéder à l'application"
|
{
|
||||||
},
|
"name": "admin",
|
||||||
"default": false
|
"type": "user"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "admin",
|
"name": "password",
|
||||||
"type": "user"
|
"type": "password"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "password",
|
"name": "github_account",
|
||||||
"type": "password"
|
"type": "string",
|
||||||
},
|
"ask": {
|
||||||
{
|
"en": "GitHub's username",
|
||||||
"name": "github_account",
|
"fr": "Nom d'utilisateur de GitHub"
|
||||||
"type": "string",
|
},
|
||||||
"ask": {
|
"example": "Github account"
|
||||||
"en": "GitHub's username",
|
},
|
||||||
"fr": "Nom d'utilisateur de GitHub"
|
{
|
||||||
},
|
"name": "github_token",
|
||||||
"example": "Github account"
|
"type": "string",
|
||||||
},
|
"ask": {
|
||||||
{
|
"en": "GitHub's token (OAuth)",
|
||||||
"name": "github_token",
|
"fr": "Jeton GitHub (OAuth)"
|
||||||
"type": "string",
|
},
|
||||||
"ask": {
|
"example": "A secret token"
|
||||||
"en": "GitHub's token (OAuth)",
|
}
|
||||||
"fr": "Jeton GitHub (OAuth)"
|
]
|
||||||
},
|
}
|
||||||
"example": "A secret token"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,10 +6,11 @@
|
||||||
|
|
||||||
# dependencies used by the app
|
# dependencies used by the app
|
||||||
pkg_dependencies="libxml2-dev libxslt-dev libfreetype6-dev libjpeg-dev libz-dev libyaml-dev \
|
pkg_dependencies="libxml2-dev libxslt-dev libfreetype6-dev libjpeg-dev libz-dev libyaml-dev \
|
||||||
libcairo-dev gir1.2-pango-1.0 libgirepository1.0-dev libacl1-dev libssl-dev \
|
libffi-dev libcairo-dev gir1.2-pango-1.0 libgirepository1.0-dev \
|
||||||
build-essential python3-gdbm python3-enchant python3-dev python3-pip python3-virtualenv virtualenv git \
|
libacl1-dev libacl1 libssl-dev libpq-dev libjpeg62-turbo-dev build-essential \
|
||||||
uwsgi uwsgi-plugin-python3 redis-server postgresql postgresql-contrib \
|
python3-gdbm python3-dev python3-pip python3-virtualenv virtualenv git \
|
||||||
libpq-dev libglib2.0-dev mailutils python-celery-common hub"
|
uwsgi uwsgi-plugin-python3 redis-server postgresql postgresql-contrib \
|
||||||
|
liblz4-dev libzstd-dev libxxhash-dev python3-enchant libglib2.0-dev mailutils python-celery-common hub pkg-config python3-pkgconfig"
|
||||||
|
|
||||||
# Weblate's version for PIP and settings file
|
# Weblate's version for PIP and settings file
|
||||||
weblate_version="4.11"
|
weblate_version="4.11"
|
||||||
|
|
|
@ -6,9 +6,18 @@
|
||||||
# IMPORT GENERIC HELPERS
|
# IMPORT GENERIC HELPERS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
|
# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
|
||||||
source ../settings/scripts/_common.sh
|
source ../settings/scripts/_common.sh
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# MANAGE SCRIPT FAILURE
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
ynh_clean_setup () {
|
||||||
|
true
|
||||||
|
}
|
||||||
|
# Exit if an error occurs during the execution of the script
|
||||||
ynh_abort_if_errors
|
ynh_abort_if_errors
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -18,9 +27,9 @@ ynh_print_info --message="Loading installation settings..."
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
final_path=$(ynh_app_setting_get --app="$app" --key=final_path)
|
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||||
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)
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# DECLARE DATA AND CONF FILES TO BACKUP
|
# DECLARE DATA AND CONF FILES TO BACKUP
|
||||||
|
@ -39,12 +48,6 @@ ynh_backup --src_path="$final_path"
|
||||||
|
|
||||||
ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
ynh_backup --src_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# BACKUP THE PostgreSQL DATABASE
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
ynh_psql_dump_db --database="$db_name" > db.sql
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SPECIFIC BACKUP
|
# SPECIFIC BACKUP
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -53,12 +56,6 @@ ynh_psql_dump_db --database="$db_name" > db.sql
|
||||||
|
|
||||||
ynh_backup --src_path="/etc/logrotate.d/$app"
|
ynh_backup --src_path="/etc/logrotate.d/$app"
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# BACKUP THE UWSGI files
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
ynh_backup --src_path="/etc/uwsgi/apps-available/$app.ini"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP SYSTEMD
|
# BACKUP SYSTEMD
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -66,6 +63,19 @@ ynh_backup --src_path="/etc/uwsgi/apps-available/$app.ini"
|
||||||
ynh_backup --src_path="/etc/systemd/system/$app.service"
|
ynh_backup --src_path="/etc/systemd/system/$app.service"
|
||||||
ynh_backup --src_path="/etc/systemd/system/$app-celery.service"
|
ynh_backup --src_path="/etc/systemd/system/$app-celery.service"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# BACKUP VARIOUS FILES
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
ynh_backup --src_path="/etc/uwsgi/apps-available/$app.ini"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# BACKUP THE POSTGRESQL DATABASE
|
||||||
|
#=================================================
|
||||||
|
ynh_print_info --message="Backing up the PostgreSQL database..."
|
||||||
|
|
||||||
|
ynh_psql_dump_db --database="$db_name" > db.sql
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -26,21 +26,23 @@ app=$YNH_APP_INSTANCE_NAME
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Loading installation settings..." --weight=1
|
ynh_script_progression --message="Loading installation settings..." --weight=1
|
||||||
|
|
||||||
final_path=$(ynh_app_setting_get --app="$app" --key=final_path)
|
# Needed for helper "ynh_add_nginx_config"
|
||||||
is_public=$(ynh_app_setting_get --app="$app" --key=is_public)
|
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||||
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
# BACKUP BEFORE CHANGE URL THEN ACTIVE TRAP
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Backing up the app before changing its url (may take a while)..." --weight=40
|
ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..."
|
||||||
|
|
||||||
# Backup the current version of the app
|
# Backup the current version of the app
|
||||||
ynh_backup_before_upgrade
|
ynh_backup_before_upgrade
|
||||||
ynh_clean_setup () {
|
ynh_clean_setup () {
|
||||||
|
ynh_clean_check_starting
|
||||||
# Remove the new domain config file, the remove script won't do it as it doesn't know yet its location.
|
# Remove the new domain config file, the remove script won't do it as it doesn't know yet its location.
|
||||||
ynh_secure_remove --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
|
ynh_secure_remove --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
|
||||||
|
|
||||||
# restore it if the upgrade fails
|
# Restore it if the upgrade fails
|
||||||
ynh_restore_upgradebackup
|
ynh_restore_upgradebackup
|
||||||
}
|
}
|
||||||
# Exit if an error occurs during the execution of the script
|
# Exit if an error occurs during the execution of the script
|
||||||
|
@ -69,11 +71,9 @@ fi
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Stopping systemd services..." --weight=1
|
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" --log_path="/var/log/$app/weblate.log" --line_match="goodbye to uWSGI"
|
||||||
ynh_systemd_action --service_name="$app-celery" --action="stop"
|
ynh_systemd_action --service_name="$app-celery" --action="stop" --log_path="systemd" --line_match="Stopped"
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# STANDARD MODIFICATIONS
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# MODIFY URL IN NGINX CONF
|
# MODIFY URL IN NGINX CONF
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -81,19 +81,19 @@ ynh_script_progression --message="Updating NGINX web server configuration..." --
|
||||||
|
|
||||||
nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf
|
nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf
|
||||||
|
|
||||||
# Change the path in the nginx config file
|
# Change the path in the NGINX config file
|
||||||
if [ $change_path -eq 1 ]
|
if [ $change_path -eq 1 ]
|
||||||
then
|
then
|
||||||
# Make a backup of the original nginx config file if modified
|
# Make a backup of the original NGINX config file if modified
|
||||||
ynh_backup_if_checksum_is_different --file="$nginx_conf_path"
|
ynh_backup_if_checksum_is_different --file="$nginx_conf_path"
|
||||||
# Set global variables for nginx helper
|
# Set global variables for NGINX helper
|
||||||
domain="$old_domain"
|
domain="$old_domain"
|
||||||
path_url="$new_path"
|
path_url="$new_path"
|
||||||
# Create a dedicated nginx config
|
# Create a dedicated NGINX config
|
||||||
ynh_add_nginx_config
|
ynh_add_nginx_config
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Change the domain for nginx
|
# Change the domain for NGINX
|
||||||
if [ $change_domain -eq 1 ]
|
if [ $change_domain -eq 1 ]
|
||||||
then
|
then
|
||||||
# Delete file checksum for the old conf file location
|
# Delete file checksum for the old conf file location
|
||||||
|
@ -152,10 +152,10 @@ ynh_store_file_checksum --file="$finaluwsgiini"
|
||||||
#=================================================
|
#=================================================
|
||||||
# START SYSTEMD SERVICE
|
# START SYSTEMD SERVICE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Starting systemd services..." --weight=5
|
ynh_script_progression --message="Starting a systemd service..." --weight=5
|
||||||
|
|
||||||
ynh_systemd_action --service_name="$app" --action="start"
|
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/weblate.log" --line_match="spawned uWSGI"
|
||||||
ynh_systemd_action --service_name="$app-celery" --action="start"
|
ynh_systemd_action --service_name="$app-celery" --action="start" --log_path="/var/log/$app/weblate-celery-celery.log" --line_match="mingle: all alone"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RELOAD NGINX
|
# RELOAD NGINX
|
||||||
|
|
181
scripts/install
181
scripts/install
|
@ -13,6 +13,9 @@ source /usr/share/yunohost/helpers
|
||||||
# MANAGE SCRIPT FAILURE
|
# MANAGE SCRIPT FAILURE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
|
ynh_clean_setup () {
|
||||||
|
ynh_clean_check_starting
|
||||||
|
}
|
||||||
# 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
|
||||||
|
|
||||||
|
@ -23,13 +26,16 @@ ynh_abort_if_errors
|
||||||
domain=$YNH_APP_ARG_DOMAIN
|
domain=$YNH_APP_ARG_DOMAIN
|
||||||
path_url=$YNH_APP_ARG_PATH
|
path_url=$YNH_APP_ARG_PATH
|
||||||
admin=$YNH_APP_ARG_ADMIN
|
admin=$YNH_APP_ARG_ADMIN
|
||||||
password=$YNH_APP_ARG_PASSWORD
|
|
||||||
is_public=$YNH_APP_ARG_IS_PUBLIC
|
is_public=$YNH_APP_ARG_IS_PUBLIC
|
||||||
|
password=$YNH_APP_ARG_PASSWORD
|
||||||
github_account=$YNH_APP_ARG_GITHUB_ACCOUNT
|
github_account=$YNH_APP_ARG_GITHUB_ACCOUNT
|
||||||
github_token=$YNH_APP_ARG_GITHUB_TOKEN
|
github_token=$YNH_APP_ARG_GITHUB_TOKEN
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
|
||||||
|
admin_mail=$(ynh_user_get_info --username="$admin" --key=mail)
|
||||||
|
key=$(ynh_string_random --length=50)
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
|
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -41,19 +47,16 @@ test ! -e "$final_path" || ynh_die --message="This path already contains a folde
|
||||||
# Register (book) web path
|
# Register (book) web path
|
||||||
ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url
|
ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url
|
||||||
|
|
||||||
mkdir -p "$final_path"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STORE SETTINGS FROM MANIFEST
|
# STORE SETTINGS FROM MANIFEST
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Storing installation settings..." --weight=1
|
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
|
||||||
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=final_path --value="$final_path"
|
ynh_app_setting_set --app=$app --key=github_account --value=$github_account
|
||||||
ynh_app_setting_set --app="$app" --key=github_account --value="$github_account"
|
ynh_app_setting_set --app=$app --key=github_token --value=$github_token
|
||||||
ynh_app_setting_set --app="$app" --key=github_token --value="$github_token"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STANDARD MODIFICATIONS
|
# STANDARD MODIFICATIONS
|
||||||
|
@ -62,38 +65,54 @@ ynh_app_setting_set --app="$app" --key=github_token --value="$github_token"
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Installing dependencies..." --weight=40
|
ynh_script_progression --message="Installing dependencies..." --weight=40
|
||||||
|
|
||||||
ynh_exec_warn_less ynh_install_app_dependencies "$pkg_dependencies"
|
ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# CREATE A PostgreSQL DATABASE
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Creating a PostgreSQL database..." --weight=2
|
|
||||||
|
|
||||||
db_name=$(ynh_sanitize_dbid --db_name="$app")
|
|
||||||
db_user=$db_name
|
|
||||||
ynh_app_setting_set --app="$app" --key=db_name --value="$db_name"
|
|
||||||
|
|
||||||
ynh_psql_test_if_first_run
|
|
||||||
|
|
||||||
# Initialize database and store postgres password for upgrade
|
|
||||||
ynh_psql_setup_db --db_user="$db_user" --db_name="$db_name"
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# NGINX CONFIGURATION
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Configuring NGINX web server..." --weight=2
|
|
||||||
|
|
||||||
# Create a dedicated nginx config
|
|
||||||
ynh_add_nginx_config
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CREATE DEDICATED USER
|
# CREATE DEDICATED USER
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Configuring system user..." --weight=1
|
ynh_script_progression --message="Configuring system user..." --weight=1
|
||||||
|
|
||||||
# Hub needs a home directory with a config file
|
# 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
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# CREATE A POSTGRESQL DATABASE
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Creating a PostgreSQL database..." --weight=2
|
||||||
|
|
||||||
|
db_name=$(ynh_sanitize_dbid --db_name=$app)
|
||||||
|
db_user=$db_name
|
||||||
|
ynh_app_setting_set --app=$app --key=db_name --value=$db_name
|
||||||
|
|
||||||
|
ynh_psql_test_if_first_run
|
||||||
|
ynh_psql_setup_db --db_user=$db_user --db_name=$db_name
|
||||||
|
ynh_psql_execute_as_root --sql="CREATE EXTENSION IF NOT EXISTS pg_trgm;" --database=$db_name
|
||||||
|
db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd)
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Setting up source files..."
|
||||||
|
|
||||||
|
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
|
||||||
|
mkdir -p "$final_path"
|
||||||
|
mkdir -p "$final_path/avatar-cache"
|
||||||
|
mkdir -p "$final_path/data"
|
||||||
|
|
||||||
|
chmod 750 "$final_path"
|
||||||
|
chmod -R o-rwx "$final_path"
|
||||||
|
chown -R $app:www-data "$final_path"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# NGINX CONFIGURATION
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Configuring NGINX web server..." --weight=2
|
||||||
|
|
||||||
|
# Create a dedicated NGINX config
|
||||||
|
ynh_add_nginx_config
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# SPECIFIC SETUP
|
||||||
#=================================================
|
#=================================================
|
||||||
# CONFIGURE HUB
|
# CONFIGURE HUB
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -106,17 +125,13 @@ cat <<EOF > "$final_path/.bashrc"
|
||||||
eval "$(hub alias -s /bin/bash)"
|
eval "$(hub alias -s /bin/bash)"
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# SPECIFIC SETUP
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# PIP INSTALLATION
|
# PIP INSTALLATION
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Install weblate using PIP..." --weight=80
|
ynh_script_progression --message="Install weblate using PIP..." --weight=80
|
||||||
|
|
||||||
ynh_psql_execute_as_root --sql="CREATE EXTENSION IF NOT EXISTS pg_trgm;" --database=$db_name
|
|
||||||
|
|
||||||
virtualenv --python=python3 "${final_path}/venv"
|
virtualenv --python=python3 "${final_path}/venv"
|
||||||
chown -R "$app": "$final_path"
|
chown -R $app: "$final_path"
|
||||||
|
|
||||||
#run source in a 'sub shell'
|
#run source in a 'sub shell'
|
||||||
(
|
(
|
||||||
|
@ -129,7 +144,7 @@ chown -R "$app": "$final_path"
|
||||||
# Tmp fix
|
# Tmp fix
|
||||||
sudo --user=$app $final_path/venv/bin/pip install --upgrade cffi==1.14
|
sudo --user=$app $final_path/venv/bin/pip install --upgrade cffi==1.14
|
||||||
# Still needed with latest version of weblate?
|
# Still needed with latest version of weblate?
|
||||||
sudo --user=$app $final_path/venv/bin/pip install Weblate=="$weblate_version"
|
sudo --user=$app BORG_OPENSSL_PREFIX=/usr/lib/x86_64-linux-gnu/ $final_path/venv/bin/pip install Weblate=="$weblate_version"
|
||||||
sudo --user=$app $final_path/venv/bin/pip install psycopg2-binary ruamel.yaml aeidon phply
|
sudo --user=$app $final_path/venv/bin/pip install psycopg2-binary ruamel.yaml aeidon phply
|
||||||
#pip install pytz python-bidi PyYaML Babel pyuca pylibravatar py3dns psycopg2-binary phply django-redis hiredis aeidon ruamel.yaml
|
#pip install pytz python-bidi PyYaML Babel pyuca pylibravatar py3dns psycopg2-binary phply django-redis hiredis aeidon ruamel.yaml
|
||||||
# specific to YunoHost package:
|
# specific to YunoHost package:
|
||||||
|
@ -137,26 +152,29 @@ chown -R "$app": "$final_path"
|
||||||
)
|
)
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SPECIFIC SETUP settings.py
|
# ADD A CONFIGURATION
|
||||||
# https://docs.weblate.org/en/latest/admin/install.html#installation
|
|
||||||
# TODO: use --extra-search-dir=/path/to/dists
|
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Create weblate configuration file..." --weight=1
|
ynh_script_progression --message="Adding a configuration file..." --weight=1
|
||||||
|
|
||||||
db_pwd=$(ynh_app_setting_get --app="$app" --key=psqlpwd)
|
|
||||||
admin_mail=$(ynh_user_get_info --username="$admin" --key=mail)
|
|
||||||
key=$(ynh_string_random --length=50)
|
|
||||||
redis_db=$(ynh_redis_get_free_db)
|
redis_db=$(ynh_redis_get_free_db)
|
||||||
|
ynh_app_setting_set --app=$app --key=redis_db --value="$redis_db"
|
||||||
path_url="${path_url%/}"
|
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"
|
||||||
|
|
||||||
ynh_add_config --template="../conf/settings.py" --destination="$settings"
|
ynh_add_config --template="../conf/settings.py" --destination="$settings"
|
||||||
|
ynh_add_config --template="../conf/celery-weblate" --destination="$final_path/celery-weblate"
|
||||||
ynh_app_setting_set --app="$app" --key=redis_db --value="$redis_db"
|
ynh_add_config --template="../conf/uwsgi.ini" --destination="/etc/uwsgi/apps-available/$app.ini"
|
||||||
|
|
||||||
touch "$final_path/local_settings.py"
|
touch "$final_path/local_settings.py"
|
||||||
ln -sf "$final_path/local_settings.py" "$final_path/venv/lib/$weblate_pypath/site-packages/weblate/local_settings.py"
|
ln -sf "$final_path/local_settings.py" "$final_path/venv/lib/$weblate_pypath/site-packages/weblate/local_settings.py"
|
||||||
|
|
||||||
|
# Set permissions to app files
|
||||||
|
chmod 750 "$final_path"
|
||||||
|
chmod -R o-rwx "$final_path"
|
||||||
|
chown -R $app: "$final_path"
|
||||||
|
chown "$app:www-data" "$final_path"
|
||||||
|
chown -R "$app:www-data" "$final_path/data"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SPECIFIC SETUP Filling up the database
|
# SPECIFIC SETUP Filling up the database
|
||||||
# https://docs.weblate.org/en/latest/admin/install.html#filling-up-the-database
|
# https://docs.weblate.org/en/latest/admin/install.html#filling-up-the-database
|
||||||
|
@ -184,55 +202,16 @@ ynh_script_progression --message="Filling up the database..." --weight=10
|
||||||
sudo --user=$app $final_path/venv/bin/weblate check --deploy || true
|
sudo --user=$app $final_path/venv/bin/weblate check --deploy || true
|
||||||
)
|
)
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# STORE THE CHECKSUM OF THE CONFIG FILE
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
# Calculate and store the config file checksum into the app settings
|
|
||||||
ynh_store_file_checksum --file="$settings"
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# SPECIFIC SETUP UWSGI
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Configure uwsgi..." --weight=1
|
|
||||||
|
|
||||||
finaluwsgiini="/etc/uwsgi/apps-available/$app.ini"
|
|
||||||
|
|
||||||
ynh_add_config --template="../conf/uwsgi.ini" --destination="$finaluwsgiini"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SETUP SYSTEMD
|
# SETUP SYSTEMD
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Configuring a systemd service..." --weight=2
|
ynh_script_progression --message="Configuring a systemd service..." --weight=3
|
||||||
|
|
||||||
ynh_add_systemd_config --service="$app" --template="weblate.service"
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# ACTIVATE CELERY
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Configure celery..." --weight=1
|
|
||||||
|
|
||||||
celeryconf="$final_path/celery-weblate"
|
|
||||||
|
|
||||||
ynh_add_config --template="../conf/celery-weblate" --destination="$celeryconf"
|
|
||||||
|
|
||||||
|
ynh_add_systemd_config --service=$app --template="weblate.service"
|
||||||
ynh_add_systemd_config --service="$app-celery" --template="celery-weblate.service"
|
ynh_add_systemd_config --service="$app-celery" --template="celery-weblate.service"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# GENERIC FINALIZATION
|
# GENERIC FINALIZATION
|
||||||
#=================================================
|
|
||||||
# SECURE FILES AND DIRECTORIES
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
# Set permissions to app files
|
|
||||||
mkdir -p "$final_path/avatar-cache"
|
|
||||||
chown -R "$app": "$final_path"
|
|
||||||
chown "$app:www-data" "$final_path"
|
|
||||||
chown -R "$app:www-data" "$final_path/data"
|
|
||||||
|
|
||||||
chmod 750 "$final_path"
|
|
||||||
chmod -R o-rwx "$final_path"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SETUP LOGROTATE
|
# SETUP LOGROTATE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -246,8 +225,16 @@ ynh_use_logrotate --non-append
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Integrating service in YunoHost..." --weight=3
|
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"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# START SYSTEMD SERVICE
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Starting a systemd service..." --weight=5
|
||||||
|
|
||||||
|
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/weblate.log" --line_match="spawned uWSGI"
|
||||||
|
ynh_systemd_action --service_name="$app-celery" --action="start" --log_path="/var/log/$app/weblate-celery-celery.log" --line_match="mingle: all alone"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SETUP SSOWAT
|
# SETUP SSOWAT
|
||||||
|
@ -255,19 +242,11 @@ yunohost service add "$app-celery" --log "/var/log/$app/weblate-celery-w1.log"
|
||||||
ynh_script_progression --message="Configuring permissions..." --weight=1
|
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 ]
|
||||||
then
|
then
|
||||||
ynh_permission_update --permission="main" --add="visitors"
|
ynh_permission_update --permission="main" --add="visitors"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# Start weblate
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Starting weblate's services..." --weight=5
|
|
||||||
|
|
||||||
ynh_systemd_action --service_name="$app" --action="start"
|
|
||||||
ynh_systemd_action --service_name="$app-celery" --action="start"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RELOAD NGINX
|
# RELOAD NGINX
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -15,63 +15,57 @@ source /usr/share/yunohost/helpers
|
||||||
ynh_script_progression --message="Loading installation settings..." --weight=1
|
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)
|
|
||||||
db_name=$(ynh_app_setting_get --app="$app" --key=db_name)
|
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||||
|
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||||
db_user=$db_name
|
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)
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STANDARD REMOVE
|
# STANDARD REMOVE
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE SERVICE FROM ADMIN PANEL
|
# REMOVE SERVICE INTEGRATION IN YUNOHOST
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
# Remove a service from the admin panel, added by `yunohost service add`
|
# Remove the service from the list of services known by YunoHost (added from `yunohost service add`)
|
||||||
if yunohost service status "$app" >/dev/null 2>&1
|
if ynh_exec_warn_less yunohost service status $app >/dev/null
|
||||||
then
|
then
|
||||||
ynh_script_progression --message="Removing $app service integration..." --weight=1
|
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 the service from the list of services known by YunoHost (added from `yunohost service add`)
|
||||||
if yunohost service status "$app-celery" >/dev/null 2>&1
|
if ynh_exec_warn_less yunohost service status "$app-celery" >/dev/null
|
||||||
then
|
then
|
||||||
ynh_script_progression --message="Removing $app-celery service integration..." --weight=1
|
ynh_script_progression --message="Removing $app-celery service integration..." --weight=1
|
||||||
yunohost service remove "$app-celery"
|
yunohost service remove "$app-celery"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STOP WEBLATE'S SERVICES
|
# STOP AND REMOVE SERVICE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Stopping and removing systemd services..." --weight=5
|
ynh_script_progression --message="Stopping and removing the systemd service..." --weight=5
|
||||||
|
|
||||||
ynh_remove_systemd_config --service="$app"
|
# Remove the dedicated systemd config
|
||||||
|
ynh_remove_systemd_config --service=$app
|
||||||
ynh_remove_systemd_config --service="$app-celery"
|
ynh_remove_systemd_config --service="$app-celery"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE THE PostgreSQL DATABASE
|
# REMOVE LOGROTATE CONFIGURATION
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Removing logrotate configuration..." --weight=1
|
||||||
|
|
||||||
|
# Remove the app-specific logrotate config
|
||||||
|
ynh_remove_logrotate
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# REMOVE THE POSTGRESQL DATABASE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Removing the PostgreSQL database..." --weight=1
|
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
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# REMOVE REDIS DB
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
ynh_redis_remove_db
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# REMOVE DEPENDENCIES
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Removing dependencies..." --weight=10
|
|
||||||
|
|
||||||
# Remove metapackage and its dependencies
|
|
||||||
finaluwsgiini="/etc/uwsgi/apps-available/$app.ini"
|
|
||||||
ynh_secure_remove --file="$finaluwsgiini"
|
|
||||||
ynh_exec_warn_less ynh_remove_app_dependencies
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE APP MAIN DIR
|
# REMOVE APP MAIN DIR
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -85,25 +79,30 @@ ynh_secure_remove --file="$final_path"
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Removing NGINX web server configuration..." --weight=1
|
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
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE LOGROTATE CONFIGURATION
|
# REMOVE DEPENDENCIES
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Removing logrotate configuration..." --weight=1
|
ynh_script_progression --message="Removing dependencies..." --weight=10
|
||||||
|
|
||||||
# Remove the app-specific logrotate config
|
# Remove metapackage and its dependencies
|
||||||
ynh_remove_logrotate
|
ynh_exec_warn_less ynh_remove_app_dependencies
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SPECIFIC REMOVE
|
# SPECIFIC REMOVE
|
||||||
#=================================================
|
#=================================================
|
||||||
# REMOVE CELERY FILES
|
# REMOVE VARIOUS FILES
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Removing various files..."
|
||||||
|
|
||||||
|
ynh_secure_remove --file="/etc/uwsgi/apps-available/$app.ini"
|
||||||
|
|
||||||
ynh_secure_remove --file="/var/run/$app-celery"
|
ynh_secure_remove --file="/var/run/$app-celery"
|
||||||
|
|
||||||
|
ynh_redis_remove_db
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# GENERIC FINALIZATION
|
# GENERIC FINALIZATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -112,9 +111,10 @@ ynh_secure_remove --file="/var/run/$app-celery"
|
||||||
ynh_script_progression --message="Removing the dedicated system user..." --weight=1
|
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
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_script_progression --message="Removal of $app completed" --last
|
ynh_script_progression --message="Removal of $app completed" --last
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
# IMPORT GENERIC HELPERS
|
# IMPORT GENERIC HELPERS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
|
# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
|
||||||
source ../settings/scripts/_common.sh
|
source ../settings/scripts/_common.sh
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
|
@ -13,6 +14,10 @@ source /usr/share/yunohost/helpers
|
||||||
# MANAGE SCRIPT FAILURE
|
# MANAGE SCRIPT FAILURE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
|
ynh_clean_setup () {
|
||||||
|
ynh_clean_check_starting
|
||||||
|
}
|
||||||
|
# Exit if an error occurs during the execution of the script
|
||||||
ynh_abort_if_errors
|
ynh_abort_if_errors
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -22,12 +27,11 @@ ynh_script_progression --message="Loading 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)
|
||||||
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=$db_name
|
db_user=$db_name
|
||||||
db_pwd=$(ynh_app_setting_get --app="$app" --key=psqlpwd)
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CHECK IF THE APP CAN BE RESTORED
|
# CHECK IF THE APP CAN BE RESTORED
|
||||||
|
@ -42,9 +46,18 @@ test ! -d $final_path \
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE THE NGINX CONFIGURATION
|
# RESTORE THE NGINX CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
|
ynh_script_progression --message="Restoring the NGINX web server configuration..."
|
||||||
|
|
||||||
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# RECREATE THE DEDICATED USER
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Recreating the dedicated system user..." --weight=1
|
||||||
|
|
||||||
|
# Create the dedicated user (if not existing)
|
||||||
|
ynh_system_user_create --username=$app --home_dir="$final_path" --use_shell
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE THE APP MAIN DIR
|
# RESTORE THE APP MAIN DIR
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -55,26 +68,11 @@ ynh_restore_file --origin_path="$final_path"
|
||||||
touch "$final_path/local_settings.py"
|
touch "$final_path/local_settings.py"
|
||||||
ln -sf "$final_path/local_settings.py" "$final_path/venv/lib/$weblate_pypath/site-packages/weblate/local_settings.py"
|
ln -sf "$final_path/local_settings.py" "$final_path/venv/lib/$weblate_pypath/site-packages/weblate/local_settings.py"
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# RECREATE THE DEDICATED USER
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Recreating the dedicated system user..." --weight=1
|
|
||||||
|
|
||||||
# Create the dedicated user (if not existing)
|
|
||||||
ynh_system_user_create --username=$app --home_dir="$final_path" --use_shell
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# RESTORE USER RIGHTS
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
# Restore permissions on app files
|
|
||||||
mkdir -p "$final_path/avatar-cache"
|
|
||||||
chown -R "$app": "$final_path"
|
|
||||||
chown "$app:www-data" "$final_path"
|
|
||||||
chown -R "$app:www-data" "$final_path/data"
|
|
||||||
|
|
||||||
chmod 750 "$final_path"
|
chmod 750 "$final_path"
|
||||||
chmod -R o-rwx "$final_path"
|
chmod -R o-rwx "$final_path"
|
||||||
|
chown -R $app: "$final_path"
|
||||||
|
chown $app:www-data "$final_path"
|
||||||
|
chown -R $app:www-data "$final_path/data"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SPECIFIC RESTORATION
|
# SPECIFIC RESTORATION
|
||||||
|
@ -83,6 +81,7 @@ chmod -R o-rwx "$final_path"
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Reinstalling dependencies..." --weight=40
|
ynh_script_progression --message="Reinstalling dependencies..." --weight=40
|
||||||
|
|
||||||
|
# Define and install dependencies
|
||||||
ynh_exec_warn_less ynh_install_app_dependencies "$pkg_dependencies"
|
ynh_exec_warn_less ynh_install_app_dependencies "$pkg_dependencies"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -90,11 +89,19 @@ ynh_exec_warn_less ynh_install_app_dependencies "$pkg_dependencies"
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Restoring the PostgreSQL database..." --weight=5
|
ynh_script_progression --message="Restoring the PostgreSQL database..." --weight=5
|
||||||
|
|
||||||
|
db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd)
|
||||||
ynh_psql_test_if_first_run
|
ynh_psql_test_if_first_run
|
||||||
ynh_psql_setup_db --db_user="$db_user" --db_name="$db_name" --db_pwd="$db_pwd"
|
ynh_psql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd
|
||||||
ynh_psql_execute_as_root --sql="CREATE EXTENSION IF NOT EXISTS pg_trgm;" --database=$db_name
|
ynh_psql_execute_as_root --sql="CREATE EXTENSION IF NOT EXISTS pg_trgm;" --database=$db_name
|
||||||
ynh_psql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql
|
ynh_psql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# RESTORE VARIOUS FILES
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Restoring various files..." --weight=1
|
||||||
|
|
||||||
|
ynh_restore_file --origin_path="/etc/uwsgi/apps-available/$app.ini"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE SYSTEMD
|
# RESTORE SYSTEMD
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -106,45 +113,40 @@ ynh_restore_file --origin_path="/etc/systemd/system/$app-celery.service"
|
||||||
systemctl enable "$app-celery" --quiet
|
systemctl enable "$app-celery" --quiet
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE UWSGI
|
# RESTORE THE LOGROTATE CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Restoring uwsgi configurations..." --weight=1
|
ynh_script_progression --message="Restoring the logrotate configuration..."
|
||||||
|
|
||||||
ynh_restore_file --origin_path="/etc/uwsgi/apps-available/$app.ini"
|
mkdir -p "/var/log/$app"
|
||||||
|
ynh_restore_file --origin_path="/etc/logrotate.d/$app"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# INTEGRATE SERVICE IN YUNOHOST
|
# INTEGRATE SERVICE IN YUNOHOST
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Integrating service in YunoHost..." --weight=3
|
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"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE THE LOGROTATE CONFIGURATION
|
# START SYSTEMD SERVICE
|
||||||
#=================================================
|
|
||||||
|
|
||||||
mkdir -p "/var/log/$app"
|
|
||||||
ynh_restore_file --origin_path="/etc/logrotate.d/$app"
|
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# GENERIC FINALIZATION
|
|
||||||
#=================================================
|
|
||||||
# START WEBLATE
|
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Starting a systemd service..." --weight=5
|
ynh_script_progression --message="Starting a systemd service..." --weight=5
|
||||||
|
|
||||||
ynh_systemd_action --service_name="$app" --action="start"
|
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/weblate.log" --line_match="spawned uWSGI"
|
||||||
ynh_systemd_action --service_name="$app-celery" --action="start"
|
ynh_systemd_action --service_name="$app-celery" --action="start" --log_path="/var/log/$app/weblate-celery-celery.log" --line_match="mingle: all alone"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# GENERIC FINALIZATION
|
||||||
#=================================================
|
#=================================================
|
||||||
# RELOAD NGINX
|
# RELOAD NGINX
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
|
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
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_script_progression --message="Restoration completed for $app" --last
|
ynh_script_progression --message="Restoration completed for $app" --last
|
||||||
|
|
130
scripts/upgrade
130
scripts/upgrade
|
@ -5,6 +5,7 @@
|
||||||
#=================================================
|
#=================================================
|
||||||
# IMPORT GENERIC HELPERS
|
# IMPORT GENERIC HELPERS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
source _common.sh
|
source _common.sh
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
|
@ -15,18 +16,19 @@ 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)
|
domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||||
final_path=$(ynh_app_setting_get --app="$app" --key=final_path)
|
path_url=$(ynh_app_setting_get --app=$app --key=path)
|
||||||
db_name=$(ynh_app_setting_get --app="$app" --key=db_name)
|
admin=$(ynh_app_setting_get --app=$app --key=admin)
|
||||||
|
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||||
|
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||||
db_user=$db_name
|
db_user=$db_name
|
||||||
domain=$(ynh_app_setting_get --app="$app" --key=domain)
|
db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd)
|
||||||
db_pwd=$(ynh_app_setting_get --app="$app" --key=psqlpwd)
|
|
||||||
admin=$(ynh_app_setting_get --app="$app" --key=admin)
|
|
||||||
admin_mail=$(ynh_user_get_info "$admin" mail)
|
admin_mail=$(ynh_user_get_info "$admin" mail)
|
||||||
github_account=$(ynh_app_setting_get --app="$app" --key=github_account)
|
github_account=$(ynh_app_setting_get --app=$app --key=github_account)
|
||||||
github_token=$(ynh_app_setting_get --app="$app" --key=github_token)
|
github_token=$(ynh_app_setting_get --app=$app --key=github_token)
|
||||||
key=$(ynh_string_random 50)
|
key=$(ynh_string_random 50)
|
||||||
redis_db=$(ynh_app_setting_get --app="$app" --key=redis_db)
|
redis_db=$(ynh_app_setting_get --app=$app --key=redis_db)
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
||||||
|
@ -36,15 +38,28 @@ ynh_script_progression --message="Backing up the app before upgrading (may take
|
||||||
# Backup the current version of the app
|
# Backup the current version of the app
|
||||||
ynh_backup_before_upgrade
|
ynh_backup_before_upgrade
|
||||||
ynh_clean_setup () {
|
ynh_clean_setup () {
|
||||||
# restore it if the upgrade fails
|
ynh_clean_check_starting
|
||||||
|
# Restore it if the upgrade fails
|
||||||
ynh_restore_upgradebackup
|
ynh_restore_upgradebackup
|
||||||
}
|
}
|
||||||
# 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
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# Migrate legacy permissions to new system
|
# STANDARD UPGRADE STEPS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
# STOP SYSTEMD SERVICE
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Stopping systemd services..." --weight=5
|
||||||
|
|
||||||
|
ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app/weblate.log" --line_match="goodbye to uWSGI"
|
||||||
|
ynh_systemd_action --service_name="$app-celery" --action="stop" --log_path="systemd" --line_match="Stopped"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# ENSURE DOWNWARD COMPATIBILITY
|
||||||
|
#=================================================
|
||||||
|
ynh_script_progression --message="Ensuring downward compatibility..." --weight=1
|
||||||
|
|
||||||
if ynh_legacy_permissions_exists
|
if ynh_legacy_permissions_exists
|
||||||
then
|
then
|
||||||
ynh_legacy_permissions_delete_all
|
ynh_legacy_permissions_delete_all
|
||||||
|
@ -52,11 +67,6 @@ then
|
||||||
ynh_app_setting_delete --app=$app --key=is_public
|
ynh_app_setting_delete --app=$app --key=is_public
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# ENSURE DOWNWARD COMPATIBILITY
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Ensuring downward compatibility..." --weight=1
|
|
||||||
|
|
||||||
if [[ -d "$final_path/bin/" ]]
|
if [[ -d "$final_path/bin/" ]]
|
||||||
then
|
then
|
||||||
ynh_secure_remove --file="$final_path/bin/"
|
ynh_secure_remove --file="$final_path/bin/"
|
||||||
|
@ -65,47 +75,37 @@ fi
|
||||||
# (<3.8) log cleanups
|
# (<3.8) log cleanups
|
||||||
if [[ -e "/var/log/uwsgi/app/$app" ]]
|
if [[ -e "/var/log/uwsgi/app/$app" ]]
|
||||||
then
|
then
|
||||||
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"
|
||||||
ynh_secure_remove --file="/var/log/uwsgi/app/$app"
|
ynh_secure_remove --file="/var/log/uwsgi/app/$app"
|
||||||
ynh_secure_remove --file="/var/log/$app-celery"
|
ynh_secure_remove --file="/var/log/$app-celery"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# STANDARD UPGRADE STEPS
|
# CREATE DEDICATED USER
|
||||||
#=================================================
|
#=================================================
|
||||||
# STOP SYSTEMD SERVICE
|
ynh_script_progression --message="Making sure dedicated system user exists..." --weight=1
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Stopping systemd services..." --weight=5
|
|
||||||
|
|
||||||
ynh_systemd_action --service_name="$app" --action="stop"
|
# Create a dedicated user (if not existing)
|
||||||
ynh_systemd_action --service_name="$app-celery" --action="stop"
|
ynh_system_user_create --username=$app --home_dir="$final_path" --use_shell
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# NGINX CONFIGURATION
|
# NGINX CONFIGURATION
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=3
|
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
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SPECIFIC UPGRADE
|
# UPGRADE DEPENDENCIES
|
||||||
#=================================================
|
|
||||||
# Update dependencies
|
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Upgrading dependencies..." --weight=5
|
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
|
# SPECIFIC UPGRADE
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Making sure dedicated system user exists..." --weight=1
|
|
||||||
|
|
||||||
# Create a system user
|
|
||||||
ynh_system_user_create --username="$app" --home_dir="$final_path" --use_shell
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CONFIGURE HUB
|
# CONFIGURE HUB
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -119,30 +119,20 @@ eval "$(hub alias -s /bin/bash)"
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SPECIFIC SETUP UWSGI
|
# UPDATE A CONFIG FILE
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Configure uwsgi..." --weight=2
|
ynh_script_progression --message="Updating a configuration file..." --weight=2
|
||||||
|
|
||||||
finaluwsgiini="/etc/uwsgi/apps-available/$app.ini"
|
ynh_add_config --template="../conf/uwsgi.ini" --destination="/etc/uwsgi/apps-available/$app.ini"
|
||||||
|
|
||||||
ynh_add_config --template="../conf/uwsgi.ini" --destination="$finaluwsgiini"
|
ynh_add_config --template="../conf/celery-weblate" --destination="$final_path/celery-weblate"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SETUP SYSTEMD
|
# SETUP SYSTEMD
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Configuring a systemd service..." --weight=3
|
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
|
|
||||||
#=================================================
|
|
||||||
ynh_script_progression --message="Configure celery..." --weight=2
|
|
||||||
|
|
||||||
celeryconf="$final_path/celery-weblate"
|
|
||||||
|
|
||||||
ynh_add_config --template="../conf/celery-weblate" --destination="$celeryconf"
|
|
||||||
|
|
||||||
ynh_add_systemd_config --service="$app-celery" --template="celery-weblate.service"
|
ynh_add_systemd_config --service="$app-celery" --template="celery-weblate.service"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -157,10 +147,8 @@ upgrade() {
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Install weblate using PIP..." --weight=15
|
ynh_script_progression --message="Install weblate using PIP..." --weight=15
|
||||||
|
|
||||||
ynh_systemd_action --service_name="$app-celery" --action="stop"
|
|
||||||
|
|
||||||
virtualenv --python=python3 "${final_path}/venv"
|
virtualenv --python=python3 "${final_path}/venv"
|
||||||
chown -R "$app": "$final_path"
|
chown -R $app: "$final_path"
|
||||||
|
|
||||||
#run source in a 'sub shell'
|
#run source in a 'sub shell'
|
||||||
(
|
(
|
||||||
|
@ -190,7 +178,7 @@ upgrade() {
|
||||||
|
|
||||||
ynh_add_config --template="../conf/settings.py" --destination="$settings"
|
ynh_add_config --template="../conf/settings.py" --destination="$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"
|
||||||
|
|
||||||
# Recalculate and store the config file checksum into the app settings
|
# Recalculate and store the config file checksum into the app settings
|
||||||
ynh_store_file_checksum --file="$settings"
|
ynh_store_file_checksum --file="$settings"
|
||||||
|
@ -224,6 +212,8 @@ upgrade() {
|
||||||
sudo --user=$app $final_path/venv/bin/weblate check --deploy || true
|
sudo --user=$app $final_path/venv/bin/weblate check --deploy || true
|
||||||
fi
|
fi
|
||||||
)
|
)
|
||||||
|
|
||||||
|
ynh_systemd_action --service_name="$app-celery" --action="stop"
|
||||||
}
|
}
|
||||||
|
|
||||||
file_version="${final_path}/venv/lib/$weblate_pypath/site-packages/weblate/__init__.py"
|
file_version="${final_path}/venv/lib/$weblate_pypath/site-packages/weblate/__init__.py"
|
||||||
|
@ -248,6 +238,17 @@ fi
|
||||||
|
|
||||||
upgrade $weblate_version "../conf/settings.py"
|
upgrade $weblate_version "../conf/settings.py"
|
||||||
|
|
||||||
|
# Set right permissions for curl installation
|
||||||
|
mkdir -p "$final_path/avatar-cache"
|
||||||
|
chown -R $app: "$final_path"
|
||||||
|
chown "$app:www-data" "$final_path"
|
||||||
|
chown -R "$app:www-data" "$final_path/data"
|
||||||
|
|
||||||
|
chmod 750 "$final_path"
|
||||||
|
chmod -R o-rwx "$final_path"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# GENERIC FINALIZATION
|
||||||
#=================================================
|
#=================================================
|
||||||
# SETUP LOGROTATE
|
# SETUP LOGROTATE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -261,31 +262,16 @@ ynh_use_logrotate --non-append
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Integrating service in YunoHost..." --weight=2
|
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"
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# GENERIC FINALIZATION
|
|
||||||
#=================================================
|
|
||||||
# SECURE FILES AND DIRECTORIES
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
# Set right permissions for curl installation
|
|
||||||
mkdir -p "$final_path/avatar-cache"
|
|
||||||
chown -R "$app": "$final_path"
|
|
||||||
chown "$app:www-data" "$final_path"
|
|
||||||
chown -R "$app:www-data" "$final_path/data"
|
|
||||||
|
|
||||||
chmod 750 "$final_path"
|
|
||||||
chmod -R o-rwx "$final_path"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# START SYSTEMD SERVICES
|
# START SYSTEMD SERVICES
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Starting systemd services..." --weight=5
|
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" --log_path="/var/log/$app/weblate.log" --line_match="spawned uWSGI"
|
||||||
ynh_systemd_action --service_name="$app-celery" --action="start"
|
ynh_systemd_action --service_name="$app-celery" --action="start" --log_path="/var/log/$app/weblate-celery-celery.log" --line_match="mingle: all alone"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RELOAD NGINX
|
# RELOAD NGINX
|
||||||
|
|
Loading…
Reference in a new issue