trunk icon indicating copy to clipboard operation
trunk copied to clipboard

No good way to handle a LOT of assets

Open ZizoAdam opened this issue 2 years ago • 7 comments

Angular also didn't have a good way of handling this problem IIRC so it's definitely not common but basically I have about 100,000 images for my little website I'm remaking in Rust and that's just too many things to copy every single code change.

A way to mark a directory to be left alone between builds would potentially be a decent way to solve this if you intend to, as for my current usage it makes trunk serve unusable.

The workaround I have used in the past of uploading the files to a separate github repository and linking to that has caused at least one person I know of some issues with github moderation.

ZizoAdam avatar Nov 05 '23 01:11 ZizoAdam

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

github-actions[bot] avatar Dec 06 '23 00:12 github-actions[bot]

If you have this many assets, you really would just want to serve them with separate server and rely on the proxy support. In production as well, the tendency is to dedicate a static server for assets beyond things that need quick loading speed. Since these static servers are very easy to configure and easy to proxy, this solution makes more sense than adding complication to trunk.

psionic-k avatar Mar 01 '24 12:03 psionic-k

My use case involved me wanting to host on github pages for free, so I didn't want to make a separate server that I'd likely have to pay for.

ZizoAdam avatar Mar 01 '24 13:03 ZizoAdam

The problem is not serving the eventual static result but the cost of rebuilding the client during development.

On the production server, Github pages in this case, you don't need a separate static server or any proxying. Trunk isn't even running there. Github pages will serve the images as long as you move them to the right place, which is configured by your deployment action.

Because your page under development behaves as if it is being served from one domain, Trunk supports numerous proxy options, allowing you to replicate the work that Trunk should not be doing, such as serving API requests.

Since Trunk is being clogged up with the 100k images, you should employ its proxy capability to offload that work in development. Locally, before you start trunk, you would start run something simple like httpd or static-web-server and proxy the images requests to it based on path.

As far as automating how you run this secondary proxy backend, I suppose it could be integrated into the proxy behavior, but these sorts of task-runner automations have numerous solutions out there already, and you would use that to run the proxy and then trunk.

Recommend closing.

psionic-k avatar Mar 02 '24 00:03 psionic-k

My use case involved me wanting to host on github pages for free, so I didn't want to make a separate server that I'd likely have to pay for.

I doesn't need to be a second server, it could also be a second github report, hosting static files.

Anyway, I am open to PRs on this matter. But I think there are better ways to do this.

ctron avatar Mar 04 '24 07:03 ctron

it could also be a second github repo

I have done that in the past, but someone who did the same actually got their account closed over it. Github staff don't like it so I made a new version that had it all in one repo.

I think there are better ways to do this

This is a pretty specific scenario and I imagine most people who have 10000+ assets aren't trying to host them statically on github pages. Nonetheless it's a scenario that came up for me and thought it would be worth bringing up.

ZizoAdam avatar Mar 04 '24 10:03 ZizoAdam

Nonetheless it's a scenario that came up for me and thought it would be worth bringing up.

Absolutely. I just don't expect much enthusiasm of anyone to work on this. Of course, if you want to come up with a PR, that would be a valuable improvement.

ctron avatar Mar 04 '24 10:03 ctron