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

Merge pull request #176 from YunoHost-Apps/example

Example
This commit is contained in:
yalh76 2021-08-27 03:05:46 +02:00 committed by GitHub
commit 85a54f5cc4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 285 additions and 213 deletions

View file

@ -1,44 +1,48 @@
<!--
N.B.: This README was automatically generated by https://github.com/YunoHost/apps/tree/master/tools/README-generator
It shall NOT be edited by hand.
-->
# Pleroma for YunoHost # Pleroma for YunoHost
[![Integration level](https://dash.yunohost.org/integration/pleroma.svg)](https://dash.yunohost.org/appci/app/pleroma) ![](https://ci-apps.yunohost.org/ci/badges/pleroma.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/pleroma.maintain.svg) [![Integration level](https://dash.yunohost.org/integration/pleroma.svg)](https://dash.yunohost.org/appci/app/pleroma) ![](https://ci-apps.yunohost.org/ci/badges/pleroma.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/pleroma.maintain.svg)
[![Install Pleroma with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=pleroma) [![Install Pleroma with YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=pleroma)
> *This package allows you to install Pleroma quickly and simply on a YunoHost server. *[Lire ce readme en français.](./README_fr.md)*
> *This package allows you to install Pleroma 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
Pleroma is a microblogging server software that can federate (= exchange messages with) other servers that support ActivityPub. What that means is that you can host a server for yourself or your friends and stay in control of your online identity, but still exchange messages with people on larger servers. Pleroma will federate with all servers that implement ActivityPub, like Friendica, GNU Social, Hubzilla, Mastodon, Misskey, Peertube, and Pixelfed.
For user friendly details about Pleroma: [see here](https://blog.soykaf.com/post/what-is-pleroma/) A free, federated social networking server built on open protocols.
**Mastodon web front-end for Pleroma:** Add **/web** in front of your Pleroma domain, eg. pleroma.domain.tld/web **Shipped version:** 2.4.0~ynh2
## Mobile clients that work with Pleroma: **Demo:** http://distsn.org/pleroma-instances.html
- Twidere
- Tusky
- Pawoo (Android + iOS)
- Subway Tooter
- Amaroq (iOS)
- Tootdon (Android + iOS)
- Tootle (iOS)
**Shipped version:** 2.4.0
## Important points to read before installing
1. **Pleroma** require a dedicated **root domain**, eg. pleroma.domain.tld
1. **Pleroma** require a valid **certificate** installed on the domain. Yunohost can **install Letsencrypt certificate** on the domain from **admin web-interface** or through **command-line**.
1. This package is currently set to **single-instance** that means you can run a **single Pleroma instance** on a **single server**.
1. The admin **password** entered when installing must **not** contain **special characters**. (See [issue #132](https://github.com/YunoHost-Apps/pleroma_ynh/issues/132))
## Screenshots ## Screenshots
![pleroma-screenshot1](https://user-images.githubusercontent.com/30271971/52231733-ff136500-28ba-11e9-902a-18f80e627db3.png) ![](./doc/screenshots/screenshot1.png)
## Demo ## Disclaimers / important information
* [List of instances](http://distsn.org/pleroma-instances.html) * Any known limitations, constrains or stuff not working, such as (but not limited to):
* **Pleroma** require a dedicated **root domain**, eg. pleroma.domain.tld
* **Pleroma** require a valid **certificate** installed on the domain. Yunohost can **install Letsencrypt certificate** on the domain from **admin web-interface** or through **command-line**.
* This package is currently set to **single-instance** that means you can run a **single Pleroma instance** on a **single server**.
* The admin **password** entered when installing must **not** contain **special characters**. (See [issue #132](https://github.com/YunoHost-Apps/pleroma_ynh/issues/132))
* requiring a full dedicated domain ?
* architectures not supported ?
* LDAP supported but HTTP auth not.
* the app requires an important amount of RAM / disk / .. to install or to work properly
* etc...
* Other infos that people should be aware of, such as:
* any specific step to perform after installing (such as manually finishing the install, specific admin credentials, ...)
* how to configure / administrate the application if it ain't obvious
* upgrade process / specificities / things to be aware of ?
* security considerations ?
## Admin Tasks ## Admin Tasks
Go to **cd /var/www/pleroma/pleroma**. Go to **cd /var/www/pleroma/pleroma**.
@ -67,32 +71,14 @@ You can make users **moderators**. They will then be able to **delete any post**
**--admin** option will **make the user moderator** and **--no-admin** will **take away the moderator privileges** from the user. **--admin** option will **make the user moderator** and **--no-admin** will **take away the moderator privileges** from the user.
## Documentation ## Documentation and resources
* Official documentation: https://docs.pleroma.social/ * Official app website: https://pleroma.social/
* Yunohost apps documentation: https://yunohost.org/#/app_pleroma * Official user documentation: https://yunohost.org/apps
* Official admin documentation: https://docs.pleroma.social/
## YunoHost specific features * Upstream app code repository: https://git.pleroma.social/pleroma/pleroma/
* YunoHost documentation for this app: https://yunohost.org/app_pleroma
#### Multi-user support * Report a bug: https://github.com/YunoHost-Apps/pleroma_ynh/issues
LDAP supported but HTTP auth not.
The app can be used by multiple users.
#### Supported architectures
* x86-64 - [![Build Status](https://ci-apps.yunohost.org/ci/logs/pleroma.svg)](https://ci-apps.yunohost.org/ci/apps/pleroma/)
* ARMv8-A - [![Build Status](https://ci-apps-arm.yunohost.org/ci/logs/pleroma.svg)](https://ci-apps-arm.yunohost.org/ci/apps/pleroma/)
## Links
* Report a bug: https://github.com/YunoHost-Apps/pleroma_ynh/issues
* App website: https://pleroma.social/
* Upstream app repository https://git.pleroma.social/pleroma/pleroma/
* YunoHost website: https://yunohost.org/
---
## Developer info ## Developer info
@ -104,3 +90,5 @@ sudo yunohost app install https://github.com/YunoHost-Apps/pleroma_ynh/tree/test
or or
sudo yunohost app upgrade pleroma -u https://github.com/YunoHost-Apps/pleroma_ynh/tree/testing --debug sudo yunohost app upgrade pleroma -u https://github.com/YunoHost-Apps/pleroma_ynh/tree/testing --debug
``` ```
**More info regarding app packaging:** https://yunohost.org/packaging_apps

90
README_fr.md Normal file
View file

@ -0,0 +1,90 @@
# Pleroma pour YunoHost
[![Niveau d'intégration](https://dash.yunohost.org/integration/pleroma.svg)](https://dash.yunohost.org/appci/app/pleroma) ![](https://ci-apps.yunohost.org/ci/badges/pleroma.status.svg) ![](https://ci-apps.yunohost.org/ci/badges/pleroma.maintain.svg)
[![Installer Pleroma avec YunoHost](https://install-app.yunohost.org/install-with-yunohost.svg)](https://install-app.yunohost.org/?app=pleroma)
*[Read this readme in english.](./README.md)*
*[Lire ce readme en français.](./README_fr.md)*
> *Ce package vous permet d'installer Pleroma 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
Un serveur de réseautage social fédéré et gratuit basé sur des protocoles ouverts.
**Version incluse :** 2.4.0~ynh2
**Démo :** http://distsn.org/pleroma-instances.html
## Captures d'écran
![](./doc/screenshots/screenshot1.png)
## Avertissements / informations importantes
* Any known limitations, constrains or stuff not working, such as (but not limited to):
* **Pleroma** require a dedicated **root domain**, eg. pleroma.domain.tld
* **Pleroma** require a valid **certificate** installed on the domain. Yunohost can **install Letsencrypt certificate** on the domain from **admin web-interface** or through **command-line**.
* This package is currently set to **single-instance** that means you can run a **single Pleroma instance** on a **single server**.
* The admin **password** entered when installing must **not** contain **special characters**. (See [issue #132](https://github.com/YunoHost-Apps/pleroma_ynh/issues/132))
* requiring a full dedicated domain ?
* architectures not supported ?
* LDAP supported but HTTP auth not.
* the app requires an important amount of RAM / disk / .. to install or to work properly
* etc...
* Other infos that people should be aware of, such as:
* any specific step to perform after installing (such as manually finishing the install, specific admin credentials, ...)
* how to configure / administrate the application if it ain't obvious
* upgrade process / specificities / things to be aware of ?
* security considerations ?
## Admin Tasks
Go to **cd /var/www/pleroma/pleroma**.
### Adding users
**Run:**
$ ( cd /var/www/pleroma/pleroma && sudo -u pleroma MIX_ENV=prod ./bin/pleroma_ctl user new <NICKNAME> <EMAIL> )
### Password reset
**Run:**
$ ( cd /var/www/pleroma/pleroma && sudo -u pleroma MIX_ENV=prod ./bin/pleroma_ctl user reset_password <NICKNAME> )
This will generate a **password reset link** that you can then send to the user.
### Moderators
You can make users **moderators**. They will then be able to **delete any post**.
**Run:**
$ ( cd /var/www/pleroma/pleroma && sudo -u pleroma MIX_ENV=prod ./bin/pleroma_ctl user set <NICKNAME> --[no-]admin )
**--admin** option will **make the user moderator** and **--no-admin** will **take away the moderator privileges** from the user.
## Documentations et ressources
* Site officiel de l'app : https://pleroma.social/
* Documentation officielle utilisateur : https://yunohost.org/apps
* Documentation officielle de l'admin : https://docs.pleroma.social/
* Dépôt de code officiel de l'app : https://git.pleroma.social/pleroma/pleroma/
* Documentation YunoHost pour cette app : https://yunohost.org/app_pleroma
* Signaler un bug : https://github.com/YunoHost-Apps/pleroma_ynh/issues
## Informations pour les développeurs
Merci de faire vos pull request sur la [branche testing](https://github.com/YunoHost-Apps/pleroma_ynh/tree/testing).
Pour essayer la branche testing, procédez comme suit.
```
sudo yunohost app install https://github.com/YunoHost-Apps/pleroma_ynh/tree/testing --debug
ou
sudo yunohost app upgrade pleroma -u https://github.com/YunoHost-Apps/pleroma_ynh/tree/testing --debug
```
**Plus d'infos sur le packaging d'applications :** https://yunohost.org/packaging_apps

View file

@ -1,12 +1,12 @@
;; Test complet ;; Test complet
; Manifest ; Manifest
domain="domain.tld" (DOMAIN) domain="domain.tld"
admin="john" (USER) admin="john"
is_public=1 (PUBLIC|public=1|private=0) is_public=1
password="pass" password="1Strong-Password"
name="My_Pleroma" name="My_Pleroma"
registration=0 (BOOLEAN) registration=0
cache=1 (BOOLEAN) cache=1
size="5g" size="5g"
; Checks ; Checks
pkg_linter=1 pkg_linter=1
@ -16,32 +16,6 @@
setup_private=1 setup_private=1
setup_public=1 setup_public=1
upgrade=1 upgrade=1
# 0.9.99999
# upgrade=1 from_commit=9ec87c36793780f74365d3059d7b9d12885fbfcb
# 1.1.7
# upgrade=1 from_commit=3e88dd59d8e5593fb60a86ab955aafde76abdf2e
# 1.1.8
# upgrade=1 from_commit=0a839da33898b7a58f12a27b5b51799694021353
# 1.1.9
# upgrade=1 from_commit=eedad6977760c31d7fb94ced247b9136824da580
# 2.0.0
# upgrade=1 from_commit=0693dd5efd5ab2a06267993cc7106ed2efc26ea2
# 2.0.1~ynh1
# upgrade=1 from_commit=7c3680c82b9c3f2449c6dbb346a5729a18636ac1
# 2.0.1~ynh2
# upgrade=1 from_commit=723df4423d80baa31e9717628bc5b5fd50114bc8
# 2.0.2~ynh1
# upgrade=1 from_commit=8f418ba020cee267f76bb781b03a41d384707a5b
# 2.0.2~ynh2
# upgrade=1 from_commit=251a08383f59be006803fd12013baa92b03c1ef7
# 2.0.5~ynh1
# upgrade=1 from_commit=06f0005707e77fae566fedbd6e5e37f390df5173
# 2.0.5~ynh2
# upgrade=1 from_commit=30696599937984e9879da22220253f005e290cd0
# 2.0.7~ynh1
# upgrade=1 from_commit=e13745923a2e06e780e7b9d34ae084f600a9a2a2
# 2.1.2~ynh1
# upgrade=1 from_commit=ade89203b611fd178bc9d1cf35804bc08ea3a78b
# 2.2.0~ynh1 # 2.2.0~ynh1
upgrade=1 from_commit=059ddc457aabe6962f5960612ed2dc1db53daeeb upgrade=1 from_commit=059ddc457aabe6962f5960612ed2dc1db53daeeb
# 2.2.2~ynh1 # 2.2.2~ynh1
@ -52,6 +26,8 @@
upgrade=1 from_commit=4757df265b0c3e8d1fc5280190ccfe5705dcb691 upgrade=1 from_commit=4757df265b0c3e8d1fc5280190ccfe5705dcb691
# 2.3.0~ynh3 # 2.3.0~ynh3
upgrade=1 from_commit=28ed2fd7ab7b5e55154991c990d8e780560a56db upgrade=1 from_commit=28ed2fd7ab7b5e55154991c990d8e780560a56db
# 2.4.0~ynh1
upgrade=1 from_commit=2c4a57afdc92a6428ccfea3ccb74c7e33dc9b9ff
backup_restore=1 backup_restore=1
multi_instance=0 multi_instance=0
port_already_use=0 port_already_use=0
@ -60,32 +36,6 @@
Email=anmol@datamol.org;yalh@yahoo.com Email=anmol@datamol.org;yalh@yahoo.com
Notification=yes Notification=yes
;;; Upgrade options ;;; Upgrade options
; commit=9ec87c36793780f74365d3059d7b9d12885fbfcb
name=0.9.99999
; commit=3e88dd59d8e5593fb60a86ab955aafde76abdf2e
name=1.1.7
; commit=0a839da33898b7a58f12a27b5b51799694021353
name=1.1.8
; commit=eedad6977760c31d7fb94ced247b9136824da580
name=1.1.9
; commit=0693dd5efd5ab2a06267993cc7106ed2efc26ea2
name=2.0.0
; commit=7c3680c82b9c3f2449c6dbb346a5729a18636ac1
name=2.0.1~ynh1
; commit=723df4423d80baa31e9717628bc5b5fd50114bc8
name=2.0.1~ynh2
; commit=8f418ba020cee267f76bb781b03a41d384707a5b
name=2.0.2~ynh1
; commit=251a08383f59be006803fd12013baa92b03c1ef7
name=2.0.2~ynh2
; commit=06f0005707e77fae566fedbd6e5e37f390df5173
name=2.0.5~ynh1
; commit=30696599937984e9879da22220253f005e290cd0
name=2.0.5~ynh2
; commit=e13745923a2e06e780e7b9d34ae084f600a9a2a2
name=2.0.7~ynh1
; commit=ade89203b611fd178bc9d1cf35804bc08ea3a78b
name=2.1.2~ynh1
; commit=059ddc457aabe6962f5960612ed2dc1db53daeeb ; commit=059ddc457aabe6962f5960612ed2dc1db53daeeb
name=2.2.0~ynh1 name=2.2.0~ynh1
; commit=63723f18af5b035a41e967078cc3128423b1f9ae ; commit=63723f18af5b035a41e967078cc3128423b1f9ae
@ -96,3 +46,5 @@ Notification=yes
name=2.3.0~ynh2 name=2.3.0~ynh2
; commit=28ed2fd7ab7b5e55154991c990d8e780560a56db ; commit=28ed2fd7ab7b5e55154991c990d8e780560a56db
name=2.3.0~ynh3 name=2.3.0~ynh3
; commit=2c4a57afdc92a6428ccfea3ccb74c7e33dc9b9ff
name=2.4.0~ynh1

0
doc/.gitkeep Normal file
View file

43
doc/DISCLAIMER.md Normal file
View file

@ -0,0 +1,43 @@
* Any known limitations, constrains or stuff not working, such as (but not limited to):
* **Pleroma** require a dedicated **root domain**, eg. pleroma.domain.tld
* **Pleroma** require a valid **certificate** installed on the domain. Yunohost can **install Letsencrypt certificate** on the domain from **admin web-interface** or through **command-line**.
* This package is currently set to **single-instance** that means you can run a **single Pleroma instance** on a **single server**.
* The admin **password** entered when installing must **not** contain **special characters**. (See [issue #132](https://github.com/YunoHost-Apps/pleroma_ynh/issues/132))
* requiring a full dedicated domain ?
* architectures not supported ?
* LDAP supported but HTTP auth not.
* the app requires an important amount of RAM / disk / .. to install or to work properly
* etc...
* Other infos that people should be aware of, such as:
* any specific step to perform after installing (such as manually finishing the install, specific admin credentials, ...)
* how to configure / administrate the application if it ain't obvious
* upgrade process / specificities / things to be aware of ?
* security considerations ?
## Admin Tasks
Go to **cd /var/www/pleroma/pleroma**.
### Adding users
**Run:**
$ ( cd /var/www/pleroma/pleroma && sudo -u pleroma MIX_ENV=prod ./bin/pleroma_ctl user new <NICKNAME> <EMAIL> )
### Password reset
**Run:**
$ ( cd /var/www/pleroma/pleroma && sudo -u pleroma MIX_ENV=prod ./bin/pleroma_ctl user reset_password <NICKNAME> )
This will generate a **password reset link** that you can then send to the user.
### Moderators
You can make users **moderators**. They will then be able to **delete any post**.
**Run:**
$ ( cd /var/www/pleroma/pleroma && sudo -u pleroma MIX_ENV=prod ./bin/pleroma_ctl user set <NICKNAME> --[no-]admin )
**--admin** option will **make the user moderator** and **--no-admin** will **take away the moderator privileges** from the user.

0
doc/screenshots/.gitkeep Normal file
View file

Binary file not shown.

After

Width:  |  Height:  |  Size: 637 KiB

View file

@ -6,8 +6,16 @@
"en": "A free, federated social networking server built on open protocols.", "en": "A free, federated social networking server built on open protocols.",
"fr": "Un serveur de réseautage social fédéré et gratuit basé sur des protocoles ouverts." "fr": "Un serveur de réseautage social fédéré et gratuit basé sur des protocoles ouverts."
}, },
"version": "2.4.0~ynh1", "version": "2.4.0~ynh2",
"url": "https://git.pleroma.social/pleroma/pleroma", "url": "https://pleroma.social/",
"upstream": {
"license": "AGPL-3.0-only",
"website": "https://pleroma.social/",
"demo": "http://distsn.org/pleroma-instances.html",
"admindoc": "https://docs.pleroma.social/",
"userdoc": "https://yunohost.org/apps",
"code": "https://git.pleroma.social/pleroma/pleroma/"
},
"license": "AGPL-3.0-only", "license": "AGPL-3.0-only",
"maintainer": [ "maintainer": [
{ {
@ -65,7 +73,7 @@
}, },
"default": false "default": false
}, },
{ {
"name": "cache", "name": "cache",
"type": "boolean", "type": "boolean",
"ask": { "ask": {
@ -73,7 +81,7 @@
"fr": "Activer le cache média pour votre instance" "fr": "Activer le cache média pour votre instance"
}, },
"default": true "default": true
}, },
{ {
"name": "size", "name": "size",
"type": "string", "type": "string",
@ -83,7 +91,7 @@
}, },
"choices": ["2g","5g","10g","20g","40g","80g"], "choices": ["2g","5g","10g","20g","40g","80g"],
"default": "5g" "default": "5g"
} }
] ]
} }
} }

View file

@ -44,6 +44,12 @@ ynh_print_info --message="Declaring files to be backed up..."
ynh_backup --src_path="$final_path" ynh_backup --src_path="$final_path"
#=================================================
# BACKUP THE DATA DIR
#=================================================
ynh_backup --src_path="$datadir" --is_big
#================================================= #=================================================
# BACKUP THE NGINX CONFIGURATION # BACKUP THE NGINX CONFIGURATION
#================================================= #=================================================
@ -69,8 +75,6 @@ ynh_backup --src_path="/etc/systemd/system/$app.service"
ynh_backup --src_path="/etc/$app/config.exs" ynh_backup --src_path="/etc/$app/config.exs"
ynh_backup --src_path="$datadir" --is_big
#================================================= #=================================================
# BACKUP THE POSTGRESQL DATABASE # BACKUP THE POSTGRESQL DATABASE
#================================================= #=================================================

View file

@ -30,6 +30,11 @@ ynh_script_progression --message="Loading installation settings..."
final_path=$(ynh_app_setting_get --app=$app --key=final_path) final_path=$(ynh_app_setting_get --app=$app --key=final_path)
port=$(ynh_app_setting_get --app=$app --key=port) port=$(ynh_app_setting_get --app=$app --key=port)
# Add settings here as needed by your application
#db_name=$(ynh_app_setting_get --app=$app --key=db_name)
#db_user=$db_name
#db_pwd=$(ynh_app_setting_get --app=$app --key=db_pwd)
#================================================= #=================================================
# BACKUP BEFORE CHANGE URL THEN ACTIVE TRAP # BACKUP BEFORE CHANGE URL THEN ACTIVE TRAP
#================================================= #=================================================

View file

@ -87,7 +87,7 @@ ynh_app_setting_set --app=$app --key=port --value=$port
#================================================= #=================================================
ynh_script_progression --message="Installing dependencies..." ynh_script_progression --message="Installing dependencies..."
ynh_install_app_dependencies $pkg_dependencies ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies
#================================================= #=================================================
# CREATE DEDICATED USER # CREATE DEDICATED USER
@ -95,7 +95,7 @@ ynh_install_app_dependencies $pkg_dependencies
ynh_script_progression --message="Configuring system user..." ynh_script_progression --message="Configuring system user..."
# Create a system user # 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 # CREATE A POSTGRESQL DATABASE
@ -149,17 +149,14 @@ fi
#================================================= #=================================================
# SPECIFIC SETUP # SPECIFIC SETUP
#================================================= #=================================================
# CREATE THE DATA DIRECTORY # CREATE DATA DIRECTORY
#================================================= #=================================================
ynh_script_progression --message="Creating the data directory..." ynh_script_progression --message="Creating a data directory..."
# Define app's data directory datadir=/home/yunohost.app/$app
datadir="/home/yunohost.app/${app}" ynh_app_setting_set --app=$app --key=datadir --value=$datadir
ynh_app_setting_set --app=$app --key=datadir --value="$datadir" mkdir -p $datadir
# Create app folders
mkdir -p "$datadir/"
mkdir -p "$datadir/uploads/" mkdir -p "$datadir/uploads/"
mkdir -p "$datadir/static/" mkdir -p "$datadir/static/"
mkdir -p "$datadir/static/emoji/" mkdir -p "$datadir/static/emoji/"
@ -169,9 +166,9 @@ chmod -R o-rwx "$datadir"
chown -R $app:$app "$datadir" chown -R $app:$app "$datadir"
#================================================= #=================================================
# CREATE THE CONFIG DIRECTORY # ADD A CONFIGURATION
#================================================= #=================================================
ynh_script_progression --message="Creating the config directory..." ynh_script_progression --message="Adding a configuration file..."
mkdir -p /etc/$app mkdir -p /etc/$app
chown -R $app /etc/$app chown -R $app /etc/$app
@ -191,9 +188,6 @@ ynh_add_systemd_config
#================================================= #=================================================
ynh_script_progression --message="Making setup..." ynh_script_progression --message="Making setup..."
# Give permission to the final_path
chown -R "$app":"$app" "$final_path"
pushd $final_path/$app pushd $final_path/$app
#Generate instance #Generate instance
su "$app" -s $SHELL -lc "$final_path/$app/bin/pleroma_ctl instance gen --force \ su "$app" -s $SHELL -lc "$final_path/$app/bin/pleroma_ctl instance gen --force \
@ -261,6 +255,9 @@ then
ynh_permission_update --permission="main" --add="visitors" ynh_permission_update --permission="main" --add="visitors"
fi fi
# Everyone can access to the api part
# We don't want to display the tile in the sso so we put --show_tile="false"
# And we don't want that the YunoHost Admin can remove visitors group to this permission, so we put --protected="true"
ynh_permission_create --permission="api" --url="/api" --allowed="visitors" --auth_header="false" --show_tile="false" --protected="true" ynh_permission_create --permission="api" --url="/api" --allowed="visitors" --auth_header="false" --show_tile="false" --protected="true"
#================================================= #=================================================

View file

@ -36,19 +36,14 @@ then
fi fi
#================================================= #=================================================
# STOP ALL PLEROMA SERVICES # STOP AND REMOVE SERVICE
#================================================= #=================================================
ynh_script_progression --message="Stopping all pleroma services..." ynh_script_progression --message="Stopping and removing the systemd service..."
ynh_systemd_action --service_name=$app --action="stop" --log_path=systemd --line_match="Stopped $app" ynh_systemd_action --service_name=$app --action="stop" --log_path=systemd --line_match="Stopped $app"
pkill -u $app pkill -u $app
#=================================================
# STOP AND REMOVE SERVICE
#=================================================
ynh_script_progression --message="Stopping and removing the systemd service..."
# Remove the dedicated systemd config # Remove the dedicated systemd config
ynh_remove_systemd_config ynh_remove_systemd_config
@ -98,9 +93,9 @@ fi
#================================================= #=================================================
# SPECIFIC REMOVE # SPECIFIC REMOVE
#================================================= #=================================================
# REMOVE CONFIGURATION # REMOVE VARIOUS FILES
#================================================= #=================================================
ynh_script_progression --message="Removing configuration..." ynh_script_progression --message="Removing various files..."
# Remove the config directory securely # Remove the config directory securely
ynh_secure_remove --file="/etc/$app" ynh_secure_remove --file="/etc/$app"

View file

@ -67,7 +67,7 @@ fi
ynh_script_progression --message="Recreating the dedicated system user..." ynh_script_progression --message="Recreating the dedicated system user..."
# Create the dedicated user (if not existing) # 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 # RESTORE THE APP MAIN DIR
@ -81,17 +81,14 @@ chmod -R o-rwx "$final_path"
chown -R $app:$app "$final_path" chown -R $app:$app "$final_path"
#================================================= #=================================================
# SPECIFIC RESTORATION # RESTORE THE DATA DIRECTORY
#================================================= #=================================================
# RECREATE THE DATA DIRECTORY ynh_script_progression --message="Restoring the data directory..."
#=================================================
ynh_script_progression --message="Recreating the data directory..."
# Use --not_mandatory for the data directory, because if the backup has been made with BACKUP_CORE_ONLY, there's no data into the backup.
ynh_restore_file --origin_path="$datadir" --not_mandatory ynh_restore_file --origin_path="$datadir" --not_mandatory
# Create app folders # Create app folders
mkdir -p "$datadir/" mkdir -p $datadir
mkdir -p "$datadir/uploads/" mkdir -p "$datadir/uploads/"
mkdir -p "$datadir/static/" mkdir -p "$datadir/static/"
mkdir -p "$datadir/static/emoji/" mkdir -p "$datadir/static/emoji/"
@ -101,22 +98,14 @@ chmod -R o-rwx "$datadir"
chown -R $app:$app "$datadir" chown -R $app:$app "$datadir"
#================================================= #=================================================
# RESTORE THE CONFIG FILE # SPECIFIC RESTORATION
#=================================================
ynh_script_progression --message="Restoring the config file..."
ynh_restore_file --origin_path="/etc/$app/config.exs"
chmod 400 "/etc/$app/config.exs"
chown $app:$app "/etc/$app/config.exs"
#================================================= #=================================================
# REINSTALL DEPENDENCIES # REINSTALL DEPENDENCIES
#================================================= #=================================================
ynh_script_progression --message="Reinstalling dependencies..." ynh_script_progression --message="Reinstalling dependencies..."
# Define and install dependencies # Define and install dependencies
ynh_install_app_dependencies $pkg_dependencies ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies
#================================================= #=================================================
# RESTORE THE POSTGRESQL DATABASE # RESTORE THE POSTGRESQL DATABASE
@ -131,6 +120,16 @@ ynh_psql_execute_as_root --sql="CREATE EXTENSION IF NOT EXISTS citext;" --databa
ynh_psql_execute_as_root --sql="CREATE EXTENSION IF NOT EXISTS \"uuid-ossp\";" --database=$db_name ynh_psql_execute_as_root --sql="CREATE EXTENSION IF NOT EXISTS \"uuid-ossp\";" --database=$db_name
ynh_psql_execute_file_as_root --file="./db.sql" --database="$db_name" ynh_psql_execute_file_as_root --file="./db.sql" --database="$db_name"
#=================================================
# RESTORE VARIOUS FILES
#=================================================
ynh_script_progression --message="Restoring various files..."
ynh_restore_file --origin_path="/etc/$app/config.exs"
chmod 400 "/etc/$app/config.exs"
chown $app:$app "/etc/$app/config.exs"
#================================================= #=================================================
# RESTORE SYSTEMD # RESTORE SYSTEMD
#================================================= #=================================================

View file

@ -40,48 +40,6 @@ ynh_script_progression --message="Checking version..."
upgrade_type=$(ynh_check_app_version_changed) upgrade_type=$(ynh_check_app_version_changed)
#=================================================
# ENSURE DOWNWARD COMPATIBILITY
#=================================================
ynh_script_progression --message="Ensuring downward compatibility..."
# Cleaning legacy permissions
if ynh_legacy_permissions_exists; then
ynh_legacy_permissions_delete_all
ynh_app_setting_delete --app=$app --key=is_public
fi
# Create a permission if needed
if ! ynh_permission_exists --permission="api"; then
ynh_permission_create --permission="api" --url="/api" --allowed="visitors" --auth_header="false" --show_tile="false" --protected="true"
fi
#Switch variables name
psql_db=$(ynh_app_setting_get --app=$app --key=psql_db)
if [ -n "$psql_db" ]
then
db_name=$(ynh_app_setting_get --app=$app --key=psql_db)
db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd)
ynh_app_setting_set --app=$app --key=db_name --value=$db_name
ynh_app_setting_set --app=$app --key=db_pwd --value=$db_pwd
ynh_app_setting_delete --app=$app --key=psql_db
ynh_app_setting_delete --app=$app --key=psqlpwd
fi
#Close a port
if yunohost firewall list | grep -q "\- $port$"
then
ynh_script_progression --message="Closing port $port..."
ynh_exec_warn_less yunohost firewall disallow TCP $port
fi
# Remove old repository
ynh_secure_remove --file="/etc/apt/sources.list.d/erlang-solutions.list"
apt-key del A14F4FCA
#================================================= #=================================================
# CHECK VERSION NUMBER # CHECK VERSION NUMBER
#================================================= #=================================================
@ -122,13 +80,54 @@ if ynh_version_gt "${previous_version}" "1.1.1~ynh1" ; then
pkill -u $app pkill -u $app
fi fi
#=================================================
# ENSURE DOWNWARD COMPATIBILITY
#=================================================
ynh_script_progression --message="Ensuring downward compatibility..."
# Cleaning legacy permissions
if ynh_legacy_permissions_exists; then
ynh_legacy_permissions_delete_all
ynh_app_setting_delete --app=$app --key=is_public
fi
# Create a permission if needed
if ! ynh_permission_exists --permission="api"; then
ynh_permission_create --permission="api" --url="/api" --allowed="visitors" --auth_header="false" --show_tile="false" --protected="true"
fi
#Switch variables name
psql_db=$(ynh_app_setting_get --app=$app --key=psql_db)
if [ -n "$psql_db" ]
then
db_name=$(ynh_app_setting_get --app=$app --key=psql_db)
db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd)
ynh_app_setting_set --app=$app --key=db_name --value=$db_name
ynh_app_setting_set --app=$app --key=db_pwd --value=$db_pwd
ynh_app_setting_delete --app=$app --key=psql_db
ynh_app_setting_delete --app=$app --key=psqlpwd
fi
#Close a port
if yunohost firewall list | grep -q "\- $port$"
then
ynh_script_progression --message="Closing port $port..."
ynh_exec_warn_less yunohost firewall disallow TCP $port
fi
# Remove old repository
ynh_secure_remove --file="/etc/apt/sources.list.d/erlang-solutions.list"
apt-key del A14F4FCA
#================================================= #=================================================
# CREATE DEDICATED USER # CREATE DEDICATED USER
#================================================= #=================================================
ynh_script_progression --message="Making sure dedicated system user exists..." ynh_script_progression --message="Making sure dedicated system user exists..."
# Create a dedicated user (if not existing) # 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
#================================================= #=================================================
# UPGRADE TO OTP RELEASE # UPGRADE TO OTP RELEASE
@ -217,19 +216,10 @@ fi
#================================================= #=================================================
ynh_script_progression --message="Upgrading dependencies..." ynh_script_progression --message="Upgrading dependencies..."
ynh_install_app_dependencies $pkg_dependencies ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies
#================================================= #=================================================
# SPECIFIC UPGRADE # SPECIFIC UPGRADE
#=================================================
# UPDATE A CONFIG FILE
#=================================================
ynh_script_progression --message="Updating a config file..."
config="/etc/$app/config.exs"
ynh_backup_if_checksum_is_different --file="$config"
#================================================= #=================================================
# MAKE UPGRADE # MAKE UPGRADE
#================================================= #=================================================
@ -240,12 +230,13 @@ pushd $final_path/$app
popd popd
#================================================= #=================================================
# STORE THE CONFIG FILE CHECKSUM # UPDATE A CONFIG FILE
#================================================= #=================================================
ynh_script_progression --message="Storing the config file checksum..." ynh_script_progression --message="Updating a configuration file..."
# Recalculate and store the checksum of the file for the next upgrade. config="/etc/$app/config.exs"
ynh_store_file_checksum --file="$config"
ynh_backup_if_checksum_is_different --file="$config"
chmod 400 "$config" chmod 400 "$config"
chown $app:$app "$config" chown $app:$app "$config"