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

Refactor package updater #2630

Open
ainar-g opened this issue Feb 2, 2021 · 5 comments
Open

Refactor package updater #2630

ainar-g opened this issue Feb 2, 2021 · 5 comments
Assignees
Milestone

Comments

@ainar-g
Copy link
Contributor

ainar-g commented Feb 2, 2021

Our testers reported that they cannot autoupdate from v0.105.0-beta.2 to v0.105.0-beta.3. Probably package updater issues. In the future, the package requires a thorough rewrite.

@ainar-g ainar-g added this to the v0.105.0 milestone Feb 2, 2021
@ainar-g ainar-g self-assigned this Feb 2, 2021
adguard pushed a commit that referenced this issue Feb 2, 2021
Merge in DNS/adguard-home from 2630-updates to master

Updates #2630.

Squashed commit of the following:

commit 6dab69d
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Tue Feb 2 20:00:59 2021 +0300

    all: changelog

commit 63720bb
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Tue Feb 2 19:54:28 2021 +0300

    updater: fix pkg unpacking
@ainar-g
Copy link
Contributor Author

ainar-g commented Feb 2, 2021

Okay, so we've pushed a patch for this in 9cd9054. But we still have a lot of users with bad updaters. As such the plan @ameshkov has proposed is the following:

  1. We will temporarily be repacking our ZIP autoupdater archives for Darwin to have all files at the top level. This will not affect GitHub release page archives. Those will still contain the proper top-level directory.
  2. That will go on at least until v0.106.0 release. The v0.105.0 release will contain the committed fix, and we assume that by the time v0.106.0 arrives most people will switch to a release from the v0.105 line.
  3. The v0.106.0 release will drop the crutch.
  4. (Preferably.) During the v0.106.0 cycle we'll rewrite the autoupdater code in AdGuard Home and properly cover it with tests.

@ameshkov, can you please make sure that I've described the plan correctly?

@ameshkov
Copy link
Member

ameshkov commented Feb 3, 2021

I think we can drop it once we release the first patch to v0.105

@ainar-g ainar-g modified the milestones: v0.105.0, v0.105.1 Feb 4, 2021
@ainar-g ainar-g modified the milestones: v0.105.1, v0.105.2 Feb 15, 2021
@ameshkov ameshkov modified the milestones: v0.105.2, v0.106.0 Mar 3, 2021
@ainar-g
Copy link
Contributor Author

ainar-g commented Mar 15, 2021

We've removed the crutch, but we still need to refactor the updater.

@ainar-g ainar-g changed the title macOS autoupdate doesn't work for beta Refactor package updater Mar 30, 2021
@ameshkov ameshkov modified the milestones: v0.106.0, v0.107.0 Apr 19, 2021
@ainar-g
Copy link
Contributor Author

ainar-g commented Oct 25, 2021

We'll probably rewrite the package completely in the next cycle. Moving the issue there.

@mercyground
Copy link

mercyground commented Jan 1, 2022

As part of the re-write may I suggest a few things?

I wrote this thread on how to install and use AGH's edge builds on OpenWrt. : https://forum.openwrt.org/t/how-to-updated-2021-installing-adguardhome-on-openwrt/113904 It details a fair chunk of issues others have had installing and using AGH.

For OpenWrt router installs you are usually limited on space and memory. As such disk space checks before you update should look to provide feedback to users updating from the web interface. At present updates that fail due to low diskspace do generate a warning in syslog but do not return a useful error message to the web interface. That was one of the reasons I filed the #3801 issue. Some of this can be mitigated by using exroot or even mounting a usb drive as a folder via the router to avoid disk space issues. However not all routers can do this so improving disk usage and making users understand logging choices and space required is much preferred.

Its also why I generated this script to update instead. It downloads the AGH zip to /tmp (memory) and then extracts directly over the existing binary after stopping AGH. It then restarts AGH. Its not ideal because a backup is preferable but with limited space that is the compromise I've had to settle with.

It is also additionally an issue as from 106 to 107 the binary has grown considerably. #4025
The logs and filters can be dealt with by keeping minimal logs and only using basic filters. But the binary size makes managing updating on smaller routers a problem as you have at present 35mb of 107, plus its backup, plus space to unpack it (unless you unpack off /tmp or memory). Additionally maybe a config where when logs are rotated a setting of keep x logs will properly rotate and delete excess logs so manual intervention is avoided. (eg by properly configuring a logrotate either internally or via configuring and installing logrotate as a dependency. OpenWrt does have this package available https://openwrt.org/packages/pkgdata/logrotate

With 16days of usage right now i'm at 4mb for statistics, and 80mb and 50mb for 2 sets of query data. That's with 473,525
DNS Queries and 256,685 Blocked by Filters. Thats with a 7day querylog rotation period.

A proper logrotate with a prerequisite listed of some ideas of disk space needed (eg 30mb for binary, 10mb per day for queries?) will help less technical users to understand what is going on better and also enable better judgement of how to manage the setup of logging and filters. Hopefully also avoid "hey i have 2million rules why have i run out of space" posts :)

Hopefully my experiences help with planning out your upgrader flow and improve feedback via the webinterface for users.

updateAGH.sh

#!/bin/sh
#Stop AGH
/etc/init.d/AdGuardHome stop 

#Grab updated AGH from server and save to /tmp
wget https://static.adguard.com/adguardhome/edge/AdGuardHome_linux_mips_softfloat.tar.gz -P /tmp

#unzip updated file over top of AGH in /opt
tar x -vzf /tmp/AdGuardHome_linux_mips_softfloat.tar.gz -C /opt

#cleanup /tmp
rm /tmp/AdGuardHome_linux_mips_softfloat.tar.gz

#Restart AGH
/etc/init.d/AdGuardHome start
echo 'Updated'

heyxkhoa pushed a commit to heyxkhoa/AdGuardHome that referenced this issue Mar 20, 2023
Merge in DNS/adguard-home from 2630-updates to master

Updates AdguardTeam#2630.

Squashed commit of the following:

commit 6dab69d
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Tue Feb 2 20:00:59 2021 +0300

    all: changelog

commit 63720bb
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Tue Feb 2 19:54:28 2021 +0300

    updater: fix pkg unpacking
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants