Skip to content

refactor(server, web)!: store latest immich version available on the server - #3565

Merged
jrasm91 merged 55 commits into
mainfrom
refactor/immich-latest-version
Oct 24, 2023
Merged

jrasm91 merged 55 commits into
mainfrom
refactor/immich-latest-version

Conversation

@martabal

@martabal martabal commented Aug 5, 2023 •

Copy link
Copy Markdown
Contributor

warning
Breaking Change - the websocket message format has changed, so some functions will not work properly unless the server and mobile client are on the same version.


Currently, every time the admins hit refresh, they hit the GitHub API to retrieve the latest Immich version. If the version on GitHub differs from the server version, the web and mobile clients will notify the admins about the availability of a new Immich version.

However, excessive web refreshes ( by consequences on the GitHub API too ) can lead Github to ban your public IP address. To mitigate this risk and improve the users privacies, this PR move the logic from the clients to the server. Now, the server will fetch the latest Immich version from GitHub every 1 hour (not configurable for now).

WebUI changes :

Screenshot from 2023-08-12 11-26-38

@vercel

vercel Bot commented Aug 5, 2023 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Ignored Deployment
Name Status Preview Comments Updated (UTC)
immich ⬜️ Ignored (Inspect) Visit Preview Oct 24, 2023 2:50pm

Comment thread server/src/domain/system-config/system-config.service.ts Outdated
@jrasm91

jrasm91 commented Aug 5, 2023

Copy link
Copy Markdown
Member

Can we just set up a cron to run every hour or so and then store the updated version info in memory instead?

@martabal

martabal commented Aug 5, 2023

Copy link
Copy Markdown
Contributor Author

I chose an interval rather than a cron, because I'm afraid that every x hours all users make a request to GitHub at the same time which would stress GitHub servers

@martabal

martabal commented Aug 5, 2023

Copy link
Copy Markdown
Contributor Author

And yeah it's probably better to just store it in memory

@jrasm91

jrasm91 commented Aug 5, 2023 •

Copy link
Copy Markdown
Member

What do you think about getting the current release information from immich.app? We would not need to worry about rate limits afaik

@martabal

martabal commented Aug 7, 2023

Copy link
Copy Markdown
Contributor Author

What do you think about getting the current release information from immich.app? We would not need to worry about rate limits afaik

I think we'll need to have rate limits for immich.app,if we use it to retrieve the latest immich version. Plus it adds an intermediary: when releasing a new version, the version stored on immich.app will always be a few minutes out of date. I don't mind using immich.app, but it will probably need extra work

@jrasm91

jrasm91 commented Aug 7, 2023

Copy link
Copy Markdown
Member

We have a workflow that runs on release and the docker images are not available until a few minutes later anyways, so that doesn't seem like much of a problem. Afaik there are no rate limits on Vercel, especially for serving static content.

@martabal

martabal commented Aug 7, 2023

Copy link
Copy Markdown
Contributor Author

@jrasm91 Should the server make an API request right after the startup ?

@martabal
martabal force-pushed the refactor/immich-latest-version branch from 9b62897 to 96d9512 Compare August 7, 2023 22:21
@martabal
martabal force-pushed the refactor/immich-latest-version branch from 96d9512 to d7f72d7 Compare August 7, 2023 22:21
@martabal
martabal force-pushed the refactor/immich-latest-version branch from 0bb759d to e870357 Compare August 8, 2023 16:32
@martabal
martabal force-pushed the refactor/immich-latest-version branch 2 times, most recently from 9798f30 to 1891163 Compare August 8, 2023 16:38
@martabal
martabal force-pushed the refactor/immich-latest-version branch from 1891163 to 9a885e4 Compare August 8, 2023 22:45
@bo0tzz

bo0tzz commented Aug 9, 2023

Copy link
Copy Markdown
Member

I think something's gone wrong with your merge from main, some of the things that have been added there recently are showing up as new in your diff.

Comment thread server/src/domain/domain.config.ts Outdated
Comment thread server/src/domain/user/user.service.ts Outdated
@martabal
martabal force-pushed the refactor/immich-latest-version branch from cc99607 to 614c61e Compare August 9, 2023 20:25
@martabal
martabal force-pushed the refactor/immich-latest-version branch from dbf292c to 6e13fab Compare October 18, 2023 19:22
@martabal
martabal force-pushed the refactor/immich-latest-version branch from 1d4d07f to e99e576 Compare October 18, 2023 21:02
@martabal
martabal requested a review from jrasm91 October 18, 2023 21:28

@jrasm91 jrasm91 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@martabal I simplified things quite a bit, hopefully they are all OK.

  • The check runs on start up
  • The check runs on a cron job every hour and does not deal with setInterval or the scheduler registry anymore
  • The user gets an event pushed to them when they connect via a web socket
  • The user gets an event pushed to them when there is a new version available
  • The check is disabled when NODE_ENV=development

Comment thread server/src/infra/repositories/communication.repository.ts
@martabal

Copy link
Copy Markdown
Contributor Author

We talked about using cron job. The issue with cron job is that all users will request GitHub servers at the exact same time and could stress them

@bo0tzz bo0tzz left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Like Martin said, we should be very sure that we don't have all the instances hammering github at the exact same moment.

@jrasm91
jrasm91 force-pushed the refactor/immich-latest-version branch from cf2c7e7 to e2c28cd Compare October 20, 2023 07:42
@jrasm91

jrasm91 commented Oct 20, 2023

Copy link
Copy Markdown
Member

I don't think it would be an issue personally, but it was easy enough to changed it to an interval (which is still declarative) and make it dependent on server start-up time instead.

@jrasm91
jrasm91 force-pushed the refactor/immich-latest-version branch from e2c28cd to deb629e Compare October 20, 2023 08:02

@bo0tzz bo0tzz left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@jrasm91 jrasm91 changed the title refactor(server, web): store latest immich version available on the server refactor(server, web)!: store latest immich version available on the server Oct 24, 2023
@shenlong-tanwen
shenlong-tanwen force-pushed the refactor/immich-latest-version branch from deee07d to c098575 Compare October 24, 2023 14:50
@jrasm91
jrasm91 merged commit 1aae29a into main Oct 24, 2023
@jrasm91
jrasm91 deleted the refactor/immich-latest-version branch October 24, 2023 15:05
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

Successfully merging this pull request may close these issues.

7 participants