mirror of
https://github.com/YunoHost-Apps/pleroma_ynh.git
synced 2024-09-03 20:15:59 +02:00
commit
eaa55b170b
6 changed files with 22 additions and 146 deletions
|
@ -33,7 +33,6 @@ For user friendly details about Pleroma: [see here](https://blog.soykaf.com/post
|
|||
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 **multi-instance** that means you can run **multiple Pleroma instances** on a **single server**.
|
||||
1. There is **No LDAP** support for Pleroma yet.
|
||||
1. At the end of the installation, you will receive a mail to activate and reset your password for Pleroma.
|
||||
|
||||
## License
|
||||
|
||||
|
@ -56,13 +55,13 @@ Go to **cd /var/www/pleroma/pleroma**.
|
|||
|
||||
**Run:**
|
||||
|
||||
$ sudo -u pleroma MIX_ENV=prod mix pleroma.user new <NICKNAME> <EMAIL>
|
||||
$ ( cd /var/www/pleroma/pleroma && sudo -u pleroma MIX_ENV=prod mix pleroma.user new <NICKNAME> <EMAIL> )
|
||||
|
||||
### Password reset
|
||||
|
||||
**Run:**
|
||||
|
||||
$ sudo -u pleroma MIX_ENV=prod mix pleroma.user reset_password <NICKNAME>
|
||||
$ ( cd /var/www/pleroma/pleroma && sudo -u pleroma MIX_ENV=prod mix pleroma.user reset_password <NICKNAME> )
|
||||
|
||||
This will generate a **password reset link** that you can then send to the user.
|
||||
|
||||
|
@ -73,7 +72,7 @@ You can make users **moderators**. They will then be able to **delete any post**
|
|||
|
||||
**Run:**
|
||||
|
||||
$ sudo -u pleroma MIX_ENV=prod mix pleroma.user set <NICKNAME> --[no-]admin
|
||||
$ ( cd /var/www/pleroma/pleroma && sudo -u pleroma MIX_ENV=prod mix pleroma.user set <NICKNAME> --[no-]admin )
|
||||
|
||||
**--admin** option will **make the user moderator** and **--no-admin** will **take away the moderator privileges** from the user.
|
||||
|
||||
|
|
|
@ -8,7 +8,8 @@
|
|||
domain="domain.tld" (DOMAIN)
|
||||
admin="john" (USER)
|
||||
is_public=1 (PUBLIC|public=1|private=0)
|
||||
name="pleroma"
|
||||
password="pass"
|
||||
name="My Pleroma"
|
||||
registration=0 (BOOLEAN)
|
||||
cache=1 (BOOLEAN)
|
||||
size="5g"
|
||||
|
|
|
@ -49,6 +49,19 @@
|
|||
},
|
||||
"default": true
|
||||
},
|
||||
{
|
||||
"name": "password",
|
||||
"type": "password",
|
||||
"ask": {
|
||||
"en": "Set the administrator password",
|
||||
"fr": "Définissez le mot de passe administrateur"
|
||||
},
|
||||
"help": {
|
||||
"en": "Use the help field to add an information for the admin about this question.",
|
||||
"fr": "Utilisez le champ aide pour ajouter une information à l'intention de l'administrateur à propos de cette question."
|
||||
},
|
||||
"example": "Choose a password"
|
||||
},
|
||||
{
|
||||
"name": "name",
|
||||
"ask": {
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
#=================================================
|
||||
|
||||
source _common.sh
|
||||
source ynh_send_readme_to_admin
|
||||
source /usr/share/yunohost/helpers
|
||||
|
||||
#=================================================
|
||||
|
@ -29,6 +28,7 @@ domain=$YNH_APP_ARG_DOMAIN
|
|||
path_url="/"
|
||||
admin=$YNH_APP_ARG_ADMIN
|
||||
is_public=$YNH_APP_ARG_IS_PUBLIC
|
||||
password=$YNH_APP_ARG_PASSWORD
|
||||
name=$YNH_APP_ARG_NAME
|
||||
registration=$YNH_APP_ARG_REGISTRATION
|
||||
cache=$YNH_APP_ARG_CACHE
|
||||
|
@ -251,7 +251,7 @@ chown -R "$app":"$app" "$final_path"
|
|||
# App setup and db migration
|
||||
( cd $final_path/$app && sudo -u "$app" MIX_ENV=prod mix local.hex --force )
|
||||
( cd $final_path/$app && sudo -u "$app" MIX_ENV=prod mix local.rebar --force )
|
||||
( cd $final_path/$app && sudo -u "$app" mix deps.get )
|
||||
( cd $final_path/$app && sudo -u "$app" MIX_ENV=prod mix deps.get )
|
||||
|
||||
ynh_psql_execute_as_root \
|
||||
"ALTER USER $app WITH SUPERUSER;"
|
||||
|
@ -261,14 +261,8 @@ ynh_psql_execute_as_root \
|
|||
ynh_psql_execute_as_root \
|
||||
"ALTER USER $app WITH NOSUPERUSER;"
|
||||
|
||||
# Add user and retrieve a password reset link that you can then send to the user
|
||||
admin_pass_reset_url=$( cd $final_path/$app && sudo -u "$app" MIX_ENV=prod mix pleroma.user new "$admin" "$admin_email" | tail -1 )
|
||||
|
||||
# Make user moderator
|
||||
( cd $final_path/$app && sudo -u "$app" MIX_ENV=prod mix pleroma.user set "$admin" --moderator )
|
||||
|
||||
# Make user admin
|
||||
( cd $final_path/$app && sudo -u "$app" MIX_ENV=prod mix pleroma.user set "$admin" --admin )
|
||||
# Add user
|
||||
( cd $final_path/$app && sudo -u "$app" MIX_ENV=prod mix pleroma.user new "$admin" "$admin_email" --password "$password" --moderator --admin -y )
|
||||
|
||||
#=================================================
|
||||
# SETUP SYSTEMD
|
||||
|
@ -404,18 +398,3 @@ systemctl reload nginx
|
|||
|
||||
yunohost service start $app
|
||||
sleep 10
|
||||
|
||||
#=================================================
|
||||
# SEND A README FOR THE ADMIN
|
||||
#=================================================
|
||||
|
||||
message=" $app was successfully installed :)
|
||||
Please open your $app domain: https://$domain$path_url
|
||||
|
||||
The moderator username is: $admin
|
||||
To reset your password: $admin_pass_reset_url
|
||||
|
||||
If you are facing any problem or want to improve this app, please open a new issue here: https://github.com/YunoHost-Apps/pleroma_ynh/
|
||||
If you are not afraid of the terminal, check out https://git.pleroma.social/pleroma/pleroma/wikis/home to see what more you can do with your awesome instance!"
|
||||
|
||||
ynh_send_readme_to_admin "$message" "$admin"
|
||||
|
|
|
@ -148,52 +148,6 @@ ynh_system_user_create $app
|
|||
# ...
|
||||
#=================================================
|
||||
|
||||
#===================================================
|
||||
# Add PostgreSQL extension pg_trgm and citext
|
||||
#===================================================
|
||||
|
||||
#ynh_psql_execute_as_root "\connect $db_name
|
||||
#CREATE EXTENSION IF NOT EXISTS unaccent;CREATE EXTENSION IF NOT EXISTS pg_trgm;"
|
||||
#ynh_psql_execute_as_root "\connect $db_name
|
||||
#CREATE EXTENSION IF NOT EXISTS unaccent;CREATE EXTENSION IF NOT EXISTS citext;"
|
||||
|
||||
# Open this port
|
||||
#yunohost firewall allow Both "$port" 2>&1
|
||||
|
||||
#=================================================
|
||||
# MODIFY A CONFIG FILE
|
||||
#=================================================
|
||||
#cp -f ../conf/prod.secret.exs "$final_path/$app/config/prod.secret.exs"
|
||||
#cp -f ../conf/setup_db.psql "$final_path/$app/config/setup_db.psql"
|
||||
|
||||
#ynh_replace_string "__DOMAIN__" "$domain" "$final_path/$app/config/prod.secret.exs"
|
||||
#ynh_replace_string "__KEY__" "$random_key" "$final_path/$app/config/prod.secret.exs"
|
||||
#ynh_replace_string "__INSTANCE_NAME__" "$name" "$final_path/$app/config/prod.secret.exs"
|
||||
#ynh_replace_string "__DB_NAME__" "$app" "$final_path/$app/config/prod.secret.exs"
|
||||
#ynh_replace_string "__DB_PWD__" "$db_pwd" "$final_path/$app/config/prod.secret.exs"
|
||||
#ynh_replace_string "__ADMIN_EMAIL__" "$admin_email" "$final_path/$app/config/prod.secret.exs"
|
||||
#ynh_replace_string "__PORT__" "$port" "$final_path/$app/config/prod.secret.exs"
|
||||
#ynh_replace_string "__DB_NAME__" "$app" "$final_path/$app/config/setup_db.psql"
|
||||
#ynh_replace_string "__DB_PWD__" "$db_pwd" "$final_path/$app/config/setup_db.psql"
|
||||
#if [ $cache -eq 1 ]
|
||||
#then
|
||||
# ynh_replace_string "__MEDIA_CACHE__" "true" "$final_path/$app/config/prod.secret.exs"
|
||||
#else
|
||||
# ynh_replace_string "__MEDIA_CACHE__" "false" "$final_path/$app/config/prod.secret.exs"
|
||||
#fi
|
||||
|
||||
# Set registrations open/closed
|
||||
#if [ $registration -eq 1 ]
|
||||
#then
|
||||
# ynh_replace_string "__REG__" "true" "$final_path/$app/config/prod.secret.exs"
|
||||
#else
|
||||
# ynh_replace_string "__REG__" "false" "$final_path/$app/config/prod.secret.exs"
|
||||
#fi
|
||||
|
||||
# Recalculate and store the config file checksum into the app settings
|
||||
#ynh_store_file_checksum "$final_path/$app/config/prod.secret.exs"
|
||||
|
||||
|
||||
|
||||
#=================================================
|
||||
# MAKE UPGRADE
|
||||
|
|
|
@ -1,70 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
# Need also the helper https://github.com/YunoHost-Apps/Experimental_helpers/blob/master/ynh_handle_getopts_args/ynh_handle_getopts_args
|
||||
|
||||
# Send an email to inform the administrator
|
||||
#
|
||||
# usage: ynh_send_readme_to_admin app_message [recipients]
|
||||
# | arg: -m --app_message= - The message to send to the administrator.
|
||||
# | arg: -r, --recipients= - The recipients of this email. Use spaces to separate multiples recipients. - default: root
|
||||
# example: "root admin@domain"
|
||||
# If you give the name of a YunoHost user, ynh_send_readme_to_admin will find its email adress for you
|
||||
# example: "root admin@domain user1 user2"
|
||||
ynh_send_readme_to_admin() {
|
||||
# Declare an array to define the options of this helper.
|
||||
declare -Ar args_array=( [m]=app_message= [r]=recipients= )
|
||||
local app_message
|
||||
local recipients
|
||||
# Manage arguments with getopts
|
||||
ynh_handle_getopts_args "$@"
|
||||
local app_message="${app_message:-...No specific information...}"
|
||||
local recipients="${recipients:-root}"
|
||||
|
||||
# Retrieve the email of users
|
||||
find_mails () {
|
||||
local list_mails="$1"
|
||||
local mail
|
||||
local recipients=" "
|
||||
# Read each mail in argument
|
||||
for mail in $list_mails
|
||||
do
|
||||
# Keep root or a real email address as it is
|
||||
if [ "$mail" = "root" ] || echo "$mail" | grep --quiet "@"
|
||||
then
|
||||
recipients="$recipients $mail"
|
||||
else
|
||||
# But replace an user name without a domain after by its email
|
||||
if mail=$(ynh_user_get_info "$mail" "mail" 2> /dev/null)
|
||||
then
|
||||
recipients="$recipients $mail"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
echo "$recipients"
|
||||
}
|
||||
recipients=$(find_mails "$recipients")
|
||||
|
||||
local mail_subject="☁️🆈🅽🅷☁️: \`$app\` was just installed!"
|
||||
|
||||
local mail_message="This is an automated message from your beloved YunoHost server.
|
||||
|
||||
Specific information for the application $app.
|
||||
|
||||
$app_message
|
||||
|
||||
---
|
||||
Automatic diagnosis data from YunoHost
|
||||
|
||||
$(yunohost tools diagnosis | grep -B 100 "services:" | sed '/services:/d')"
|
||||
|
||||
# Define binary to use for mail command
|
||||
if [ -e /usr/bin/bsd-mailx ]
|
||||
then
|
||||
local mail_bin=/usr/bin/bsd-mailx
|
||||
else
|
||||
local mail_bin=/usr/bin/mail.mailutils
|
||||
fi
|
||||
|
||||
# Send the email to the recipients
|
||||
echo "$mail_message" | $mail_bin -a "Content-Type: text/plain; charset=UTF-8" -s "$mail_subject" "$recipients"
|
||||
}
|
Loading…
Add table
Reference in a new issue