mirror of
https://github.com/YunoHost-Apps/pleroma_ynh.git
synced 2024-09-03 20:15:59 +02:00
Apply example_ynh
This commit is contained in:
parent
787b39587d
commit
7daa14c7b5
5 changed files with 80 additions and 84 deletions
|
@ -52,9 +52,9 @@ Go to **cd /var/www/pleroma/pleroma**.
|
||||||
### Password reset
|
### Password reset
|
||||||
|
|
||||||
**Run:**
|
**Run:**
|
||||||
|
|
||||||
$ ( cd /var/www/pleroma/pleroma && sudo -u pleroma MIX_ENV=prod ./bin/pleroma_ctl user reset_password <NICKNAME> )
|
$ ( 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.
|
This will generate a **password reset link** that you can then send to the user.
|
||||||
|
|
||||||
### Moderators
|
### Moderators
|
||||||
|
|
|
@ -1,42 +1,43 @@
|
||||||
location / {
|
location / {
|
||||||
# if you do not want remote frontends to be able to access your Pleroma backend
|
|
||||||
# server, remove these lines.
|
|
||||||
if ($scheme = http) {
|
|
||||||
rewrite ^ https://$server_name$request_uri? permanent;
|
|
||||||
}
|
|
||||||
|
|
||||||
# Standard nginx configuration
|
# if you do not want remote frontends to be able to access your Pleroma backend
|
||||||
proxy_http_version 1.1;
|
# server, remove these lines.
|
||||||
proxy_set_header Upgrade $http_upgrade;
|
if ($scheme = http) {
|
||||||
proxy_set_header Connection "upgrade";
|
rewrite ^ https://$server_name$request_uri? permanent;
|
||||||
proxy_set_header Host $http_host;
|
}
|
||||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
||||||
|
|
||||||
proxy_pass http://localhost:__PORT__;
|
# Standard nginx configuration
|
||||||
|
proxy_http_version 1.1;
|
||||||
|
proxy_set_header Upgrade $http_upgrade;
|
||||||
|
proxy_set_header Connection "upgrade";
|
||||||
|
proxy_set_header Host $http_host;
|
||||||
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||||
|
|
||||||
client_max_body_size 16m;
|
proxy_pass http://localhost:__PORT__;
|
||||||
|
|
||||||
more_set_headers "Access-Control-Allow-Origin : *";
|
client_max_body_size 50M;
|
||||||
more_set_headers "Access-Control-Allow-Methods : POST, PUT, DELETE, GET, PATCH, OPTIONS";
|
|
||||||
more_set_headers "Access-Control-Allow-Headers : Authorization, Content-Type, Idempotency-Key";
|
|
||||||
more_set_headers "Access-Control-Expose-Headers : Link, X-RateLimit-Reset, X-RateLimit-Limit, X-RateLimit-Remaining, X-Request-Id";
|
|
||||||
if ($request_method = OPTIONS) {
|
|
||||||
return 204;
|
|
||||||
}
|
|
||||||
# stop removing lines here.
|
|
||||||
|
|
||||||
more_set_headers "X-XSS-Protection : 1; mode=block";
|
more_set_headers "Access-Control-Allow-Origin : *";
|
||||||
more_set_headers "X-Permitted-Cross-Domain-Policies : none";
|
more_set_headers "Access-Control-Allow-Methods : POST, PUT, DELETE, GET, PATCH, OPTIONS";
|
||||||
more_set_headers "X-Frame-Options : DENY";
|
more_set_headers "Access-Control-Allow-Headers : Authorization, Content-Type, Idempotency-Key";
|
||||||
more_set_headers "X-Content-Type-Options : nosniff";
|
more_set_headers "Access-Control-Expose-Headers : Link, X-RateLimit-Reset, X-RateLimit-Limit, X-RateLimit-Remaining, X-Request-Id";
|
||||||
more_set_headers "Referrer-Policy : same-origin";
|
if ($request_method = OPTIONS) {
|
||||||
more_set_headers "X-Download-Options : noopen";
|
return 204;
|
||||||
# more_set_headers "Content-Security-Policy : default-src 'none'; base-uri 'self'; form-action *; frame-ancestors 'none'; img-src 'self' data: https:; media-src 'self' https:; style-src 'self' 'unsafe-inline'; font-src 'self'; script-src 'self'; connect-src 'self' wss://__DOMAIN__; upgrade-insecure-requests;";
|
}
|
||||||
|
# stop removing lines here.
|
||||||
# Uncomment this only after you get HTTPS working.
|
|
||||||
# more_set_headers "Strict-Transport-Security : max-age=31536000; includeSubDomains";
|
more_set_headers "X-XSS-Protection : 1; mode=block";
|
||||||
|
more_set_headers "X-Permitted-Cross-Domain-Policies : none";
|
||||||
|
more_set_headers "X-Frame-Options : DENY";
|
||||||
|
more_set_headers "X-Content-Type-Options : nosniff";
|
||||||
|
more_set_headers "Referrer-Policy : same-origin";
|
||||||
|
more_set_headers "X-Download-Options : noopen";
|
||||||
|
# more_set_headers "Content-Security-Policy : default-src 'none'; base-uri 'self'; form-action *; frame-ancestors 'none'; img-src 'self' data: https:; media-src 'self' https:; style-src 'self' 'unsafe-inline'; font-src 'self'; script-src 'self'; connect-src 'self' wss://__DOMAIN__; upgrade-insecure-requests;";
|
||||||
|
|
||||||
|
# Uncomment this only after you get HTTPS working.
|
||||||
|
# more_set_headers "Strict-Transport-Security : max-age=31536000; includeSubDomains";
|
||||||
|
|
||||||
|
|
||||||
# Include SSOWAT user panel.
|
# Include SSOWAT user panel.
|
||||||
include conf.d/yunohost_panel.conf.inc;
|
include conf.d/yunohost_panel.conf.inc;
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,18 +57,20 @@ fi
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# SPECIFIC BACKUP
|
# SPECIFIC BACKUP
|
||||||
#=================================================
|
|
||||||
# BACKUP CONFIG FILE
|
|
||||||
#=================================================
|
|
||||||
|
|
||||||
ynh_backup --src_path="/etc/$app/config.exs"
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP SYSTEMD
|
# BACKUP SYSTEMD
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
ynh_backup --src_path="/etc/systemd/system/$app.service"
|
ynh_backup --src_path="/etc/systemd/system/$app.service"
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# BACKUP VARIOUS FILES
|
||||||
|
#=================================================
|
||||||
|
|
||||||
|
ynh_backup --src_path="/etc/$app/config.exs"
|
||||||
|
|
||||||
|
ynh_backup --src_path="$datadir" --is_big
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP THE POSTGRESQL DATABASE
|
# BACKUP THE POSTGRESQL DATABASE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
@ -76,13 +78,6 @@ ynh_print_info --message="Backing up the PostgreSQL database..."
|
||||||
|
|
||||||
ynh_psql_dump_db --database="$db_name" > db.sql
|
ynh_psql_dump_db --database="$db_name" > db.sql
|
||||||
|
|
||||||
#=================================================
|
|
||||||
# BACKUP THE DATA DIRECTORY
|
|
||||||
#=================================================
|
|
||||||
ynh_print_info --message="Backing up data directory..."
|
|
||||||
|
|
||||||
ynh_backup --src_path="$datadir" --is_big
|
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# END OF SCRIPT
|
# END OF SCRIPT
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -23,7 +23,6 @@ ynh_abort_if_errors
|
||||||
#=================================================
|
#=================================================
|
||||||
# RETRIEVE ARGUMENTS FROM THE MANIFEST
|
# RETRIEVE ARGUMENTS FROM THE MANIFEST
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Retrieving arguments from the manifest..."
|
|
||||||
|
|
||||||
domain=$YNH_APP_ARG_DOMAIN
|
domain=$YNH_APP_ARG_DOMAIN
|
||||||
path_url="/"
|
path_url="/"
|
||||||
|
@ -40,7 +39,7 @@ admin_email=$(ynh_user_get_info --username=$admin --key="mail")
|
||||||
|
|
||||||
## Bypass package_checker name not compatible with pleroma
|
## Bypass package_checker name not compatible with pleroma
|
||||||
if [ ${PACKAGE_CHECK_EXEC:-0} -eq 1 ]; then
|
if [ ${PACKAGE_CHECK_EXEC:-0} -eq 1 ]; then
|
||||||
admin="test"
|
admin="test"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
app=$YNH_APP_INSTANCE_NAME
|
app=$YNH_APP_INSTANCE_NAME
|
||||||
|
@ -131,6 +130,7 @@ then
|
||||||
ynh_replace_string --match_string="{APP}" --replace_string="$app" --target_file="/etc/nginx/conf.d/$app-cache.conf"
|
ynh_replace_string --match_string="{APP}" --replace_string="$app" --target_file="/etc/nginx/conf.d/$app-cache.conf"
|
||||||
ynh_replace_string --match_string="__SIZE__" --replace_string="$size" --target_file="/etc/nginx/conf.d/$app-cache.conf"
|
ynh_replace_string --match_string="__SIZE__" --replace_string="$size" --target_file="/etc/nginx/conf.d/$app-cache.conf"
|
||||||
ynh_store_file_checksum --file="/etc/nginx/conf.d/$app-cache.conf"
|
ynh_store_file_checksum --file="/etc/nginx/conf.d/$app-cache.conf"
|
||||||
|
|
||||||
ynh_replace_string --match_string="{APP}" --replace_string="$app" --target_file="../conf/media.conf"
|
ynh_replace_string --match_string="{APP}" --replace_string="$app" --target_file="../conf/media.conf"
|
||||||
ynh_replace_string --match_string="__PORT__" --replace_string="$port" --target_file="../conf/media.conf"
|
ynh_replace_string --match_string="__PORT__" --replace_string="$port" --target_file="../conf/media.conf"
|
||||||
cat ../conf/media.conf >> /etc/nginx/conf.d/$domain.d/$app.conf
|
cat ../conf/media.conf >> /etc/nginx/conf.d/$domain.d/$app.conf
|
||||||
|
@ -193,28 +193,28 @@ ynh_script_progression --message="Making setup..."
|
||||||
chown -R "$app":"$app" "$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 \
|
||||||
--output $config \
|
--output $config \
|
||||||
--output-psql /tmp/setup_db.psql \
|
--output-psql /tmp/setup_db.psql \
|
||||||
--domain $domain \
|
--domain $domain \
|
||||||
--instance-name \"$name\" \
|
--instance-name \"$name\" \
|
||||||
--admin-email $admin_email \
|
--admin-email $admin_email \
|
||||||
--notify-email $admin_email \
|
--notify-email $admin_email \
|
||||||
--dbhost localhost \
|
--dbhost localhost \
|
||||||
--dbname $db_name \
|
--dbname $db_name \
|
||||||
--dbuser $db_user \
|
--dbuser $db_user \
|
||||||
--dbpass $db_pwd \
|
--dbpass $db_pwd \
|
||||||
--rum N \
|
--rum N \
|
||||||
--indexable Y \
|
--indexable Y \
|
||||||
--db-configurable Y \
|
--db-configurable Y \
|
||||||
--uploads-dir $datadir/uploads \
|
--uploads-dir $datadir/uploads \
|
||||||
--static-dir $datadir/static \
|
--static-dir $datadir/static \
|
||||||
--listen-ip 127.0.0.1 \
|
--listen-ip 127.0.0.1 \
|
||||||
--listen-port $port \
|
--listen-port $port \
|
||||||
--strip-uploads Y \
|
--strip-uploads Y \
|
||||||
--anonymize-uploads Y \
|
--anonymize-uploads Y \
|
||||||
--dedupe-uploads Y"
|
--dedupe-uploads Y"
|
||||||
popd
|
popd
|
||||||
|
|
||||||
cat "../conf/ldap.exs" >> "$config"
|
cat "../conf/ldap.exs" >> "$config"
|
||||||
|
@ -223,13 +223,13 @@ ynh_replace_string --match_string="config :pleroma, configurable_from_database:
|
||||||
|
|
||||||
pushd $final_path/$app
|
pushd $final_path/$app
|
||||||
|
|
||||||
su "$app" -s $SHELL -lc "$final_path/$app/bin/pleroma_ctl migrate"
|
su "$app" -s $SHELL -lc "$final_path/$app/bin/pleroma_ctl migrate"
|
||||||
|
|
||||||
ynh_systemd_action --service_name=$app --action="start" --log_path=systemd --line_match="Started $app"
|
ynh_systemd_action --service_name=$app --action="start" --log_path=systemd --line_match="Started $app"
|
||||||
sleep 60
|
sleep 60
|
||||||
|
|
||||||
# Add user
|
# Add user
|
||||||
su "$app" -s $SHELL -lc "$final_path/$app/bin/pleroma_ctl user new $admin $admin_email --password $password --moderator --admin -y"
|
su "$app" -s $SHELL -lc "$final_path/$app/bin/pleroma_ctl user new $admin $admin_email --password $password --moderator --admin -y"
|
||||||
popd
|
popd
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -56,10 +56,10 @@ psql_db=$(ynh_app_setting_get --app=$app --key=psql_db)
|
||||||
|
|
||||||
if [ -n "$psql_db" ]
|
if [ -n "$psql_db" ]
|
||||||
then
|
then
|
||||||
db_name=$(ynh_app_setting_get --app=$app --key=psql_db)
|
db_name=$(ynh_app_setting_get --app=$app --key=psql_db)
|
||||||
db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd)
|
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_name --value=$db_name
|
||||||
ynh_app_setting_set --app=$app --key=db_pwd --value=$db_pwd
|
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=psql_db
|
||||||
ynh_app_setting_delete --app=$app --key=psqlpwd
|
ynh_app_setting_delete --app=$app --key=psqlpwd
|
||||||
fi
|
fi
|
||||||
|
@ -239,7 +239,7 @@ ynh_script_progression --message="Making upgrade..."
|
||||||
chown -R "$app":"$app" "$final_path"
|
chown -R "$app":"$app" "$final_path"
|
||||||
|
|
||||||
pushd $final_path/$app
|
pushd $final_path/$app
|
||||||
su "$app" -s $SHELL -lc "$final_path/$app/bin/pleroma_ctl migrate"
|
su "$app" -s $SHELL -lc "$final_path/$app/bin/pleroma_ctl migrate"
|
||||||
popd
|
popd
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
Loading…
Add table
Reference in a new issue