1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/soapbox_ynh.git synced 2024-09-03 20:26:11 +02:00

Merge pull request #5 from YunoHost-Apps/3.0.0

3.0.0
This commit is contained in:
Éric Gaspar 2023-01-10 21:23:52 +01:00 committed by GitHub
commit 9b438b63e9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 196 additions and 79 deletions

14
README.md Executable file → Normal file
View file

@ -3,32 +3,32 @@ N.B.: This README was automatically generated by https://github.com/YunoHost/app
It shall NOT be edited by hand. It shall NOT be edited by hand.
--> -->
# SoapboxFE for YunoHost # Soapbox for YunoHost
[![Integration level](https://dash.yunohost.org/integration/soapbox.svg)](https://dash.yunohost.org/appci/app/soapbox) ![Working status](https://ci-apps.yunohost.org/ci/badges/soapbox.status.svg) ![Maintenance status](https://ci-apps.yunohost.org/ci/badges/soapbox.maintain.svg) [![Integration level](https://dash.yunohost.org/integration/soapbox.svg)](https://dash.yunohost.org/appci/app/soapbox) ![Working status](https://ci-apps.yunohost.org/ci/badges/soapbox.status.svg) ![Maintenance status](https://ci-apps.yunohost.org/ci/badges/soapbox.maintain.svg)
[![Install SoapboxFE with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=soapbox) [![Install Soapbox with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=soapbox)
*[Lire ce readme en français.](./README_fr.md)* *[Lire ce readme en français.](./README_fr.md)*
> *This package allows you to install SoapboxFE quickly and simply on a YunoHost server. > *This package allows you to install Soapbox quickly and simply on a YunoHost server.
If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/install) to learn how to install it.* If you don't have YunoHost, please consult [the guide](https://yunohost.org/#/install) to learn how to install it.*
## Overview ## Overview
SoapboxFE is an alternative frontend for Pleroma. Soapbox is customizable open-source software that puts the power of social media in the hands of the people. Feature-rich and hyper-focused on providing a user experience to rival Big Tech, Soapbox is already home to some of the biggest alternative social platforms.
**Shipped version:** 1.3.0~ynh1 **Shipped version:** 3.0.0~ynh1
## Screenshots ## Screenshots
![Screenshot of SoapboxFE](./doc/screenshots/screenshot.jpg) ![Screenshot of Soapbox](./doc/screenshots/screenshot.jpg)
## Disclaimers / important information ## Disclaimers / important information
### Important points to read before installing ### Important points to read before installing
- [Pleroma (Yunohost ver.)](https://github.com/YunoHost-Apps/pleroma_ynh) must be installed locally before you install SoapboxFE - [Pleroma (YunoHost ver.)](https://github.com/YunoHost-Apps/pleroma_ynh) must be installed locally before you install SoapboxFE
- SoapboxFE must be installed under a Pleroma domain (i.e soapboxfe.your-pleroma-instance-domain.net) - SoapboxFE must be installed under a Pleroma domain (i.e soapboxfe.your-pleroma-instance-domain.net)
- AdminFE under SoapboxFE returns 404 - AdminFE under SoapboxFE returns 404

14
README_fr.md Executable file → Normal file
View file

@ -3,32 +3,32 @@ N.B.: This README was automatically generated by https://github.com/YunoHost/app
It shall NOT be edited by hand. It shall NOT be edited by hand.
--> -->
# SoapboxFE pour YunoHost # Soapbox pour YunoHost
[![Niveau d'intégration](https://dash.yunohost.org/integration/soapbox.svg)](https://dash.yunohost.org/appci/app/soapbox) ![Statut du fonctionnement](https://ci-apps.yunohost.org/ci/badges/soapbox.status.svg) ![Statut de maintenance](https://ci-apps.yunohost.org/ci/badges/soapbox.maintain.svg) [![Niveau d'intégration](https://dash.yunohost.org/integration/soapbox.svg)](https://dash.yunohost.org/appci/app/soapbox) ![Statut du fonctionnement](https://ci-apps.yunohost.org/ci/badges/soapbox.status.svg) ![Statut de maintenance](https://ci-apps.yunohost.org/ci/badges/soapbox.maintain.svg)
[![Installer SoapboxFE avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=soapbox) [![Installer Soapbox avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=soapbox)
*[Read this readme in english.](./README.md)* *[Read this readme in english.](./README.md)*
> *Ce package vous permet d'installer SoapboxFE rapidement et simplement sur un serveur YunoHost. > *Ce package vous permet d'installer Soapbox rapidement et simplement sur un serveur YunoHost.
Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour savoir comment l'installer et en profiter.* Si vous n'avez pas YunoHost, regardez [ici](https://yunohost.org/#/install) pour savoir comment l'installer et en profiter.*
## Vue d'ensemble ## Vue d'ensemble
SoapboxFE is an alternative frontend for Pleroma. Soapbox is customizable open-source software that puts the power of social media in the hands of the people. Feature-rich and hyper-focused on providing a user experience to rival Big Tech, Soapbox is already home to some of the biggest alternative social platforms.
**Version incluse :** 1.3.0~ynh1 **Version incluse :** 3.0.0~ynh1
## Captures d'écran ## Captures d'écran
![Capture d'écran de SoapboxFE](./doc/screenshots/screenshot.jpg) ![Capture d'écran de Soapbox](./doc/screenshots/screenshot.jpg)
## Avertissements / informations importantes ## Avertissements / informations importantes
### Important points to read before installing ### Important points to read before installing
- [Pleroma (Yunohost ver.)](https://github.com/YunoHost-Apps/pleroma_ynh) must be installed locally before you install SoapboxFE - [Pleroma (YunoHost ver.)](https://github.com/YunoHost-Apps/pleroma_ynh) must be installed locally before you install SoapboxFE
- SoapboxFE must be installed under a Pleroma domain (i.e soapboxfe.your-pleroma-instance-domain.net) - SoapboxFE must be installed under a Pleroma domain (i.e soapboxfe.your-pleroma-instance-domain.net)
- AdminFE under SoapboxFE returns 404 - AdminFE under SoapboxFE returns 404

View file

@ -1,25 +1,29 @@
;; Test complet ;; Test complet
; Manifest ; Manifest
domain="sub.domain.tld" domain="domain.tld"
path="/" path="/path"
backend="domain.tld"
is_public=1 is_public=1
language="fr"
admin="john"
password="1Strong-Password"
port="666"
; Checks ; Checks
pkg_linter=1 pkg_linter=1
setup_sub_dir=0 setup_sub_dir=1
setup_root=1 setup_root=1
setup_nourl=0 setup_nourl=0
setup_private=1 setup_private=1
setup_public=1 setup_public=1
upgrade=1 upgrade=1
#upgrade=1 from_commit=CommitHash
backup_restore=1 backup_restore=1
multi_instance=0 multi_instance=1
port_already_use=0 port_already_use=0
change_url=0 change_url=1
; Checks
setup_sub_dir=1
upgrade=1
backup_restore=1
;;; Options ;;; Options
Email= Email=
Notification=change Notification=none
;;; Upgrade options
; commit=CommitHash
name=Name and date of the commit.
manifest_arg=domain=DOMAIN&path=PATH&is_public=1&language=fr&admin=USER&password=pass&port=666&

View file

@ -1,5 +1,6 @@
SOURCE_URL=https://gitlab.com/soapbox-pub/soapbox-fe/-/jobs/1396593082/artifacts/download SOURCE_URL=https://gitlab.com/soapbox-pub/soapbox/-/jobs/artifacts/v3.0.0/download?job=build-production
SOURCE_SUM=7349194c32136d0876987eef1e8d235b87a17e58b68c769e3f18ac97be4564c3 SOURCE_SUM=ea62f2f9c27b391d156b1fe7c4e4384ac1b45c7f01af6b0e5337b9a8f18d8ac2
SOURCE_SUM_PRG=sha256sum SOURCE_SUM_PRG=sha256sum
SOURCE_FORMAT=zip SOURCE_FORMAT=zip
SOURCE_IN_SUBDIR=true
SOURCE_EXTRACT=true SOURCE_EXTRACT=true

View file

@ -1,7 +1,8 @@
location / { #sub_path_only rewrite ^__PATH__$ __PATH__/ permanent;
location __PATH__/ {
# Path to source # Path to source
alias __FINALPATH__/static/; alias __FINALPATH__/;
# Default indexes and catch-all # Default indexes and catch-all
index index.html; index index.html;
@ -31,7 +32,7 @@ location / {
proxy_pass $scheme://127.0.0.1$request_uri; proxy_pass $scheme://127.0.0.1$request_uri;
# proxy_redirect $scheme://__DOMAIN__$request_uri $scheme://soapbox.g0v.moe$request_uri; # proxy_redirect $scheme://__DOMAIN__$request_uri $scheme://soapbox.g0v.moe$request_uri;
proxy_set_header Host example.com; proxy_set_header Host __BACKEND__;
proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Real-IP $remote_addr;
# doesn't work with some browsers # doesn't work with some browsers

View file

@ -1 +1 @@
SoapboxFE is an alternative frontend for Pleroma. Soapbox is customizable open-source software that puts the power of social media in the hands of the people. Feature-rich and hyper-focused on providing a user experience to rival Big Tech, Soapbox is already home to some of the biggest alternative social platforms.

View file

@ -1,6 +1,6 @@
### Important points to read before installing ### Important points to read before installing
- [Pleroma (Yunohost ver.)](https://github.com/YunoHost-Apps/pleroma_ynh) must be installed locally before you install SoapboxFE - [Pleroma (YunoHost ver.)](https://github.com/YunoHost-Apps/pleroma_ynh) must be installed locally before you install SoapboxFE
- SoapboxFE must be installed under a Pleroma domain (i.e soapboxfe.your-pleroma-instance-domain.net) - SoapboxFE must be installed under a Pleroma domain (i.e soapboxfe.your-pleroma-instance-domain.net)
- AdminFE under SoapboxFE returns 404 - AdminFE under SoapboxFE returns 404

View file

@ -1,12 +1,12 @@
{ {
"name": "SoapboxFE", "name": "Soapbox",
"id": "soapbox", "id": "soapbox",
"packaging_format": 1, "packaging_format": 1,
"description": { "description": {
"en": "Alternative frontend for pleroma", "en": "Alternative frontend for Pleroma",
"fr": "Alternative frontend for pleroma" "fr": "Interface alternative pour Pleroma"
}, },
"version": "1.3.0~ynh1", "version": "3.0.0~ynh1",
"url": "https://soapbox.pub/", "url": "https://soapbox.pub/",
"upstream": { "upstream": {
"license": "AGPL-3.0", "license": "AGPL-3.0",
@ -19,7 +19,7 @@
"name": "" "name": ""
}, },
"requirements": { "requirements": {
"yunohost": ">= 4.3.0" "yunohost": ">= 11.0.9"
}, },
"multi_instance": false, "multi_instance": false,
"services": [ "services": [
@ -29,18 +29,14 @@
"install" : [ "install" : [
{ {
"name": "domain", "name": "domain",
"type": "domain", "type": "domain"
"ask": {
"en": "Subdomain for SoapboxFE installation, i.e: soapbox.your-pleroma.instance.com",
"fr": "Subdomain for SoapboxFE installation, i.e: soapbox.your-pleroma.instance.com"
}
}, },
{ {
"name": "backend", "name": "backend",
"type": "domain", "type": "domain",
"ask": { "ask": {
"en": "The root domain of pleroma instance installed", "en": "The root domain of Pleroma instance installed",
"fr": "The root domain of pleroma instance installed" "fr": "Le domaine racine de l'instance pleroma installée"
} }
}, },
{ {

105
scripts/change_url Normal file
View file

@ -0,0 +1,105 @@
#!/bin/bash
#=================================================
# GENERIC STARTING
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# RETRIEVE ARGUMENTS
#=================================================
old_domain=$YNH_APP_OLD_DOMAIN
old_path=$YNH_APP_OLD_PATH
new_domain=$YNH_APP_NEW_DOMAIN
new_path=$YNH_APP_NEW_PATH
app=$YNH_APP_INSTANCE_NAME
#=================================================
# LOAD SETTINGS
#=================================================
ynh_script_progression --message="Loading installation settings..." --weight=1
# Needed for helper "ynh_add_nginx_config"
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
#=================================================
# BACKUP BEFORE CHANGE URL THEN ACTIVE TRAP
#=================================================
ynh_script_progression --message="Backing up the app before changing its URL (may take a while)..." --weight=1
# Backup the current version of the app
ynh_backup_before_upgrade
ynh_clean_setup () {
# 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"
# Restore it if the upgrade fails
ynh_restore_upgradebackup
}
# Exit if an error occurs during the execution of the script
ynh_abort_if_errors
#=================================================
# CHECK WHICH PARTS SHOULD BE CHANGED
#=================================================
change_domain=0
if [ "$old_domain" != "$new_domain" ]
then
change_domain=1
fi
change_path=0
if [ "$old_path" != "$new_path" ]
then
change_path=1
fi
#=================================================
# MODIFY URL IN NGINX CONF
#=================================================
ynh_script_progression --message="Updating NGINX web server configuration..." --weight=1
nginx_conf_path=/etc/nginx/conf.d/$old_domain.d/$app.conf
# Change the path in the NGINX config file
if [ $change_path -eq 1 ]
then
# Make a backup of the original NGINX config file if modified
ynh_backup_if_checksum_is_different --file="$nginx_conf_path"
# Set global variables for NGINX helper
domain="$old_domain"
path_url="$new_path"
# Create a dedicated NGINX config
ynh_add_nginx_config
fi
# Change the domain for NGINX
if [ $change_domain -eq 1 ]
then
# Delete file checksum for the old conf file location
ynh_delete_file_checksum --file="$nginx_conf_path"
mv $nginx_conf_path /etc/nginx/conf.d/$new_domain.d/$app.conf
# Store file checksum for the new config file location
ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
fi
#=================================================
# RELOAD NGINX
#=================================================
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
ynh_systemd_action --service_name=nginx --action=reload
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Change of URL completed for $app" --last

View file

@ -20,11 +20,11 @@ ynh_abort_if_errors
#================================================= #=================================================
domain=$YNH_APP_ARG_DOMAIN domain=$YNH_APP_ARG_DOMAIN
path_url="/"
backend=$YNH_APP_ARG_BACKEND backend=$YNH_APP_ARG_BACKEND
app=$YNH_APP_INSTANCE_NAME
is_public=$YNH_APP_ARG_IS_PUBLIC is_public=$YNH_APP_ARG_IS_PUBLIC
final_path=/var/www/$app
path_url=/ app=$YNH_APP_INSTANCE_NAME
#================================================= #=================================================
# CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS # CHECK IF THE APP CAN BE INSTALLED WITH THESE ARGS
@ -40,21 +40,34 @@ ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url
#================================================= #=================================================
# STORE SETTINGS FROM MANIFEST # STORE SETTINGS FROM MANIFEST
#================================================= #=================================================
ynh_script_progression --message="Storing installation settings..." ynh_script_progression --message="Storing installation settings..." --weight=1
ynh_app_setting_set --app=$app --key=domain --value=$domain ynh_app_setting_set --app=$app --key=domain --value=$domain
ynh_app_setting_set --app=$app --key=backend --value=$backend ynh_app_setting_set --app=$app --key=backend --value=$backend
ynh_app_setting_set --app=$app --key=path --value=$path_url
ynh_app_setting_set --app=$app --key=final_path --value=$final_path ynh_app_setting_set --app=$app --key=final_path --value=$final_path
#=================================================
# CREATE DEDICATED USER
#=================================================
ynh_script_progression --message="Configuring system user..." --weight=1
ynh_system_user_create --username=$app --home_dir="$final_path"
#================================================= #=================================================
# STANDARD MODIFICATIONS # STANDARD MODIFICATIONS
#================================================= #=================================================
# SETUP SOURCE # SETUP SOURCE
#================================================= #=================================================
ynh_script_progression --message="Setting up source files..." --time --weight=1 ynh_script_progression --message="Setting up source files..." --weight=1
ynh_app_setting_set --app=$app --key=final_path --value=$final_path
ynh_setup_source --dest_dir="$final_path"
chmod 750 "$final_path"
chmod -R o-rwx "$final_path"
chown -R $app:www-data "$final_path"
ynh_setup_source --dest_dir="$final_path/static"
#================================================= #=================================================
# NGINX CONFIGURATION # NGINX CONFIGURATION
#================================================= #=================================================
@ -62,33 +75,13 @@ ynh_script_progression --message="Configuring NGINX web server..." --weight=2
# Create a dedicated NGINX config # Create a dedicated NGINX config
ynh_add_nginx_config ynh_add_nginx_config
ynh_replace_string --match_string="example.com" --replace_string="$backend" --target_file="/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
# CREATE DEDICATED USER
#=================================================
ynh_script_progression --message="Configuring system user..."
ynh_system_user_create --username=$app --home_dir="$final_path"
#=================================================
# SPECIFIC SETUP
#=================================================
# MODIFY CONFIG FILE
#=================================================
mkdir -p "$final_path"
chmod 750 "$final_path"
chmod -R o-rwx "$final_path"
chown -R $app:www-data "$final_path"
#================================================= #=================================================
# GENERIC FINALIZATION # GENERIC FINALIZATION
#================================================= #=================================================
# SETUP SSOWAT # SETUP SSOWAT
#================================================= #=================================================
ynh_script_progression --message="Configuring permissions..." 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 ]
@ -99,9 +92,10 @@ fi
#================================================= #=================================================
# RELOAD NGINX # RELOAD NGINX
#================================================= #=================================================
ynh_script_progression --message="Reloading NGINX web server..." ynh_script_progression --message="Reloading NGINX web server..." --weight=2
ynh_systemd_action --service_name=nginx --action=reload ynh_systemd_action --service_name=nginx --action=reload
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT
#================================================= #=================================================

View file

@ -24,7 +24,7 @@ final_path=$(ynh_app_setting_get --app=$app --key=final_path)
#================================================= #=================================================
# REMOVE APP MAIN DIR # REMOVE APP MAIN DIR
#================================================= #=================================================
ynh_script_progression --message="Removing app main directory..." ynh_script_progression --message="Removing app main directory..." --weight=2
# Remove the app directory securely # Remove the app directory securely
ynh_secure_remove --file="$final_path" ynh_secure_remove --file="$final_path"
@ -42,7 +42,7 @@ ynh_remove_nginx_config
#================================================= #=================================================
# REMOVE DEDICATED USER # REMOVE DEDICATED USER
#================================================= #=================================================
ynh_script_progression --message="Removing the dedicated system user..." ynh_script_progression --message="Removing the dedicated system user..." --weight=2
# Delete a system user # Delete a system user
ynh_system_user_delete --username=$app ynh_system_user_delete --username=$app

View file

@ -31,8 +31,6 @@ path_url=$(ynh_app_setting_get --app=$app --key=path)
#================================================= #=================================================
ynh_script_progression --message="Validating restoration parameters..." --weight=2 ynh_script_progression --message="Validating restoration parameters..." --weight=2
ynh_webpath_available --domain=$domain --path_url=$path_url \
|| ynh_die --message="Path not available: ${domain}${path_url}"
test ! -d $final_path \ test ! -d $final_path \
|| ynh_die --message="There is already a directory: $final_path " || ynh_die --message="There is already a directory: $final_path "
@ -41,6 +39,7 @@ test ! -d $final_path \
#================================================= #=================================================
# RESTORE THE NGINX CONFIGURATION # 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" ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
@ -68,7 +67,8 @@ chown -R $app:www-data "$final_path"
#================================================= #=================================================
# RELOAD NGINX AND PHP-FPM # RELOAD NGINX AND PHP-FPM
#================================================= #=================================================
ynh_script_progression --message="Reloading NGINX web server" ynh_script_progression --message="Reloading NGINX web server" --weight=2
ynh_systemd_action --service_name=nginx --action=reload ynh_systemd_action --service_name=nginx --action=reload
#================================================= #=================================================

View file

@ -72,18 +72,34 @@ ynh_system_user_create --username=$app --home_dir="$final_path"
#================================================= #=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE # DOWNLOAD, CHECK AND UNPACK SOURCE
#================================================= #=================================================
if [ "$upgrade_type" == "UPGRADE_APP" ] if [ "$upgrade_type" == "UPGRADE_APP" ]
then then
ynh_script_progression --message="Upgrading source files..." ynh_script_progression --message="Upgrading source files..."
# Download, check integrity, uncompress and patch the source from app.src # Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$final_path/static" --keep="$$final_path/static/instance/" ynh_setup_source --dest_dir="$final_path" --keep="instance"
fi fi
chmod 750 "$final_path" chmod 750 "$final_path"
chmod -R o-rwx "$final_path" chmod -R o-rwx "$final_path"
chown -R $app:www-data "$final_path" chown -R $app:www-data "$final_path"
#=================================================
# NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Upgrading NGINX web server configuration..." --weight=1
# Create a dedicated NGINX config
ynh_add_nginx_config
#=================================================
# RELOAD NGINX
#=================================================
ynh_script_progression --message="Reloading NGINX web server..." --weight=1
ynh_systemd_action --service_name=nginx --action=reload
#================================================= #=================================================
# END OF SCRIPT # END OF SCRIPT
#================================================= #=================================================