Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restore script fails #85

Open
Xia0ben opened this issue May 4, 2023 · 1 comment
Open

Restore script fails #85

Xia0ben opened this issue May 4, 2023 · 1 comment

Comments

@Xia0ben
Copy link

Xia0ben commented May 4, 2023

Describe the bug

After failing the most recent update (see issue #84 ), I tried to restore the pre-upgrade backup of my Weblate instance, which failed, for apparently two reasons:

  1. Failure on postgre backup restore command execution:
ynh_psql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql

Returned:

ERROR: must be owner of extension pg_trgm

Which is due to not giving proper postgresql rights to user 'weblate' used in the command.

  1. Failure on weblate service start backup restore command execution:
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/weblate.log" --line_match="spawned uWSGI"

Returned:

uwsgi[3721077]: open("/etc/uwsgi/apps-available/weblate.ini"): Permission denied [core/io.c line 525]

Which is due to not properly setting access rights to the file.

Context

  • Hardware: Dedicated server
  • YunoHost version: 11.1.18
  • I have access to my server: Through SSH & through the webadmin
  • Are you in a special context or did you perform some particular tweaking on your YunoHost instance?: no
  • Using, or trying to install package version/branch: Latest
  • If upgrading, current package version: 4.15.2~ynh1

Steps to reproduce

Restoring from either the web admin interface or through the 'yunohost backup restore' command through SSH will yield the same problem.

Expected behavior

App gets back up and running =) .

Logs

Relevant log lines shared at the top.

Conclusion:

I succeeded in restoring my backup archive by untaring, editing the restore script so that:

  1. The first command for postgre is now surrounded by commands to set 'weblate' user as superuser before calling the db script, and undoing this after (not best way to deal with the problem maybe, but does the job fine):
ynh_psql_execute_as_root --sql="alter role weblate superuser;" --database=$db_name
ynh_psql_connect_as --user=$db_user --password=$db_pwd --database=$db_name < ./db.sql
ynh_psql_execute_as_root --sql="alter role weblate nosuperuser;" --database=$db_name
  1. Chmoding the problematic file to allow read by all others, before the service start lines, so that
chmod a+r /etc/uwsgi/apps-available/weblate.ini
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/weblate.log" --line_match="spawned uWSGI"

I could make a pull request with these changes if that can help ;)

@Xia0ben
Copy link
Author

Xia0ben commented Jul 26, 2023

Hello @kay0u , just pinging to know if you have had the opportunity of taking a look at this issue ? =)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant