mirror of
https://github.com/YunoHost-Apps/lemmy_ynh.git
synced 2024-09-03 19:36:09 +02:00
Merge pull request #27 from YunoHost-Apps/ci-auto-update-v0.16.7
Upgrade to version 0.16.7
This commit is contained in:
commit
4520c7e84b
10 changed files with 183 additions and 166 deletions
10
README.md
10
README.md
|
@ -3,14 +3,14 @@ N.B.: This README was automatically generated by https://github.com/YunoHost/app
|
|||
It shall NOT be edited by hand.
|
||||
-->
|
||||
|
||||
# lemmy for YunoHost
|
||||
# Lemmy for YunoHost
|
||||
|
||||
[![Integration level](https://dash.yunohost.org/integration/lemmy.svg)](https://dash.yunohost.org/appci/app/lemmy) ![Working status](https://ci-apps.yunohost.org/ci/badges/lemmy.status.svg) ![Maintenance status](https://ci-apps.yunohost.org/ci/badges/lemmy.maintain.svg)
|
||||
[![Install lemmy with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=lemmy)
|
||||
[![Install Lemmy with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=lemmy)
|
||||
|
||||
*[Lire ce readme en français.](./README_fr.md)*
|
||||
|
||||
> *This package allows you to install lemmy quickly and simply on a YunoHost server.
|
||||
> *This package allows you to install Lemmy quickly and simply on a YunoHost server.
|
||||
If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/install) to learn how to install it.*
|
||||
|
||||
## Overview
|
||||
|
@ -18,14 +18,14 @@ If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/in
|
|||
[Lemmy](https://github.com/LemmyNet/lemmy) is similar to sites like [Reddit](https://reddit.com), [Lobste.rs](https://lobste.rs), or [Hacker News](https://news.ycombinator.com/): you subscribe to forums you're interested in, post links and discussions, then vote, and comment on them. Behind the scenes, it is very different; anyone can easily run a server, and all these servers are federated (think email), and connected to the same universe, called the [Fediverse](https://en.wikipedia.org/wiki/Fediverse).
|
||||
|
||||
|
||||
**Shipped version:** 0.15.2~ynh3
|
||||
**Shipped version:** 0.16.7~ynh1
|
||||
|
||||
|
||||
**Demo:** https://lemmy.ml/
|
||||
|
||||
## Screenshots
|
||||
|
||||
![Screenshot of lemmy](./doc/screenshots/screenshot1.webp)
|
||||
![Screenshot of Lemmy](./doc/screenshots/screenshot1.webp)
|
||||
|
||||
## Disclaimers / important information
|
||||
|
||||
|
|
10
README_fr.md
10
README_fr.md
|
@ -3,14 +3,14 @@ N.B.: This README was automatically generated by https://github.com/YunoHost/app
|
|||
It shall NOT be edited by hand.
|
||||
-->
|
||||
|
||||
# lemmy pour YunoHost
|
||||
# Lemmy pour YunoHost
|
||||
|
||||
[![Niveau d'intégration](https://dash.yunohost.org/integration/lemmy.svg)](https://dash.yunohost.org/appci/app/lemmy) ![Statut du fonctionnement](https://ci-apps.yunohost.org/ci/badges/lemmy.status.svg) ![Statut de maintenance](https://ci-apps.yunohost.org/ci/badges/lemmy.maintain.svg)
|
||||
[![Installer lemmy avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=lemmy)
|
||||
[![Installer Lemmy avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=lemmy)
|
||||
|
||||
*[Read this readme in english.](./README.md)*
|
||||
|
||||
> *Ce package vous permet d'installer lemmy rapidement et simplement sur un serveur YunoHost.
|
||||
> *Ce package vous permet d'installer Lemmy 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
|
||||
|
@ -18,14 +18,14 @@ Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour
|
|||
[Lemmy](https://github.com/LemmyNet/lemmy) is similar to sites like [Reddit](https://reddit.com), [Lobste.rs](https://lobste.rs), or [Hacker News](https://news.ycombinator.com/): you subscribe to forums you're interested in, post links and discussions, then vote, and comment on them. Behind the scenes, it is very different; anyone can easily run a server, and all these servers are federated (think email), and connected to the same universe, called the [Fediverse](https://en.wikipedia.org/wiki/Fediverse).
|
||||
|
||||
|
||||
**Version incluse :** 0.15.2~ynh3
|
||||
**Version incluse :** 0.16.7~ynh1
|
||||
|
||||
|
||||
**Démo :** https://lemmy.ml/
|
||||
|
||||
## Captures d'écran
|
||||
|
||||
![Capture d'écran de lemmy](./doc/screenshots/screenshot1.webp)
|
||||
![Capture d'écran de Lemmy](./doc/screenshots/screenshot1.webp)
|
||||
|
||||
## Avertissements / informations importantes
|
||||
|
||||
|
|
|
@ -12,6 +12,8 @@
|
|||
setup_private=0
|
||||
setup_public=1
|
||||
upgrade=1
|
||||
# 0.15.2~ynh3
|
||||
upgrade=1 from_commit=206df4db0b99c52f07ea1a2d5daf799d4b8357fd
|
||||
backup_restore=1
|
||||
multi_instance=0
|
||||
port_already_use=0
|
||||
|
|
|
@ -36,6 +36,9 @@
|
|||
comment: 6
|
||||
# Interval length for comment limit, in seconds
|
||||
comment_per_second: 600
|
||||
search: 60
|
||||
# Interval length for search limit, in seconds
|
||||
search_per_second: 600
|
||||
}
|
||||
# Settings related to activitypub federation
|
||||
federation: {
|
||||
|
@ -45,12 +48,17 @@
|
|||
# https://join-lemmy.org/docs/en/federation/administration.html///instance-allowlist-and-blocklist
|
||||
#
|
||||
# list of instances with which federation is allowed
|
||||
# allowed_instances: ["instance1.tld","instance2.tld"]
|
||||
# instances which we never federate anything with (but previously federated objects are unaffected)
|
||||
# blocked_instances: []
|
||||
# If true, only federate with instances on the allowlist and block everything else. If false,
|
||||
# use allowlist only for remote communities, and posts/comments in local communities.
|
||||
# strict_allowlist: true
|
||||
#allowed_instances: ["instance1.tld","instance2.tld"]
|
||||
# Instances which we never federate anything with (but previously federated objects are unaffected)
|
||||
#blocked_instances: []
|
||||
# If true, only federate with instances on the allowlist and block everything else. If false
|
||||
# use allowlist only for remote communities, and posts/comments in local communities
|
||||
# (meaning remote communities will show content from arbitrary instances).
|
||||
#strict_allowlist: true
|
||||
# Number of workers for sending outgoing activities. Search logs for Activity queue stats to
|
||||
# see information. If running number is consistently close to the worker_count, you should
|
||||
# increase it.
|
||||
worker_count: 64
|
||||
}
|
||||
captcha: {
|
||||
# Whether captcha is required for signup
|
||||
|
@ -68,8 +76,8 @@
|
|||
smtp_password: ""
|
||||
# Address to send emails from, eg noreply@your-instance.com
|
||||
smtp_from_address: "lemmy@__DOMAIN__"
|
||||
# Whether or not smtp connections should use tls
|
||||
use_tls: true
|
||||
# Whether or not smtp connections should use tls. Can be none, tls, or starttls
|
||||
tls_type: "none"
|
||||
}
|
||||
# Parameters for automatic configuration of new instance (only used at first start)
|
||||
setup: {
|
||||
|
|
|
@ -1,20 +1,19 @@
|
|||
#limit_req_zone $binary_remote_addr zone=lemmy_ratelimit:10m rate=1r/s;
|
||||
|
||||
# Only connect to this site via HTTPS for the two years
|
||||
more_set_headers "Strict-Transport-Security: max-age=63072000";
|
||||
|
||||
# Only connect to this site via HTTPS for the two years
|
||||
more_set_headers "Strict-Transport-Security: max-age=63072000";
|
||||
# Various content security headers
|
||||
more_set_headers "Referrer-Policy: same-origin";
|
||||
more_set_headers "X-Content-Type-Options: nosniff";
|
||||
more_set_headers "X-Frame-Options: DENY";
|
||||
more_set_headers "X-XSS-Protection: 1; mode=block";
|
||||
|
||||
# Various content security headers
|
||||
more_set_headers "Referrer-Policy: same-origin";
|
||||
more_set_headers "X-Content-Type-Options: nosniff";
|
||||
more_set_headers "X-Frame-Options: DENY";
|
||||
more_set_headers "X-XSS-Protection: 1; mode=block";
|
||||
# Upload limit for pictrs
|
||||
client_max_body_size 20M;
|
||||
|
||||
# Upload limit for pictrs
|
||||
client_max_body_size 20M;
|
||||
|
||||
# frontend
|
||||
location / {
|
||||
# frontend
|
||||
location / {
|
||||
# The default ports:
|
||||
# lemmy_ui_port: 1235
|
||||
# lemmy_port: 8536
|
||||
|
@ -34,10 +33,10 @@
|
|||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
}
|
||||
}
|
||||
|
||||
# backend
|
||||
location ~ ^/(api|pictrs|feeds|nodeinfo|.well-known) {
|
||||
# backend
|
||||
location ~ ^/(api|pictrs|feeds|nodeinfo|.well-known) {
|
||||
proxy_pass http://127.0.0.1:__PORT_LEMMY__;
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Upgrade $http_upgrade;
|
||||
|
@ -50,14 +49,12 @@
|
|||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
# Redirect pictshare images to pictrs
|
||||
location ~ /pictshare/(.*)$ {
|
||||
# Redirect pictshare images to pictrs
|
||||
location ~ /pictshare/(.*)$ {
|
||||
return 301 /pictrs/image/$1;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
# Anonymize IP addresses
|
||||
# https://www.supertechcrew.com/anonymizing-logs-nginx-apache/
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
{
|
||||
"name": "lemmy",
|
||||
"name": "Lemmy",
|
||||
"id": "lemmy",
|
||||
"packaging_format": 1,
|
||||
"description": {
|
||||
"en": "Link aggregator/Reddit clone for the fediverse",
|
||||
"fr": "Agrégateur de liens/clone Reddit pour le fedivers"
|
||||
},
|
||||
"version": "0.15.2~ynh3",
|
||||
"version": "0.16.7~ynh1",
|
||||
"url": "https://join.lemmy.ml/",
|
||||
"upstream": {
|
||||
"license": "GPL-3.0",
|
||||
|
@ -17,9 +17,8 @@
|
|||
},
|
||||
"license": "GPL-3.0",
|
||||
"maintainer": {
|
||||
"name": "Anmol Sharma",
|
||||
"email": "",
|
||||
"url": ""
|
||||
"name": "",
|
||||
"email": ""
|
||||
},
|
||||
"requirements": {
|
||||
"yunohost": ">= 4.3.0"
|
||||
|
@ -29,7 +28,7 @@
|
|||
"nginx"
|
||||
],
|
||||
"arguments": {
|
||||
"install" : [
|
||||
"install": [
|
||||
{
|
||||
"name": "domain",
|
||||
"type": "domain"
|
||||
|
|
|
@ -14,7 +14,7 @@ source /usr/share/yunohost/helpers
|
|||
#=================================================
|
||||
|
||||
ynh_clean_setup () {
|
||||
ynh_clean_check_starting
|
||||
true
|
||||
}
|
||||
# Exit if an error occurs during the execution of the script
|
||||
ynh_abort_if_errors
|
||||
|
@ -26,16 +26,17 @@ ynh_abort_if_errors
|
|||
domain=$YNH_APP_ARG_DOMAIN
|
||||
path_url="/"
|
||||
admin=$YNH_APP_ARG_ADMIN
|
||||
password=$(ynh_string_random --length=12)
|
||||
sitename=$YNH_APP_ARG_SITENAME
|
||||
admin_email=$(ynh_user_get_info --username=$admin --key="mail")
|
||||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
password=$(ynh_string_random --length=12)
|
||||
admin_email=$(ynh_user_get_info --username=$admin --key="mail")
|
||||
|
||||
#=================================================
|
||||
# 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
|
||||
test ! -e "$final_path" || ynh_die --message="This path already contains a folder"
|
||||
|
@ -46,7 +47,7 @@ ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url
|
|||
#=================================================
|
||||
# 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=path --value=$path_url
|
||||
|
@ -59,7 +60,7 @@ ynh_app_setting_set --app=$app --key=sitename --value=$sitename
|
|||
#=================================================
|
||||
# FIND AND OPEN A PORT
|
||||
#=================================================
|
||||
ynh_script_progression --message="Finding an available port..."
|
||||
ynh_script_progression --message="Finding an available port..." --weight=1
|
||||
|
||||
# Find an available port
|
||||
port_lemmy=$(ynh_find_port --port=8536)
|
||||
|
@ -72,7 +73,7 @@ ynh_app_setting_set --app=$app --key=port_pictrs --value=$port_pictrs
|
|||
#=================================================
|
||||
# INSTALL DEPENDENCIES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Installing dependencies..."
|
||||
ynh_script_progression --message="Installing dependencies..." --weight=1
|
||||
|
||||
ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies $pkg_build_dependencies
|
||||
ynh_install_nodejs --nodejs_version=$NODEJS_VERSION
|
||||
|
@ -82,15 +83,15 @@ ln -fs /usr/lib/x86_64-linux-musl/libc.so /lib/libc.musl-x86_64.so.1
|
|||
#=================================================
|
||||
# CREATE DEDICATED USER
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring system user..."
|
||||
ynh_script_progression --message="Configuring system user..." --weight=1
|
||||
|
||||
# Create a system user
|
||||
ynh_system_user_create --username=$app --home_dir=$final_path
|
||||
ynh_system_user_create --username=$app --home_dir="$final_path"
|
||||
|
||||
#=================================================
|
||||
# CREATE A POSTGRESQL DATABASE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Creating a PostgreSQL database..."
|
||||
ynh_script_progression --message="Creating a PostgreSQL database..." --weight=1
|
||||
|
||||
ynh_psql_test_if_first_run
|
||||
db_name=$(ynh_sanitize_dbid --db_name=$app)
|
||||
|
@ -104,7 +105,7 @@ ynh_psql_execute_as_root --sql="CREATE EXTENSION IF NOT EXISTS pgcrypto;" --data
|
|||
#=================================================
|
||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Setting up source files..."
|
||||
ynh_script_progression --message="Setting up source files..." --weight=1
|
||||
|
||||
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
|
||||
# Download, check integrity, uncompress and patch the source from app.src
|
||||
|
@ -120,7 +121,7 @@ chown -R $app:$app "$final_path"
|
|||
#=================================================
|
||||
# NGINX CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring NGINX web server..."
|
||||
ynh_script_progression --message="Configuring NGINX web server..." --weight=1
|
||||
|
||||
# Create a dedicated NGINX config
|
||||
ynh_add_nginx_config
|
||||
|
@ -130,7 +131,7 @@ ynh_add_nginx_config
|
|||
#=================================================
|
||||
# CREATE DATA DIRECTORY
|
||||
#=================================================
|
||||
ynh_script_progression --message="Creating a data directory..."
|
||||
ynh_script_progression --message="Creating a data directory..." --weight=1
|
||||
|
||||
datadir=/home/yunohost.app/$app
|
||||
ynh_app_setting_set --app=$app --key=datadir --value=$datadir
|
||||
|
@ -144,7 +145,7 @@ chown -R $app:$app "$datadir"
|
|||
#=================================================
|
||||
# MAKE INSTALL
|
||||
#=================================================
|
||||
ynh_script_progression --message="Making install..."
|
||||
ynh_script_progression --message="Making install..." --weight=1
|
||||
|
||||
# Install lemmy-ui
|
||||
pushd $final_path/build-lemmy-ui
|
||||
|
@ -182,7 +183,7 @@ chown -R $app:$app "$final_path"
|
|||
#=================================================
|
||||
# ADD A CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Adding a configuration file..."
|
||||
ynh_script_progression --message="Adding a configuration file..." --weight=1
|
||||
|
||||
mkdir -p "$final_path/config/"
|
||||
ynh_add_config --template="../conf/lemmy.hjson" --destination="$final_path/config/config.hjson"
|
||||
|
@ -193,7 +194,7 @@ chown $app:$app "$final_path/config/config.hjson"
|
|||
#=================================================
|
||||
# SETUP SYSTEMD
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring a systemd service..."
|
||||
ynh_script_progression --message="Configuring a systemd service..." --weight=1
|
||||
|
||||
# Create a dedicated systemd config
|
||||
ynh_add_systemd_config --service="$app" --template="lemmy.service"
|
||||
|
@ -204,7 +205,7 @@ ynh_add_systemd_config --service="$app-ui" --template="lemmy-ui.service"
|
|||
#=================================================
|
||||
# SETUP LOGROTATE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring log rotation..."
|
||||
ynh_script_progression --message="Configuring log rotation..." --weight=1
|
||||
|
||||
mkdir -p "/var/log/$app"
|
||||
chmod 750 "/var/log/$app"
|
||||
|
@ -217,7 +218,7 @@ ynh_use_logrotate
|
|||
#=================================================
|
||||
# INTEGRATE SERVICE IN YUNOHOST
|
||||
#=================================================
|
||||
ynh_script_progression --message="Integrating service in YunoHost..."
|
||||
ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
|
||||
|
||||
yunohost service add $app --log="/var/log/$app/$app.log"
|
||||
yunohost service add $app-ui --log="/var/log/$app/$app-ui.log"
|
||||
|
@ -225,7 +226,7 @@ yunohost service add $app-ui --log="/var/log/$app/$app-ui.log"
|
|||
#=================================================
|
||||
# START SYSTEMD SERVICE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Starting a systemd service..."
|
||||
ynh_script_progression --message="Starting a systemd service..." --weight=1
|
||||
|
||||
# Start a systemd service
|
||||
ynh_systemd_action --service_name=$app --action="start" --line_match="Started" --log_path=systemd
|
||||
|
@ -234,7 +235,7 @@ ynh_systemd_action --service_name=$app-ui --action="start" --line_match="Started
|
|||
#=================================================
|
||||
# SETUP SSOWAT
|
||||
#=================================================
|
||||
ynh_script_progression --message="Configuring permissions..."
|
||||
ynh_script_progression --message="Configuring permissions..." --weight=1
|
||||
|
||||
# Make app public
|
||||
ynh_permission_update --permission="main" --add="visitors"
|
||||
|
@ -242,7 +243,7 @@ ynh_permission_update --permission="main" --add="visitors"
|
|||
#=================================================
|
||||
# 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
|
||||
|
||||
|
@ -267,4 +268,4 @@ ynh_send_readme_to_admin "$message"
|
|||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Installation of $app completed"
|
||||
ynh_script_progression --message="Installation of $app completed" --last
|
||||
|
|
|
@ -12,7 +12,7 @@ source /usr/share/yunohost/helpers
|
|||
#=================================================
|
||||
# LOAD SETTINGS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Loading installation settings..."
|
||||
ynh_script_progression --message="Loading installation settings..." --weight=1
|
||||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
|
@ -20,6 +20,7 @@ domain=$(ynh_app_setting_get --app=$app --key=domain)
|
|||
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
|
||||
db_user=$db_name
|
||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||
datadir=$(ynh_app_setting_get --app=$app --key=datadir)
|
||||
|
||||
#=================================================
|
||||
# STANDARD REMOVE
|
||||
|
@ -30,7 +31,7 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
|||
# Remove the service from the list of services known by YunoHost (added from `yunohost service add`)
|
||||
if ynh_exec_warn_less yunohost service status $app >/dev/null
|
||||
then
|
||||
ynh_script_progression --message="Removing $app service integration..."
|
||||
ynh_script_progression --message="Removing $app service integration..." --weight=1
|
||||
yunohost service remove $app
|
||||
fi
|
||||
if ynh_exec_warn_less yunohost service status $app-ui >/dev/null
|
||||
|
@ -42,7 +43,7 @@ fi
|
|||
#=================================================
|
||||
# STOP AND REMOVE SERVICE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Stopping and removing the systemd service..."
|
||||
ynh_script_progression --message="Stopping and removing the systemd service..." --weight=1
|
||||
|
||||
# Remove the dedicated systemd config
|
||||
ynh_remove_systemd_config
|
||||
|
@ -51,7 +52,7 @@ ynh_remove_systemd_config --service=$app-ui
|
|||
#=================================================
|
||||
# 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
|
||||
ynh_remove_logrotate
|
||||
|
@ -59,7 +60,7 @@ ynh_remove_logrotate
|
|||
#=================================================
|
||||
# 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
|
||||
ynh_psql_remove_db --db_user=$db_user --db_name=$db_name
|
||||
|
@ -67,7 +68,7 @@ ynh_psql_remove_db --db_user=$db_user --db_name=$db_name
|
|||
#=================================================
|
||||
# REMOVE IMAGEMAGICK
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing ImageMagick..."
|
||||
ynh_script_progression --message="Removing ImageMagick..." --weight=1
|
||||
|
||||
ynh_setup_source --dest_dir="$final_path/build-imagemagick/" --source_id="imagemagick"
|
||||
|
||||
|
@ -82,15 +83,26 @@ ynh_secure_remove --file="$final_path/build-imagemagick"
|
|||
#=================================================
|
||||
# REMOVE APP MAIN DIR
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing app main directory..."
|
||||
ynh_script_progression --message="Removing app main directory..." --weight=1
|
||||
|
||||
# Remove the app directory securely
|
||||
ynh_secure_remove --file="$final_path"
|
||||
|
||||
#=================================================
|
||||
# REMOVE DATA DIR
|
||||
#=================================================
|
||||
|
||||
# Remove the data directory if --purge option is used
|
||||
if [ "${YNH_APP_PURGE:-0}" -eq 1 ]
|
||||
then
|
||||
ynh_script_progression --message="Removing app data directory..." --weight=1
|
||||
ynh_secure_remove --file="$datadir"
|
||||
fi
|
||||
|
||||
#=================================================
|
||||
# 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
|
||||
ynh_remove_nginx_config
|
||||
|
@ -98,7 +110,7 @@ ynh_remove_nginx_config
|
|||
#=================================================
|
||||
# REMOVE DEPENDENCIES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing dependencies..."
|
||||
ynh_script_progression --message="Removing dependencies..." --weight=1
|
||||
|
||||
# Remove metapackage and its dependencies
|
||||
ynh_remove_nodejs
|
||||
|
@ -110,7 +122,7 @@ ynh_secure_remove --file="/lib/libc.musl-x86_64.so.1"
|
|||
#=================================================
|
||||
# REMOVE VARIOUS FILES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Removing various files..."
|
||||
ynh_script_progression --message="Removing various files..." --weight=1
|
||||
|
||||
# Remove the log files
|
||||
ynh_secure_remove --file="/var/log/$app"
|
||||
|
@ -120,7 +132,7 @@ ynh_secure_remove --file="/var/log/$app"
|
|||
#=================================================
|
||||
# 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
|
||||
ynh_system_user_delete --username=$app
|
||||
|
@ -129,4 +141,4 @@ ynh_system_user_delete --username=$app
|
|||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Removal of $app completed"
|
||||
ynh_script_progression --message="Removal of $app completed" --last
|
||||
|
|
|
@ -15,7 +15,7 @@ source /usr/share/yunohost/helpers
|
|||
#=================================================
|
||||
|
||||
ynh_clean_setup () {
|
||||
ynh_clean_check_starting
|
||||
true
|
||||
}
|
||||
# Exit if an error occurs during the execution of the script
|
||||
ynh_abort_if_errors
|
||||
|
@ -23,7 +23,7 @@ ynh_abort_if_errors
|
|||
#=================================================
|
||||
# LOAD SETTINGS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Loading installation settings..."
|
||||
ynh_script_progression --message="Loading installation settings..." --weight=1
|
||||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
|
@ -38,32 +38,25 @@ datadir=$(ynh_app_setting_get --app=$app --key=datadir)
|
|||
#=================================================
|
||||
# CHECK IF THE APP CAN BE RESTORED
|
||||
#=================================================
|
||||
ynh_script_progression --message="Validating restoration parameters..."
|
||||
ynh_script_progression --message="Validating restoration parameters..." --weight=1
|
||||
|
||||
test ! -d $final_path \
|
||||
|| ynh_die --message="There is already a directory: $final_path "
|
||||
|
||||
#=================================================
|
||||
# STANDARD RESTORATION STEPS
|
||||
#=================================================
|
||||
# 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"
|
||||
|
||||
#=================================================
|
||||
# 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)
|
||||
ynh_system_user_create --username=$app --home_dir=$final_path
|
||||
ynh_system_user_create --username=$app --home_dir="$final_path"
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE APP MAIN DIR
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring the app main directory..."
|
||||
ynh_script_progression --message="Restoring the app main directory..." --weight=1
|
||||
|
||||
ynh_restore_file --origin_path="$final_path"
|
||||
|
||||
|
@ -74,7 +67,7 @@ chown -R $app:$app "$final_path"
|
|||
#=================================================
|
||||
# RESTORE THE DATA DIRECTORY
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring the data directory..."
|
||||
ynh_script_progression --message="Restoring the data directory..." --weight=1
|
||||
|
||||
ynh_restore_file --origin_path="$datadir" --not_mandatory
|
||||
|
||||
|
@ -89,7 +82,7 @@ chown -R $app:$app "$datadir"
|
|||
#=================================================
|
||||
# REINSTALL DEPENDENCIES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Reinstalling dependencies..."
|
||||
ynh_script_progression --message="Reinstalling dependencies..." --weight=1
|
||||
|
||||
# Define and install dependencies
|
||||
ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies
|
||||
|
@ -97,10 +90,27 @@ ynh_install_nodejs --nodejs_version=$NODEJS_VERSION
|
|||
ynh_use_nodejs
|
||||
ln -fs /usr/lib/x86_64-linux-musl/libc.so /lib/libc.musl-x86_64.so.1
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE NGINX CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring the NGINX web server configuration..." --weight=1
|
||||
|
||||
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE POSTGRESQL DATABASE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring the PostgreSQL database..." --weight=1
|
||||
|
||||
ynh_psql_test_if_first_run
|
||||
ynh_psql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd
|
||||
ynh_psql_execute_file_as_root --file="./db.sql" --database="$db_name"
|
||||
ynh_psql_execute_as_root --sql="CREATE EXTENSION IF NOT EXISTS pgcrypto;" --database="$db_name"
|
||||
|
||||
#=================================================
|
||||
# BUILDING IMAGEMAGICK
|
||||
#=================================================
|
||||
ynh_script_progression --message="Building ImageMagick..."
|
||||
ynh_script_progression --message="Building ImageMagick..." --weight=1
|
||||
|
||||
ynh_setup_source --dest_dir="$final_path/build-imagemagick/" --source_id="imagemagick"
|
||||
|
||||
|
@ -118,20 +128,10 @@ ynh_secure_remove --file="$final_path/build-imagemagick"
|
|||
ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies
|
||||
ynh_package_autoremove
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE POSTGRESQL DATABASE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring the PostgreSQL database..."
|
||||
|
||||
ynh_psql_test_if_first_run
|
||||
ynh_psql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd
|
||||
ynh_psql_execute_file_as_root --file="./db.sql" --database="$db_name"
|
||||
ynh_psql_execute_as_root --sql="CREATE EXTENSION IF NOT EXISTS pgcrypto;" --database="$db_name"
|
||||
|
||||
#=================================================
|
||||
# RESTORE SYSTEMD
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring the systemd configuration..."
|
||||
ynh_script_progression --message="Restoring the systemd configuration..." --weight=1
|
||||
|
||||
ynh_restore_file --origin_path="/etc/systemd/system/$app.service"
|
||||
systemctl enable $app.service --quiet
|
||||
|
@ -141,7 +141,7 @@ systemctl enable $app-ui.service --quiet
|
|||
#=================================================
|
||||
# RESTORE THE LOGROTATE CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring the logrotate configuration..."
|
||||
ynh_script_progression --message="Restoring the logrotate configuration..." --weight=1
|
||||
|
||||
mkdir -p "/var/log/$app"
|
||||
chmod 750 "/var/log/$app"
|
||||
|
@ -153,7 +153,7 @@ ynh_restore_file --origin_path="/etc/logrotate.d/$app"
|
|||
#=================================================
|
||||
# INTEGRATE SERVICE IN YUNOHOST
|
||||
#=================================================
|
||||
ynh_script_progression --message="Integrating service in YunoHost..."
|
||||
ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
|
||||
|
||||
yunohost service add $app --log="/var/log/$app/$app.log"
|
||||
yunohost service add $app-ui --log="/var/log/$app/$app-ui.log"
|
||||
|
@ -161,7 +161,7 @@ yunohost service add $app-ui --log="/var/log/$app/$app-ui.log"
|
|||
#=================================================
|
||||
# START SYSTEMD SERVICE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Starting a systemd service..."
|
||||
ynh_script_progression --message="Starting a systemd service..." --weight=1
|
||||
|
||||
ynh_systemd_action --service_name=$app --action="start" --line_match="Started" --log_path=systemd
|
||||
ynh_systemd_action --service_name=$app-ui --action="start" --line_match="Started" --log_path=systemd
|
||||
|
@ -171,7 +171,7 @@ ynh_systemd_action --service_name=$app-ui --action="start" --line_match="Started
|
|||
#=================================================
|
||||
# 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
|
||||
|
||||
|
@ -179,4 +179,4 @@ ynh_systemd_action --service_name=nginx --action=reload
|
|||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Restoration completed for $app"
|
||||
ynh_script_progression --message="Restoration completed for $app" --last
|
||||
|
|
|
@ -12,7 +12,7 @@ source /usr/share/yunohost/helpers
|
|||
#=================================================
|
||||
# LOAD SETTINGS
|
||||
#=================================================
|
||||
ynh_script_progression --message="Loading installation settings..."
|
||||
ynh_script_progression --message="Loading installation settings..." --weight=1
|
||||
|
||||
app=$YNH_APP_INSTANCE_NAME
|
||||
|
||||
|
@ -34,19 +34,18 @@ admin_email=$(ynh_user_get_info --username=$admin --key="mail")
|
|||
#=================================================
|
||||
# CHECK VERSION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Checking version..."
|
||||
ynh_script_progression --message="Checking version..." --weight=1
|
||||
|
||||
upgrade_type=$(ynh_check_app_version_changed)
|
||||
|
||||
#=================================================
|
||||
# BACKUP BEFORE UPGRADE THEN ACTIVE TRAP
|
||||
#=================================================
|
||||
ynh_script_progression --message="Backing up the app before upgrading (may take a while)..."
|
||||
ynh_script_progression --message="Backing up the app before upgrading (may take a while)..." --weight=1
|
||||
|
||||
# Backup the current version of the app
|
||||
ynh_backup_before_upgrade
|
||||
ynh_clean_setup () {
|
||||
ynh_clean_check_starting
|
||||
# Restore it if the upgrade fails
|
||||
ynh_restore_upgradebackup
|
||||
}
|
||||
|
@ -58,7 +57,7 @@ ynh_abort_if_errors
|
|||
#=================================================
|
||||
# STOP SYSTEMD SERVICE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Stopping a systemd service..."
|
||||
ynh_script_progression --message="Stopping a systemd service..." --weight=1
|
||||
|
||||
ynh_systemd_action --service_name=$app --action="stop" --line_match="Stopped" --log_path=systemd
|
||||
ynh_systemd_action --service_name=$app-ui --action="stop" --line_match="Stopped" --log_path=systemd
|
||||
|
@ -66,7 +65,7 @@ ynh_systemd_action --service_name=$app-ui --action="stop" --line_match="Stopped"
|
|||
#=================================================
|
||||
# ENSURE DOWNWARD COMPATIBILITY
|
||||
#=================================================
|
||||
ynh_script_progression --message="Ensuring downward compatibility..."
|
||||
ynh_script_progression --message="Ensuring downward compatibility..." --weight=1
|
||||
|
||||
# Cleaning legacy permissions
|
||||
if ynh_legacy_permissions_exists; then
|
||||
|
@ -97,10 +96,10 @@ ynh_secure_remove --file="$final_path/pict-rs"
|
|||
#=================================================
|
||||
# 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 dedicated user (if not existing)
|
||||
ynh_system_user_create --username=$app --home_dir=$final_path
|
||||
ynh_system_user_create --username=$app --home_dir="$final_path"
|
||||
|
||||
#=================================================
|
||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||
|
@ -108,7 +107,7 @@ ynh_system_user_create --username=$app --home_dir=$final_path
|
|||
|
||||
if [ "$upgrade_type" == "UPGRADE_APP" ]
|
||||
then
|
||||
ynh_script_progression --message="Upgrading source files..."
|
||||
ynh_script_progression --message="Upgrading source files..." --weight=1
|
||||
|
||||
# Download, check integrity, uncompress the source of lemmy from app.src to his build directory
|
||||
ynh_setup_source --dest_dir="$final_path/build-lemmy/" --source_id="docker-image-extract"
|
||||
|
@ -121,30 +120,30 @@ chmod 750 "$final_path"
|
|||
chmod -R o-rwx "$final_path"
|
||||
chown -R $app:$app "$final_path"
|
||||
|
||||
#=================================================
|
||||
# NGINX CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Upgrading NGINX web server configuration..."
|
||||
|
||||
# Create a dedicated NGINX config
|
||||
ynh_add_nginx_config
|
||||
|
||||
#=================================================
|
||||
# UPGRADE DEPENDENCIES
|
||||
#=================================================
|
||||
ynh_script_progression --message="Upgrading dependencies..."
|
||||
ynh_script_progression --message="Upgrading dependencies..." --weight=1
|
||||
|
||||
ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies
|
||||
ynh_install_nodejs --nodejs_version=$NODEJS_VERSION
|
||||
ynh_use_nodejs
|
||||
ln -fs /usr/lib/x86_64-linux-musl/libc.so /lib/libc.musl-x86_64.so.1
|
||||
|
||||
#=================================================
|
||||
# NGINX CONFIGURATION
|
||||
#=================================================
|
||||
ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=1
|
||||
|
||||
# Create a dedicated NGINX config
|
||||
ynh_add_nginx_config
|
||||
|
||||
#=================================================
|
||||
# SPECIFIC UPGRADE
|
||||
#=================================================
|
||||
# MAKE UPGRADE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Making upgrade..."
|
||||
ynh_script_progression --message="Making upgrade..." --weight=1
|
||||
|
||||
if [ "$upgrade_type" == "UPGRADE_APP" ]
|
||||
then
|
||||
|
@ -187,7 +186,7 @@ chown -R $app:$app "$final_path"
|
|||
#=================================================
|
||||
# UPDATE A CONFIG FILE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Updating a configuration file..."
|
||||
ynh_script_progression --message="Updating a configuration file..." --weight=1
|
||||
|
||||
mkdir -p "$final_path/lemmy/"
|
||||
ynh_add_config --template="../conf/lemmy.hjson" --destination="$final_path/config/config.hjson"
|
||||
|
@ -198,14 +197,14 @@ chown $app:$app "$final_path/config/config.hjson"
|
|||
#=================================================
|
||||
# CREATE EXTENSION IF NOT EXISTS pgcrypto
|
||||
#=================================================
|
||||
ynh_script_progression --message="Creating pgcrypto extension if needed..."
|
||||
ynh_script_progression --message="Creating pgcrypto extension if needed..." --weight=1
|
||||
|
||||
ynh_psql_execute_as_root --sql="CREATE EXTENSION IF NOT EXISTS pgcrypto;" --database="$db_name"
|
||||
|
||||
#=================================================
|
||||
# SETUP SYSTEMD
|
||||
#=================================================
|
||||
ynh_script_progression --message="Upgrading systemd configuration..."
|
||||
ynh_script_progression --message="Upgrading systemd configuration..." --weight=1
|
||||
|
||||
# Create a dedicated systemd config
|
||||
ynh_add_systemd_config --service="$app" --template="lemmy.service"
|
||||
|
@ -216,8 +215,7 @@ ynh_add_systemd_config --service="$app-ui" --template="lemmy-ui.service"
|
|||
#=================================================
|
||||
# SETUP LOGROTATE
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Upgrading logrotate configuration..."
|
||||
ynh_script_progression --message="Upgrading logrotate configuration..." --weight=1
|
||||
|
||||
mkdir -p "/var/log/$app"
|
||||
chmod 750 "/var/log/$app"
|
||||
|
@ -230,7 +228,7 @@ ynh_use_logrotate --non-append
|
|||
#=================================================
|
||||
# INTEGRATE SERVICE IN YUNOHOST
|
||||
#=================================================
|
||||
ynh_script_progression --message="Integrating service in YunoHost..."
|
||||
ynh_script_progression --message="Integrating service in YunoHost..." --weight=1
|
||||
|
||||
yunohost service add $app --log="/var/log/$app/$app.log"
|
||||
yunohost service add $app-ui --log="/var/log/$app/$app-ui.log"
|
||||
|
@ -238,7 +236,7 @@ yunohost service add $app-ui --log="/var/log/$app/$app-ui.log"
|
|||
#=================================================
|
||||
# START SYSTEMD SERVICE
|
||||
#=================================================
|
||||
ynh_script_progression --message="Starting a systemd service..."
|
||||
ynh_script_progression --message="Starting a systemd service..." --weight=1
|
||||
|
||||
ynh_systemd_action --service_name=$app --action="start" --line_match="Started" --log_path=systemd
|
||||
ynh_systemd_action --service_name=$app-ui --action="start" --line_match="Started" --log_path=systemd
|
||||
|
@ -246,7 +244,7 @@ ynh_systemd_action --service_name=$app-ui --action="start" --line_match="Started
|
|||
#=================================================
|
||||
# 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
|
||||
|
||||
|
@ -254,4 +252,4 @@ ynh_systemd_action --service_name=nginx --action=reload
|
|||
# END OF SCRIPT
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Upgrade of $app completed"
|
||||
ynh_script_progression --message="Upgrade of $app completed" --last
|
||||
|
|
Loading…
Reference in a new issue