-
-
Notifications
You must be signed in to change notification settings - Fork 107
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
Download the OTA update as individual files #119
Comments
As the client apps are sending there current version to the server there could also be some system generating diff zips. So in case the user had for example the previous version and now updates to the latest version he could just get a to file large diff containing the two updated files. If another user is just installing the app he would get the full zip. The diffed zips could be cached based on from and to version identifiers. Or something like a |
@anbraten since user can be in any current previous version, that would mean produce a diff zip for all previous version, plus Capgo will need to understand what is a diff in your build who seems very complex since project can be react/svelte/angular/vue/js/etc |
I guess creating the diff would be somehow possible without knowing what the details are, similar to how Doing that in a background job seems to be a nice idea in general. One benefit of sending something like a diff, could be that you save a lot of network bandwidth which would be nice for the client, but also for your server if you really have a lot of clients. Just wanted to do some brain dump in general as I read this issue 😃. I really like your lib and system. |
I totally agree if i found a easy way to do diff i would love to have that, sending duplicated file is not nice |
A comment on this, i was also thinking about sending just some files or folders in the bundle folder. My problem is having an asssets folder being around 1mb, a total waste to send on every download. So i was looking around in the code trying to figure out how the bundle swap happens, so maybe instead of a bundle "replace" i could just make a "copy and replace all" so i could just send what i want, and just override the needed folders/ files. But i can't really find the place where it happens on android. |
the files are saved in a new folder and then the capgo define the capacitor web view new default location to it, so for your idea to work, it needs to copy previous app in new folder and then override certain files, the problem is: It's difficult to be sure to have one solution to fit all, since some people in web use unique file name to flush cache |
/bounty $500 |
hey, i would like to help out with this issue. would you mind giving me some context and assigning me to it? :) |
Hey @0x0elliot i did assign you ! What needs to be done:
To note:
The job is pretty big, and I believe it has to be split to be done. |
i am interested. if you would be comfortable, we can split the bounty into two tasks and 4 PRs: Part 1
Part 2
In chronological order. I am of course very new to this. Would snoop around in the discord to figure it out properly. Immediate bottlenecksTo begin with, some questions, which project exactly is the backend? to help save some time, would you mind helping me figure out which files should i look into? i am thinking of creating another API endpoint (or the equivalent in this case) for this feature as that's the cleaner way to proceed further. |
yes, of course, I can adjust the bounty accordingly. |
okay. let me know of the .env file then. why would you require it? |
if you want to be able to try end to end, otherwise you can run in local |
been trying to set it up locally. it has surely been a bottleneck to set it up. would be less of one if you can manage to create one with some instructions so that i can just focus on the issue. |
having quite a difficult time with migrations here :') @riderx |
Some notes: |
Hey @0x0elliot sorry for the delay it's now way more easy to have local env, i made the seeb db and migration file. |
Hey @riderx Still open? I'm thinking I might want to take a stab at this ... |
It's still open yes ! |
@riderx Great! I would like to tenatively adopt the same approach proposed above:
Before I start work on Part 1, I'd like to assess if the scope is commensurate with the bounty on offer. |
... or negotiate the terms before being assigned. |
ok no problem mate, just to let you know as the same time someone else contacted me in private and is also doing a proposal on how to do the work |
@riderx Haha, no problem. Thanks for the heads up. (Sounds like that person was subscribed to be notified of any activity on this issue 😀). Quick questionWhen I tried to stand up the DB using Applying migration 20230321023005_create_base_db.sql...
ERROR: schema "supabase_migrations" already exists (SQLSTATE 42P06)
At statement 242: --
-- Name: supabase_migrations; Type: SCHEMA; Schema: -; Owner: postgres
--
CREATE SCHEMA supabase_migrations Seesm like the latest Supabase docker image now ships with the |
@riderx Nevermind, I figured it out 😎 You can assign me to the issue 🙂. |
@ayewo could be nice, as a first version, to update only those files included in zip and do not delete others in order to save memory and transfer data (it could be setted by config value), just saying :) |
@AitorG yea it would nice, but I haven't been assigned to this issue, yet 😀. Someone else proposed something similar above to which @riderx replied with the following comment:
|
You have it here: #238 |
Hey @ayewo , I was the "incognito" contributor that @riderx mentioned before, and no, I wasn't subscribed to this thread, I have emails with dates to prove, haha 😁 I won't be available for the upcoming couple of weeks, so the issue is fully yours. I thought that I would share some findings/ideas that we've come up with @riderx - it is how I was thinking about approaching the problem with some corrections from @riderx. Of course, you are free to do it your way; it would be a waste of time not to share my findings. Good luck! Notes**New file format for OTA updates**Some resources about how others handle this issue Bundle manifest file will be generated and uploaded to the Capgo (or generated by any other means when not using Capgo) This manifest is required so the clients can decide which files must be downloaded. https://api.capgo.app/updates endpoint is going to be extended with the „manifest” property but everything else is going to be kept the same to not break existing versions of the plugin. Extending capacitor-updater The new capacitor-updater will need to handle new, manifest base bundles gracefully. To support this case following changes should be implemented for Android and iOS: const version = await CapacitorUpdater.download({ Extending CLI CLI should optional support incremental updates. To do: Extending Capgo Capgo backend should be updated in a way that is compatible with existing clients. To do: |
Hey, is this still up? I have some experience in setting up S3 with the CLI so I belive I can start by handling sending updates by the CLI and then move onto the updater plugin. I have some ideas how to make this work and I would love to work on this. Here are some of my ideas: I believe setting up manifest as JSON is a bad idea. If we would to do the manifest something like this:
then diffing 2 versions would not be possible. How do you figure out what files have already been uploaded? I believe a better solution would be to setup our mantifest like this: app_versions
manifest_entries
about size I am not sure, but I do think it is going to be needed to generate the metadata for the version Then when we attempt to upload new versions we would create a tree of files to upload like this:
(This will be transformed into json) and we send this to some edge function (either an existing one or a modified one)
and it would add id of said manifest_entries into the manifest of the version
then the server would create a new manifest_entry and insert it into the manifest
This however creates some problems: Deleting version would not be easy. If the have version A and version B where version B depends on files from version A we need to make sure we do not delete these files from S3 For old clients (IOS/Android plugin) without progresive deploy we still need the zip file so we still likely need to upload it into S3 which sucks as it creates duplicates of the data My solution is definitely not perfect, but nevertheless I would love to attempt this. |
@WcaleNieWolny yes, I’m still working on this. Your proposed solution is a bit too complicated though. For instance,
I’m proposing to solve this in a simple way: since this feature will likely require a new flag in So, existing apps will continue to work with the current Footnotes
|
That does not change the fact that we still need to keep zip file and individual files. I understand that this is going to have to be enabled in the config. However how do we handle the migration to this feature? If there are already versions (of the updater plugin) deployed without this partial upadate and versions with them we need to have both files. Then when everyone migrates to the version in the app store that has this new feature you will be able to disable the old zip files |
Imagine a situation like this:
|
I would be happy to work together on this. Let me know if that is okay with you |
That’s easy, the CapUpdater plugin will continue to work as it currenty does today: it will download the full zip file from the Newer apps OTOH can enjoy bandwidth savings on cellular by only downloading a partial update. Large updates tend to fail on cellular so bandwidth savings is what motiving this feature. As I said, no need to overthink this when a simpler solution exists. |
Okay, but are you satisfied with the rest of the proposal? How do you intend to implement this? |
@ayewo i would prefer to have the same endpoint and just send in the body that you allow manifest in the request: |
@riderx yea, sure. I thought about it after I posted that. |
@WcaleNieWolny I'm backed up a little bit so wondering: are you still game 😉? If yes, I'll share a spec for the 3rd pull request needed to wrap up this feature. |
/tip 100 @ayewo |
🎉🎈 @ayewo has been awarded $100! 🎈🎊 |
I will be attempting this Cap-go/capgo#601 /attempt #119
|
It's finally done you can try it with version 6.3.0 and Capgo cloud, use the bundle upload with --manifest option |
Would help if the OTA updates could be downloaded as individual files rather than one big .zip file. Especially helpful with app having a bigger OTA update size and users downloading the OTA on Mobile Data.
The text was updated successfully, but these errors were encountered: