Re: Require suggestions on feature #5766

From: Anil Sahoo <anil(dot)sahoo(at)enterprisedb(dot)com>
To: Dave Page <dpage(at)pgadmin(dot)org>
Cc: pgadmin-hackers <pgadmin-hackers(at)postgresql(dot)org>
Subject: Re: Require suggestions on feature #5766
Date: 2024-12-04 05:18:53
Message-ID: CAO+oWtBKzSNxeNUwfK31wgfZ71X2-zOh-avYxwwO2dT3kff0yQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgadmin-hackers

Hi Dave,

For Windows, I checked how pgAdmin works for machine-wide installations as
admin1 (Administrator), and there is another admin user like admin2
(Administrator), and normal users are user1 and user2. When logged in as
other mentioned users, I was able to use pgAdmin, but when I tried to
upgrade pgAdmin as admin2 from v8.12 to v8.13, I faced the below error:

"An error occurred while trying to replace the existing file:

DeleteFile failed; code 5.

Access is denied."

And if I cancel installation, then run pgAdmin, v8.12 is getting corrupted
and giving

"The pgAdmin 4 server could not be contacted:
C:\Program Files (x86)\pgAdmin 4\python\python.exe: can't open file ‘ C:\\
Program Files (x86)\\pgAdmin

4\\web\\pgAdmin4.py: [Errno 2] No such file or directory."

For user-level installation, everything is working fine for different users.

I have checked some of the desktop applications that are being built with
Electron, like VS Code and Postman.

*How VS Code works is,*

They have 2 different installers, one for user level and another for system
level.

When I installed the VS Code system installer on admin1, it was working
fine, and I was able to check for updates, and for admin2 and user1, it is
available, working fine and able to check for updates, not able to update
as I am in the latest version. (Note: not found system installers for older
versions, but user installers are available)

When I installed the VS Code user installer on admin1, it was working fine,
and VS Code says when running it as an administrator in a user setup
installation, updates will be disabled.

When I tried to install the user installer on user1, it was working fine
and able to check for updates.

*How Postman works is,*

When I installed Postman on admin1, it was available for admin2 also. It
was working fine, and checking for auto updates was also working fine for
both admins. It is not available for normal users when installed for admins.

When I installed Postman for user1, it was available only for the current
user, and checking for updates was working fine.

So please give your suggestions on which approach to follow.

Thanks,

Anil

On Fri, Nov 29, 2024 at 7:15 PM Dave Page <dpage(at)pgadmin(dot)org> wrote:

> Hi
>
> On Thu, 28 Nov 2024 at 11:38, Anil Sahoo <anil(dot)sahoo(at)enterprisedb(dot)com>
> wrote:
>
>> Hi Dave,
>>
>> I have mentioned the requirements for the deployment server to add
>> auto-update in macOs systems.
>>
>>
>> The frontend will request deployment server with Accept: application/json
>> and the current version of pgAdmin and the architecture of macOs system and
>> server will check if any update is available or not, if update available
>> then server responds with status code 200 OK and sends the below format
>> JSON response in the body.
>>
>>
>> Example of deployment url:
>> https://your-deployment-url.com/update/darwin/8.12
>>
>>
>> Example of response:
>>
>> {
>> "url": "https://your-deployment-url.com/your-app-8.13-darwin.zip",
>> "name": "8.13",
>> "notes": "Theses are some release notes innit",
>> "pub_date": "2024-09-18T12:29:53+01:00"
>> }
>>
>>
>> Here url is mandatory and others are optional.
>>
>> Squirrel will request "url" with Accept: application/zip and only
>> supports installing ZIP updates.
>>
>> "pub_date" if present must be formatted according to ISO 8601.
>>
>>
>> If no update is required, the server must respond with a status code
>> of 204 No Content.
>>
>
> Ah, OK - so it's just the metadata. We can handle that pretty easily in
> the pgaweb code.
>
>
>>
>>
>> And for Windows systems, Electron recommended to use electron-winstaller
>> or electron forge as using these packages will use Squirrel.Windows for
>> creating windows installer and that will help in triggering custom launch
>> events and that can be handled by our application for proper setup. But
>> what I think is, as we are using Inno setup for creating our Windows
>> installer, we can try updating our application with existing way only, if
>> something does not work then we have the option to change our installer
>> creation process.
>>
>
> So one thing that springs to mind is that on Windows, this is only likely
> to work with per-user installations, however, generally the default is for
> machine-wide installations. Have you given that any thought?
>
>
>>
>> Thanks,
>>
>> Anil
>>
>> On Wed, Nov 27, 2024 at 10:34 PM Dave Page <dpage(at)pgadmin(dot)org> wrote:
>>
>>> Hi!
>>>
>>> On Wed, 27 Nov 2024 at 07:58, Anil Sahoo <anil(dot)sahoo(at)enterprisedb(dot)com>
>>> wrote:
>>>
>>>> Hi Dave/Team,
>>>>
>>>> I am currently working on the auto-update feature of pgAdmin 4 desktop
>>>> application, #5766
>>>> <https://github.com/pgadmin-org/pgadmin4/issues/5766>.
>>>>
>>>>
>>>> As we are using Electron for shipping our desktop application, I have
>>>> gone through some possible ways we can implement the auto update of the
>>>> app.
>>>>
>>>> I found 2 most popular ways, that are
>>>>
>>>> 1. *Use builtin electron’s autoUpdater* (Uses the Squirrel
>>>> framework & Available for Mac, Windows)
>>>> 2. *Use electron-builder and electron-updater packages *(Available
>>>> for Mac, Windows and Linux systems)
>>>>
>>>> *Linux systems:*
>>>>
>>>>
>>>> - Builtin Electron’s autoUpdater support is not available.
>>>> - electron-builder and electron-updater can be used, but need to
>>>> change the whole build process. Also most apps like VS code, Chrome, etc
>>>> does not support auto-update of apps on linux systems.
>>>>
>>>> We should not try to auto-update on Linux, because we're using the
>>> platform native packaging and auto-updating will cause nasty problems with
>>> that.
>>>
>>>
>>>> *Mac systems:*
>>>>
>>>> - We can use the builtin Electron’s autoUpdater to add auto-update
>>>> feature to macOs systems, It is simple and easy to configure. We need a
>>>> minor modification in our build process i.e. as we are supporting Intel and
>>>> Apple silicon chips, deployment url will have 2 zip files and each zip file
>>>> will hold the build for arm64 and x86_64.
>>>> - electron-builder and electron-updater can be used. With this, we
>>>> have to change the whole build process.
>>>>
>>>> *Windows systems:*
>>>>
>>>> - We can use the builtin Electron’s autoUpdater to add auto-update
>>>> feature to windows systems, Here also we need to change our build process.
>>>> Electron’s docs recommend using electron-winstaller or electron forge to
>>>> create the installer and some extra changes are needed in the deployment
>>>> server.
>>>> - electron-builder and electron-updater can be used. With this, we
>>>> have to change the whole build process.
>>>>
>>>> As Electron's builtin autoUpdater is easy to use so for now we can move
>>>> with the auto-update of the pgAdmin app on macOs systems as it requires
>>>> minimal changes.
>>>>
>>>
>>> That certainly sounds like the better option. A couple of questions:
>>>
>>> - What changes are required in the deployment server? We are very
>>> limited here, as we deploy through the postgresql.org infrastructure.
>>>
>>> - Whilst the docs (for Windows) recommend using electron-winstaller or
>>> electron forge, can you confirm one of them *must* be used? Our current
>>> installer is pretty standard in the way it works, so I'm curious to know if
>>> we would actually need to change technology for a specific reason.
>>>
>>> Thanks!
>>>
>>> --
>>> Dave Page
>>> pgAdmin: https://www.pgadmin.org
>>> PostgreSQL: https://www.postgresql.org
>>> pgEdge: https://www.pgedge.com
>>>
>>>
>>
>> --
>>
>>
>> *Anil Sahoo*
>>
>> Software Development Engineer II
>>
>> LinkedIn <https://www.linkedin.com/in/anilksahoo9/> || Blog
>> <https://www.enterprisedb.com/anil-sahoo> || *GitHub
>> <https://github.com/anilsahoo20>*
>>
>> enterprisedb.com
>>
>
>
> --
> Dave Page
> pgAdmin: https://www.pgadmin.org
> PostgreSQL: https://www.postgresql.org
> pgEdge: https://www.pgedge.com
>
>

--

*Anil Sahoo*

Software Development Engineer II

LinkedIn <https://www.linkedin.com/in/anilksahoo9/> || Blog
<https://www.enterprisedb.com/anil-sahoo> || *GitHub
<https://github.com/anilsahoo20>*

enterprisedb.com

In response to

Responses

Browse pgadmin-hackers by date

  From Date Subject
Next Message Dave Page 2024-12-05 11:41:33 Re: Require suggestions on feature #5766
Previous Message Aditya Toshniwal 2024-12-03 11:37:15 Re: Add support for tags on a server node