diff --git a/README.md b/README.md index dcc8303..e1fc441 100644 --- a/README.md +++ b/README.md @@ -61,7 +61,7 @@ Go to **cd /var/www/pleroma/pleroma**. **Run:** - $ MIX_ENV=prod mix pleroma.user reset_password + $ sudo -u pleroma MIX_ENV=prod mix pleroma.user reset_password This will generate a **password reset link** that you can then send to the user. @@ -72,7 +72,7 @@ You can make users **moderators**. They will then be able to **delete any post** **Run:** - $ MIX_ENV=prod mix pleroma.user set --[no-]admin + $ sudo -u pleroma MIX_ENV=prod mix pleroma.user set --[no-]admin **--admin** option will **make the user moderator** and **--no-admin** will **take away the moderator privileges** from the user. diff --git a/scripts/backup b/scripts/backup index 2f483ce..43012a4 100755 --- a/scripts/backup +++ b/scripts/backup @@ -64,7 +64,6 @@ fi #================================================= ynh_psql_dump_db "$db_name" > db.sql -#ynh_backup "db.sql" #================================================= # SPECIFIC BACKUP diff --git a/scripts/upgrade b/scripts/upgrade index cd86805..88ed856 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -152,52 +152,48 @@ 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;" +#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 +#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" +#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 +#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 +#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" +#ynh_store_file_checksum "$final_path/$app/config/prod.secret.exs" + -### Verify the checksum of a file, stored by `ynh_store_file_checksum` in the install script. -### And create a backup of this file if the checksum is different. So the file will be backed up if the admin had modified it. -ynh_backup_if_checksum_is_different "$final_path/$app/config/prod.secret.exs" -# Recalculate and store the checksum of the file for the next upgrade. -ynh_store_file_checksum "$final_path/$app/config/prod.secret.exs" #================================================= # MAKE UPGRADE @@ -214,6 +210,14 @@ ynh_psql_execute_as_root \ ynh_psql_execute_as_root \ "ALTER USER $app WITH NOSUPERUSER;" + + +### Verify the checksum of a file, stored by `ynh_store_file_checksum` in the install script. +### And create a backup of this file if the checksum is different. So the file will be backed up if the admin had modified it. +ynh_backup_if_checksum_is_different "$final_path/$app/config/prod.secret.exs" +# Recalculate and store the checksum of the file for the next upgrade. +ynh_store_file_checksum "$final_path/$app/config/prod.secret.exs" + #================================================= # SETUP LOGROTATE #=================================================