mirror of
https://github.com/YunoHost-Apps/pleroma_ynh.git
synced 2024-09-03 20:15:59 +02:00
commit
63723f18af
8 changed files with 96 additions and 99 deletions
|
@ -1,2 +1 @@
|
||||||
proxy_cache_path /tmp/{APP}-media-cache levels=1:2 keys_zone={APP}_media_cache:10m max_size=__SIZE__
|
proxy_cache_path /tmp/__APP__-media-cache levels=1:2 keys_zone=__APP___media_cache:10m max_size=__SIZE__ inactive=720m use_temp_path=off;
|
||||||
inactive=720m use_temp_path=off;
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
rewrite ^/proxy/(.*)/(.*)/.* /proxy/$1/$2 last;
|
rewrite ^/proxy/(.*)/(.*)/.* /proxy/$1/$2 last;
|
||||||
|
|
||||||
location ~ ^/(media|proxy) {
|
location ~ ^/(media|proxy) {
|
||||||
proxy_cache {APP}_media_cache;
|
proxy_cache __APP___media_cache;
|
||||||
proxy_cache_key $host$uri$is_args$args;
|
proxy_cache_key $host$uri$is_args$args;
|
||||||
proxy_http_version 1.1;
|
proxy_http_version 1.1;
|
||||||
proxy_cache_valid 200 206 301 304 1h;
|
proxy_cache_valid 200 206 301 304 1h;
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
location / {
|
location / {
|
||||||
|
|
||||||
# if you do not want remote frontends to be able to access your Pleroma backend
|
# if you do not want remote frontends to be able to access your Pleroma backend
|
||||||
# server, remove these lines.
|
# server, remove these lines.
|
||||||
if ($scheme = http) {
|
if ($scheme = http) {
|
||||||
|
@ -14,7 +15,7 @@
|
||||||
|
|
||||||
proxy_pass http://localhost:__PORT__;
|
proxy_pass http://localhost:__PORT__;
|
||||||
|
|
||||||
client_max_body_size 16m;
|
client_max_body_size 50M;
|
||||||
|
|
||||||
more_set_headers "Access-Control-Allow-Origin : *";
|
more_set_headers "Access-Control-Allow-Origin : *";
|
||||||
more_set_headers "Access-Control-Allow-Methods : POST, PUT, DELETE, GET, PATCH, OPTIONS";
|
more_set_headers "Access-Control-Allow-Methods : POST, PUT, DELETE, GET, PATCH, OPTIONS";
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
"name": "yalh76"
|
"name": "yalh76"
|
||||||
}],
|
}],
|
||||||
"requirements": {
|
"requirements": {
|
||||||
"yunohost": ">= 4.1.3"
|
"yunohost": ">= 4.1.7.3"
|
||||||
},
|
},
|
||||||
"multi_instance": false,
|
"multi_instance": false,
|
||||||
"services": [
|
"services": [
|
||||||
|
|
|
@ -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="/"
|
||||||
|
@ -127,11 +126,9 @@ ynh_add_nginx_config
|
||||||
|
|
||||||
if [ $cache -eq 1 ]
|
if [ $cache -eq 1 ]
|
||||||
then
|
then
|
||||||
cp -rf "../conf/cache.conf" "/etc/nginx/conf.d/$app-cache.conf"
|
ynh_add_config --template="../conf/cache.conf" --destination="/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="__APP__" --replace_string="$app" --target_file="../conf/media.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="__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
|
||||||
ynh_store_file_checksum --file="/etc/nginx/conf.d/$domain.d/$app.conf"
|
ynh_store_file_checksum --file="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||||
|
@ -222,7 +219,6 @@ cat "../conf/ldap.exs" >> "$config"
|
||||||
ynh_replace_string --match_string="config :pleroma, configurable_from_database: false" --replace_string="config :pleroma, configurable_from_database: true" --target_file="$config"
|
ynh_replace_string --match_string="config :pleroma, configurable_from_database: false" --replace_string="config :pleroma, configurable_from_database: true" --target_file="$config"
|
||||||
|
|
||||||
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"
|
||||||
|
@ -270,6 +266,8 @@ then
|
||||||
ynh_permission_update --permission="main" --add="visitors"
|
ynh_permission_update --permission="main" --add="visitors"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
ynh_permission_create --permission="api" --url="/api" --allowed="visitors" --auth_header="false" --show_tile="false" --protected="true"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RELOAD NGINX
|
# RELOAD NGINX
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -51,6 +51,12 @@ if ynh_legacy_permissions_exists; then
|
||||||
|
|
||||||
ynh_app_setting_delete --app=$app --key=is_public
|
ynh_app_setting_delete --app=$app --key=is_public
|
||||||
fi
|
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
|
#Switch variables name
|
||||||
psql_db=$(ynh_app_setting_get --app=$app --key=psql_db)
|
psql_db=$(ynh_app_setting_get --app=$app --key=psql_db)
|
||||||
|
|
||||||
|
@ -194,11 +200,9 @@ ynh_add_nginx_config
|
||||||
ynh_secure_remove --file="/etc/nginx/conf.d/$app-cache.conf"
|
ynh_secure_remove --file="/etc/nginx/conf.d/$app-cache.conf"
|
||||||
if [ $cache -eq 1 ]
|
if [ $cache -eq 1 ]
|
||||||
then
|
then
|
||||||
cp -rf "../conf/cache.conf" "/etc/nginx/conf.d/$app-cache.conf"
|
ynh_add_config --template="../conf/cache.conf" --destination="/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="__APP__" --replace_string="$app" --target_file="../conf/media.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="__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
|
||||||
ynh_store_file_checksum --file="/etc/nginx/conf.d/$domain.d/$app.conf"
|
ynh_store_file_checksum --file="/etc/nginx/conf.d/$domain.d/$app.conf"
|
||||||
|
|
Loading…
Add table
Reference in a new issue