Anyone gotten pgAdmin to build in a DevBox shell?

From: Mike Christensen <mike(at)kitchenpc(dot)com>
To: pgadmin-hackers(at)postgresql(dot)org
Subject: Anyone gotten pgAdmin to build in a DevBox shell?
Date: 2025-03-24 07:37:04
Message-ID: CABs1bs3ZUsh7L6t=0DhstMQDZzuUzPvP-S66CPe_KUXDRvarYQ@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgadmin-hackers

Hi all! I'm new here, but just finished my first PR
<https://github.com/pgadmin-org/pgadmin4/pull/8553> out of hopefully more
to come. I'm curious if anyone has successfully gotten pgAdmin to build
using Devbox <https://www.jetify.com/docs/devbox/>. I feel I'm about 80%
of the way there, but running into a few hurdles. If I can get things
working, I'd love to create a PR with a devbox.json file and some
documentation on how to run it. It could make setting up a dev environment
a lot easier as well as consistent across various platforms.

I'm currently running on NixOS, and I have absolutely nothing installed
related to Postgres or node or Python or anything, so everything is being
installed as part of the devbox. My current devbox.json is as follows:

1 │ {
2 │ "$schema": "
https://raw.githubusercontent.com/jetify-com/devbox/0.13.6/.schema/devbox.schema.json
",
3 │ "packages": [
4 │ "nodejs(at)latest",
5 │ "yarn-berry(at)latest",
6 │ "python(at)3(dot)10",
7 │ "python310Packages(dot)pip(at)latest",
8 │ "kerberos(at)latest",
9 │ "python310Packages(dot)psycopg(at)latest",
10 │ "postgresql(at)latest",
11 │ "python310Packages(dot)psycopg2(at)latest",
12 │ "libpq(at)latest",
13 │ "openssh_gssapi(at)latest"
14 │ ],
15 │ "shell": {
16 │ "init_hook": [
17 │ ". venv/bin/activate"
18 │ ],
19 │ "scripts": {
20 │ "bundle": "make bundle",
21 │ "install": "pip install -r $PGADMIN4_SRC/requirements.txt",
22 │ "setup": "python3 $PGADMIN4_SRC/web/setup.py setup-db",
23 │ "start": "python3 $PGADMIN4_SRC/web/pgAdmin4.py"
24 │ }
25 │ }
26 │ }

So we have the usual gang, such as the latest version of Node, Yarn, Python
3.10, pip, and the Postgres client stuff (like psql, pg_config, etc).
Everything else is just me screwing around with things trying to get it all
working.

The good news is the web bundling via yarn works great. No problems
there. The problems all center around building the Python stuff. There's
two requirements that are throwing me for a loop:

- psycopg[c]==3.2.4
- gssapi==1.9.*

If I comment them out (with a few workarounds) I can actually get the build
running and pgAdmin booted up!

First up, psycopg. See the attached psycopg_errors.txt file for the build
output. From what I can tell, the build failure is due to not having the
postgresql-dev headers installed. However, it doesn't appear there's a Nix
package that contains these headers unless I'm not looking hard enough.
I've been able to work around this by installing the pre-built binaries
directly and commenting out the requirement, but this would be platform
specific so not really a useful long term solution. Possibly someone has
some ideas for a way to solve this one. Actually I haven't even gotten
this to build just using NixOS directly, let alone DevBox. Possibly the
solution is just someone creating a Nix package with these headers if it
doesn't exist already.

Next up, gssapi. See the attached gssapi_errors.txt for build output.
This requirement seems to be related to some sort of auth library, I'm
guessing Kerberos. I tried installing various related packages but
couldn't really figure out a solution. Luckily, I can just comment it out
and everything builds fine. I'm guessing if I were actually using Kerberos
auth it would probably blow up though. If there's a good solution for this
one, I'd love to know.

Anyway, as I said I can comment both those requirements out and the Devbox
shell works and builds great and I can run pgAdmin. I love the idea of an
isolated build environment that can be described using a single JSON file
and checked into the GIt repo. If this seems like something people would
like to pursue, and I can get some pointers on solving these two
requirement issues, then I'd love to put this together in a PR that other
developers could use as well.

Oh, I'd also be interested in knowing if any developers have gotten the
pgAdmin build running in a Docker container as well, and might want to
share their Dockerfile. If I can't get anywhere with Devbox, that might be
my next attempt. Thanks!

Mike

Attachment Content-Type Size
psycopg_errors.txt text/plain 6.0 KB
gssapi_errors.txt text/plain 49.6 KB

Browse pgadmin-hackers by date

  From Date Subject
Next Message Aditya Toshniwal 2025-03-25 11:41:14 Role Based Access Permissions
Previous Message Aditya Toshniwal 2025-03-21 12:00:32 Re: Regarding opening user management in a tab - #8574